| 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 Object]' |
| PASS keyPair.publicKey.type is 'public' |
| PASS keyPair.publicKey.algorithm.name is 'RSA-OAEP' |
| PASS keyPair.publicKey.algorithm.modulusLength is 512 |
| PASS keyPair.publicKey.usages is ["encrypt", "wrapKey"] |
| PASS bytesToHexString(keyPair.publicKey.algorithm.publicExponent) is '010001' |
| PASS keyPair.publicKey.algorithm.hash.name is 'SHA-1' |
| PASS keyPair.privateKey.type is 'private' |
| PASS keyPair.privateKey.algorithm.name is 'RSA-OAEP' |
| PASS keyPair.privateKey.algorithm.modulusLength is 512 |
| PASS keyPair.privateKey.usages is ["decrypt", "unwrapKey"] |
| PASS bytesToHexString(keyPair.privateKey.algorithm.publicExponent) is '010001' |
| PASS keyPair.privateKey.algorithm.hash.name is 'SHA-1' |
| |
| Using the RSA-OAEP private key for AES-CBC encryption... |
| error is: InvalidAccessError: key.algorithm does not match that of operation |
| |
| Using the RSA-OAEP public key for AES-CBC encryption... |
| error is: InvalidAccessError: key.algorithm does not match that of operation |
| |
| Trying to export keys to raw... |
| error is: NotSupportedError: Unsupported export key format for algorithm |
| PASS Promise rejected for exporting public key |
| error is: NotSupportedError: Unsupported export key format for algorithm |
| PASS Promise rejected for exporting private key |
| |
| Exporting public key to JWK... |
| PASS jwkPublicKey.alg is 'RSA-OAEP' |
| PASS jwkPublicKey.ext is true |
| PASS jwkPublicKey.key_ops is ['encrypt', 'wrapKey'] |
| PASS jwkPublicKey.use is undefined |
| PASS jwkPublicKey.kty is 'RSA' |
| PASS bytesToHexString(Base64URL.parse(jwkPublicKey.e)) is '010001' |
| |
| Importing it back... |
| PASS exportedPublicKey.type is 'public' |
| PASS exportedPublicKey.algorithm.name is 'RSA-OAEP' |
| PASS exportedPublicKey.algorithm.modulusLength is 512 |
| PASS bytesToHexString(exportedPublicKey.algorithm.publicExponent) is '010001' |
| PASS exportedPublicKey.algorithm.hash.name is 'SHA-1' |
| PASS exportedPublicKey.extractable is true |
| PASS exportedPublicKey.usages is ['encrypt','wrapKey'] |
| PASS successfullyParsed is true |
| |
| TEST COMPLETE |
| |