blob: d4d3f456d24bf436b01518654df656bdefc8a17a [file] [log] [blame]
Test that HMAC operations only work when hash functions match between invocation and key.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Importing a raw HMAC SHA-1 key from string literal...
Done
PASS crypto.subtle.sign({name: 'hmac', hash: {name: 'sha-1'}}, key, asciiToUint8Array('foo')) did not throw exception.
PASS crypto.subtle.sign({name: 'hmac', hash: {name: 'sha-256'}}, key, asciiToUint8Array('foo')) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
PASS crypto.subtle.verify({name: 'hmac', hash: {name: 'sha-1'}}, key, asciiToUint8Array('fake signature'), asciiToUint8Array('foo')) did not throw exception.
PASS crypto.subtle.verify({name: 'hmac', hash: {name: 'sha-256'}}, key, asciiToUint8Array('fake signature'), asciiToUint8Array('foo')) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
PASS successfullyParsed is true
TEST COMPLETE