public static void hmacSha1Verify(byte[] key, byte[] in, byte[] expected)
throws GeneralSecurityException {
Mac hmac = Mac.getInstance(HMAC_TYPE);
Key hmacKey = new SecretKeySpec(key, HMAC_TYPE);
hmac.init(hmacKey);
hmac.update(in);
byte actual[] = hmac.doFinal();
if (actual.length != expected.length) {
throw new GeneralSecurityException("HMAC verification failure");
}
for (int i=0; i < actual.length; i++) {