@Test public void testHmacsha1Signature() { int[] a = { 80, 79, 83, 84, 10, 54, 99, 50, 101, 49, 48, 102, 49, 55, 98, 98, 55, 51, 56, 53, 102, 50, 97, 99, 51, 48, 56, 49, 49, 98, 53, 101, 56, 101, 52, 54, 102, 10, 97, 112, 112, 108, 105, 99, 97, 116, 105, 111, 110, 47, 120, 109, 108, 10, 84, 117, 101, 44, 32, 49, 51, 32, 77, 97, 121, 32, 50, 48, 49, 52, 32, 48, 57, 58, 53, 49, 58, 49, 55, 32, 71, 77, 84, 10, 120, 45, 111, 100, 112, 115, 45, 117, 115, 101, 114, 45, 97, 103, 101, 110, 116, 58, 74, 97, 118, 97, 83, 68, 75, 47, 48, 46, 49, 50, 46, 48, 59, 76, 105, 110, 117, 120, 10, 47, 112, 114, 111, 106, 101, 99, 116, 115, 47, 111, 100, 112, 115, 95, 116, 101, 115, 116, 95, 116, 117, 110, 110, 101, 108, 95, 112, 114, 111, 106, 101, 99, 116, 47, 105, 110, 115, 116, 97, 110, 99, 101, 115}; byte[] data = fromIntToByte(a); int[] b = {111, 82, 100, 51, 48, 122, 55, 115, 86, 52, 104, 66, 88, 57, 97, 89, 116, 74, 103, 105, 105, 53, 113, 110, 121, 104, 103, 61}; byte[] key = fromIntToByte(b); int[] c = {-5, 103, 5, -52, 28, -21, -38, -2, -26, 2, 83, -107, 26, 11, -91, 67, -18, 124, -98, -28}; byte[] expectedResult = fromIntToByte(c); byte[] result = SecurityUtils.hmacsha1Signature(data, key); Assert.assertEquals(true, isEquale(expectedResult, result)); }
protected static byte[] hmacsha1Signature(byte[] data, byte[] key) { try { SecretKeySpec signingKey = new SecretKeySpec(key, "HmacSHA1"); Mac mac = Mac.getInstance("HmacSHA1"); mac.init(signingKey); return mac.doFinal(data); } catch (Exception e) { throw new RuntimeException(e.getMessage(), e); } }
SecurityUtils { protected static byte[] hmacsha1Signature(byte[] data, byte[] key) { try { SecretKeySpec signingKey = new SecretKeySpec(key, "HmacSHA1"); Mac mac = Mac.getInstance("HmacSHA1"); mac.init(signingKey); return mac.doFinal(data); } catch (Exception e) { throw new RuntimeException(e.getMessage(), e); } } }
SecurityUtils { protected static byte[] hmacsha1Signature(byte[] data, byte[] key) { try { SecretKeySpec signingKey = new SecretKeySpec(key, "HmacSHA1"); Mac mac = Mac.getInstance("HmacSHA1"); mac.init(signingKey); return mac.doFinal(data); } catch (Exception e) { throw new RuntimeException(e.getMessage(), e); } }  }
SecurityUtils { protected static byte[] hmacsha1Signature(byte[] data, byte[] key) { try { SecretKeySpec signingKey = new SecretKeySpec(key, "HmacSHA1"); Mac mac = Mac.getInstance("HmacSHA1"); mac.init(signingKey); return mac.doFinal(data); } catch (Exception e) { throw new RuntimeException(e.getMessage(), e); } }  static String md5Signature(String message); static String getApplicationSignature(
      String accountProvider, String accessId, String signedString); }
SecurityUtils { protected static byte[] hmacsha1Signature(byte[] data, byte[] key) { try { SecretKeySpec signingKey = new SecretKeySpec(key, "HmacSHA1"); Mac mac = Mac.getInstance("HmacSHA1"); mac.init(signingKey); return mac.doFinal(data); } catch (Exception e) { throw new RuntimeException(e.getMessage(), e); } }  static String md5Signature(String message); static String getApplicationSignature(
      String accountProvider, String accessId, String signedString);  }