OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../resources/js-test.js"></script> | 4 <script src="../resources/js-test.js"></script> |
5 <script src="resources/common.js"></script> | 5 <script src="resources/common.js"></script> |
6 </head> | 6 </head> |
7 <body> | 7 <body> |
8 <p id="description"></p> | 8 <p id="description"></p> |
9 <div id="console"></div> | 9 <div id="console"></div> |
10 | 10 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 jwkPublicKeyArray = result; | 64 jwkPublicKeyArray = result; |
65 jwkPublicKey = JSON.parse(bytesToASCIIString(jwkPublicKeyArray)); | 65 jwkPublicKey = JSON.parse(bytesToASCIIString(jwkPublicKeyArray)); |
66 shouldBe("jwkPublicKey.alg", "'RSA-OAEP'"); | 66 shouldBe("jwkPublicKey.alg", "'RSA-OAEP'"); |
67 shouldBe("jwkPublicKey.ext", "true"); | 67 shouldBe("jwkPublicKey.ext", "true"); |
68 shouldBe("jwkPublicKey.key_ops", "['encrypt', 'wrapKey']"); | 68 shouldBe("jwkPublicKey.key_ops", "['encrypt', 'wrapKey']"); |
69 shouldBe("jwkPublicKey.use", "undefined"); | 69 shouldBe("jwkPublicKey.use", "undefined"); |
70 shouldBe("jwkPublicKey.kty", "'RSA'"); | 70 shouldBe("jwkPublicKey.kty", "'RSA'"); |
71 shouldBe("bytesToHexString(Base64URL.parse(jwkPublicKey.e))", "'010001'"); | 71 shouldBe("bytesToHexString(Base64URL.parse(jwkPublicKey.e))", "'010001'"); |
72 | 72 |
73 debug("\nImporting it back..."); | 73 debug("\nImporting it back..."); |
74 return crypto.subtle.importKey("jwk", jwkPublicKeyArray, { name: "RSA-OAEP",
hash: {name: "sha-1"} }, extractable, ["encrypt", "wrapKey"]); | 74 return crypto.subtle.importKey("jwk", jwkPublicKey, { name: "RSA-OAEP", hash
: {name: "sha-1"} }, extractable, ["encrypt", "wrapKey"]); |
75 }).then(function(result) { | 75 }).then(function(result) { |
76 exportedPublicKey = result; | 76 exportedPublicKey = result; |
77 shouldBe("exportedPublicKey.type", "'public'"); | 77 shouldBe("exportedPublicKey.type", "'public'"); |
78 shouldBe("exportedPublicKey.algorithm.name", "'RSA-OAEP'"); | 78 shouldBe("exportedPublicKey.algorithm.name", "'RSA-OAEP'"); |
79 shouldBe("exportedPublicKey.algorithm.modulusLength", "2048"); | 79 shouldBe("exportedPublicKey.algorithm.modulusLength", "2048"); |
80 shouldBe("bytesToHexString(exportedPublicKey.algorithm.publicExponent)", "'0
10001'"); | 80 shouldBe("bytesToHexString(exportedPublicKey.algorithm.publicExponent)", "'0
10001'"); |
81 shouldBe("exportedPublicKey.algorithm.hash.name", "'SHA-1'"); | 81 shouldBe("exportedPublicKey.algorithm.hash.name", "'SHA-1'"); |
82 shouldBe("exportedPublicKey.extractable", "true"); | 82 shouldBe("exportedPublicKey.extractable", "true"); |
83 shouldBe("exportedPublicKey.usages", "['encrypt','wrapKey']"); | 83 shouldBe("exportedPublicKey.usages", "['encrypt','wrapKey']"); |
84 | 84 |
85 }).then(finishJSTest, failAndFinishJSTest); | 85 }).then(finishJSTest, failAndFinishJSTest); |
86 | 86 |
87 </script> | 87 </script> |
88 | 88 |
89 </body> | 89 </body> |
90 </html> | 90 </html> |
OLD | NEW |