hmac-export-key-expected.txt 1.43 KB
Newer Older
1 2 3 4 5 6
Test exporting an AES key.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


Importing a JWK key...
7 8 9 10 11
PASS crypto.subtle.exportKey(null, key) threw exception TypeError: Unknown key format.
PASS crypto.subtle.exportKey(undefined, key) threw exception TypeError: Unknown key format.
PASS crypto.subtle.exportKey({}, key) threw exception TypeError: Unknown key format.
PASS crypto.subtle.exportKey("", key) threw exception TypeError: Unknown key format.
PASS crypto.subtle.exportKey("foobar", key) threw exception TypeError: Unknown key format.
12
Exporting the key as raw data...
ap@apple.com's avatar
ap@apple.com committed
13
PASS bytesToHexString(new Uint8Array(exportedData)) is '6a18e49feff7f3b7e09ec89b7f6deab2f6a18e49feff7f3b7e09ec89b7f6deab'
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
Exporting the key as JWK...
PASS exportedJWK.kty is 'oct'
PASS exportedJWK.k is 'ahjkn-_387fgnsibf23qsvahjkn-_387fgnsibf23qs'
PASS exportedJWK.alg is 'HS256'
PASS exportedJWK.extractable is true
PASS exportedJWK.use is 'sig'

Importing a key that's not extractable...

Trying to export as raw...
PASS Rejected, as expected
Trying to export as jwk...
PASS Rejected, as expected

Importing a key with only sign usage (this doesn't map to anything in JWK, as 'sig' allows both sign and verify)...
PASS crypto.subtle.exportKey("jwk", key) threw exception TypeError: Key usages cannot be represented in JWK. Only two variants are supported: sign+verify and encrypt+decrypt+wrapKey+unwrapKey.
30 31 32 33
PASS successfullyParsed is true

TEST COMPLETE