| <script src="../../resources/js-test-pre.js"></script> |
| <script src="../resources/common.js"></script> |
| description("Test importing a SPKI RSAES-PKCS1-v1_5 key"); |
| // Generated from OpenSSL |
| var spkiKey = Base64URL.parse("MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwCjRCtFwvSNYMZ07u5SxARxglJl75T7bUZXFsDVxHkMhpNC2RaN4jWE5bwYUDMeD2fVmxhpaUQn/6AbFLh6gHxtwrCfc7rIo/SfDdGd3GkRlXK5xXwGuM6MvP9nuZHaarIyArRFh2U2UZxFlVsKI0pSHo6n58W1fPZ1syOoVEZ/WYE6gLhMMwfpeAm97mro7mekRdMULOV/mR5Ul3CHm9Zt93Dc8GpnPA8bhLiB0VNyGTEMa06nJul4gj1sjxLDoUvZY2EWq7oUUnfLBUYMfiqK0kQcW94wvBrIq2DQUApLyTTbaAOY46TLwX6c8LtubJriYKTC5a9Bb0/7ovTWB0wIDAQAB"); |
| debug("Importing a key..."); |
| crypto.subtle.importKey("spki", spkiKey, "RSAES-PKCS1-v1_5", extractable, ["encrypt"]).then(function(result) { |
| shouldBe("publicKey.toString()", "'[object CryptoKey]'"); |
| shouldBe("publicKey.type", "'public'"); |
| shouldBe("publicKey.extractable", "true"); |
| shouldBe("publicKey.algorithm.name", "'RSAES-PKCS1-v1_5'"); |
| shouldBe("publicKey.algorithm.modulusLength", "2048"); |
| shouldBe("bytesToHexString(publicKey.algorithm.publicExponent)", "'010001'"); |
| shouldBeUndefined("publicKey.algorithm.hash"); |
| shouldBe("publicKey.usages", "['encrypt']"); |
| <script src="../../resources/js-test-post.js"></script> |