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