@Test public void testSignature() throws Exception { String secretKey = "secret key"; String message = "target string to sign"; for (MacAlgorithm hash : MacAlgorithm.values()) { String expected = BytesUtil.bytesToHex(SignatureUtil.sign(hash, secretKey, message)); String actual = BytesUtil.bytesToHex(SignatureUtil.sign(hash, secretKey, message)); assertEquals(expected, actual); actual = BytesUtil.bytesToHex(SignatureUtil.sign(hash, secretKey, message + "1")); assertNotEquals(expected, actual); } }
public static byte[] sign(MacAlgorithm algorithm, String secretKey, List<String> parts) { return sign(algorithm, secretKey, multiply("\n", parts)); }
SignatureUtil { public static byte[] sign(MacAlgorithm algorithm, String secretKey, List<String> parts) { return sign(algorithm, secretKey, multiply("\n", parts)); } }
SignatureUtil { public static byte[] sign(MacAlgorithm algorithm, String secretKey, List<String> parts) { return sign(algorithm, secretKey, multiply("\n", parts)); }  }
SignatureUtil { public static byte[] sign(MacAlgorithm algorithm, String secretKey, List<String> parts) { return sign(algorithm, secretKey, multiply("\n", parts)); }  static byte[] sign(MacAlgorithm algorithm, String secretKey, List<String> parts); static byte[] sign(MacAlgorithm algorithm, String secretKey, String message); static byte[] sign(MacAlgorithm algorithm, byte[] secretKey, byte[] data); }
SignatureUtil { public static byte[] sign(MacAlgorithm algorithm, String secretKey, List<String> parts) { return sign(algorithm, secretKey, multiply("\n", parts)); }  static byte[] sign(MacAlgorithm algorithm, String secretKey, List<String> parts); static byte[] sign(MacAlgorithm algorithm, String secretKey, String message); static byte[] sign(MacAlgorithm algorithm, byte[] secretKey, byte[] data);  }