rsa-oaep-key-manipulation-expected.txt 2 KB
Newer Older
1 2 3 4 5 6 7 8
Test generating, importing and exporting RSA keys for RSA-OAEP. Test that they can't be used with another algorithm.

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


Generating a key pair...
PASS keyPair.toString() is '[object KeyPair]'
PASS keyPair.publicKey.type is 'public'
9
PASS keyPair.publicKey.algorithm.name is 'RSA-OAEP'
10 11 12 13
PASS keyPair.publicKey.algorithm.modulusLength is 2048
PASS bytesToHexString(keyPair.publicKey.algorithm.publicExponent) is '010001'
PASS keyPair.publicKey.algorithm.hash is undefined.
PASS keyPair.privateKey.type is 'private'
14
PASS keyPair.privateKey.algorithm.name is 'RSA-OAEP'
15 16 17 18 19 20 21 22 23 24 25 26 27 28
PASS keyPair.privateKey.algorithm.modulusLength is 2048
PASS bytesToHexString(keyPair.privateKey.algorithm.publicExponent) is '010001'
PASS keyPair.privateKey.algorithm.hash is undefined.

Testing that the keys can't be used with different algorithms...
PASS crypto.subtle.encrypt({name: "aes-cbc", iv: iv}, keyPair.privateKey, hexStringToUint8Array("00")) threw exception Error: NotSupportedError: DOM Exception 9.
PASS crypto.subtle.encrypt({name: "aes-cbc", iv: iv}, keyPair.publicKey, hexStringToUint8Array("00")) threw exception Error: NotSupportedError: DOM Exception 9.

Trying to export keys to raw...
PASS Promise rejected for exporting public key
PASS Promise rejected for exporting private key

Exporting public key to JWK...
PASS jwkPublicKey.alg is 'RSA-OAEP'
29
PASS jwkPublicKey.ext is true
30 31 32 33 34 35
PASS jwkPublicKey.use is 'enc'
PASS jwkPublicKey.kty is 'RSA'
PASS bytesToHexString(Base64URL.parse(jwkPublicKey.e)) is '010001'

Importing it back...
PASS exportedPublicKey.type is 'public'
36
PASS exportedPublicKey.algorithm.name is 'RSA-OAEP'
37 38
PASS exportedPublicKey.algorithm.modulusLength is 2048
PASS bytesToHexString(exportedPublicKey.algorithm.publicExponent) is '010001'
39
PASS exportedPublicKey.algorithm.hash.name is 'SHA-1'
40
PASS exportedPublicKey.extractable is true
41
PASS exportedPublicKey.usages is ['decrypt','encrypt','unwrapKey','wrapKey']
42 43 44 45
PASS successfullyParsed is true

TEST COMPLETE