Fix HMAC operation when hex key has bytes >= 0x80 (#437)

Add test vectors from RFC4231
This commit is contained in:
Oliver Grubin committed 2018-12-14 21:32:44 +00:00
1 parent 15fbe5a459
commit 63593f1b6c
2 files changed
+298 -2

No files matched your search

+1 -1
View File
@@ -72,7 +72,7 @@ class HMAC extends Operation {
msg = Utils.arrayBufferToStr(input, false),
hasher = CryptoApi.getHasher(hashFunc);
const mac = CryptoApi.getHmac(CryptoApi.encoder.fromUtf(key), hasher);
const mac = CryptoApi.getHmac(key, hasher);
mac.update(msg);
return CryptoApi.encoder.toHex(mac.finalize());
}