| OLD | NEW |
| (Empty) |
| 1 Test generating, importing and exporting RSA keys for RSA-OAEP. Test that they c
an't be used with another algorithm. | |
| 2 | |
| 3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
". | |
| 4 | |
| 5 | |
| 6 Generating a key pair... | |
| 7 PASS keyPair.toString() is '[object Object]' | |
| 8 PASS keyPair.publicKey.type is 'public' | |
| 9 PASS keyPair.publicKey.algorithm.name is 'RSA-OAEP' | |
| 10 PASS keyPair.publicKey.algorithm.modulusLength is 512 | |
| 11 PASS keyPair.publicKey.usages is ["encrypt", "wrapKey"] | |
| 12 PASS bytesToHexString(keyPair.publicKey.algorithm.publicExponent) is '010001' | |
| 13 PASS keyPair.publicKey.algorithm.hash.name is 'SHA-1' | |
| 14 PASS keyPair.privateKey.type is 'private' | |
| 15 PASS keyPair.privateKey.algorithm.name is 'RSA-OAEP' | |
| 16 PASS keyPair.privateKey.algorithm.modulusLength is 512 | |
| 17 PASS keyPair.privateKey.usages is ["decrypt", "unwrapKey"] | |
| 18 PASS bytesToHexString(keyPair.privateKey.algorithm.publicExponent) is '010001' | |
| 19 PASS keyPair.privateKey.algorithm.hash.name is 'SHA-1' | |
| 20 | |
| 21 Testing that the keys can't be used with different algorithms... | |
| 22 error is: InvalidAccessError: key.usages does not permit this operation | |
| 23 error is: InvalidAccessError: key.algorithm does not match that of operation | |
| 24 | |
| 25 Trying to export keys to raw... | |
| 26 error is: NotSupportedError: Unsupported export key format for algorithm | |
| 27 PASS Promise rejected for exporting public key | |
| 28 error is: NotSupportedError: Unsupported export key format for algorithm | |
| 29 PASS Promise rejected for exporting private key | |
| 30 | |
| 31 Exporting public key to JWK... | |
| 32 PASS jwkPublicKey.alg is 'RSA-OAEP' | |
| 33 PASS jwkPublicKey.ext is true | |
| 34 PASS jwkPublicKey.key_ops is ['encrypt', 'wrapKey'] | |
| 35 PASS jwkPublicKey.use is undefined | |
| 36 PASS jwkPublicKey.kty is 'RSA' | |
| 37 PASS bytesToHexString(Base64URL.parse(jwkPublicKey.e)) is '010001' | |
| 38 | |
| 39 Importing it back... | |
| 40 PASS exportedPublicKey.type is 'public' | |
| 41 PASS exportedPublicKey.algorithm.name is 'RSA-OAEP' | |
| 42 PASS exportedPublicKey.algorithm.modulusLength is 512 | |
| 43 PASS bytesToHexString(exportedPublicKey.algorithm.publicExponent) is '010001' | |
| 44 PASS exportedPublicKey.algorithm.hash.name is 'SHA-1' | |
| 45 PASS exportedPublicKey.extractable is true | |
| 46 PASS exportedPublicKey.usages is ['encrypt','wrapKey'] | |
| 47 PASS successfullyParsed is true | |
| 48 | |
| 49 TEST COMPLETE | |
| 50 | |
| OLD | NEW |