| 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 20 matching lines...) Expand all Loading... |
| 31 "kid":"2011-04-29" | 31 "kid":"2011-04-29" |
| 32 } | 32 } |
| 33 | 33 |
| 34 debug("\nImporting a JWK key..."); | 34 debug("\nImporting a JWK key..."); |
| 35 crypto.subtle.importKey("jwk", privateKeyJSON, {name: "RSASSA-PKCS1-v1_5", hash:
{name: "sha-256"}}, extractable, ['sign']).then(function(result) { | 35 crypto.subtle.importKey("jwk", privateKeyJSON, {name: "RSASSA-PKCS1-v1_5", hash:
{name: "sha-256"}}, extractable, ['sign']).then(function(result) { |
| 36 key = result; | 36 key = result; |
| 37 | 37 |
| 38 debug("\nExporting the key as JWK..."); | 38 debug("\nExporting the key as JWK..."); |
| 39 return crypto.subtle.exportKey("jwk", key); | 39 return crypto.subtle.exportKey("jwk", key); |
| 40 }).then(function(result) { | 40 }).then(function(result) { |
| 41 exportedJWK = JSON.parse(bytesToASCIIString(result)); | 41 exportedJWK = result; |
| 42 | 42 |
| 43 shouldBe("exportedJWK.kty", "'RSA'"); | 43 shouldBe("exportedJWK.kty", "'RSA'"); |
| 44 shouldBe("exportedJWK.n", "privateKeyJSON.n"); | 44 shouldBe("exportedJWK.n", "privateKeyJSON.n"); |
| 45 shouldBe("exportedJWK.e", "privateKeyJSON.e"); | 45 shouldBe("exportedJWK.e", "privateKeyJSON.e"); |
| 46 shouldBe("exportedJWK.d", "privateKeyJSON.d"); | 46 shouldBe("exportedJWK.d", "privateKeyJSON.d"); |
| 47 shouldBe("exportedJWK.p", "privateKeyJSON.p"); | 47 shouldBe("exportedJWK.p", "privateKeyJSON.p"); |
| 48 shouldBe("exportedJWK.q", "privateKeyJSON.q"); | 48 shouldBe("exportedJWK.q", "privateKeyJSON.q"); |
| 49 shouldBe("exportedJWK.dp", "privateKeyJSON.dp"); | 49 shouldBe("exportedJWK.dp", "privateKeyJSON.dp"); |
| 50 shouldBe("exportedJWK.dq", "privateKeyJSON.dq"); | 50 shouldBe("exportedJWK.dq", "privateKeyJSON.dq"); |
| 51 shouldBe("exportedJWK.qi", "privateKeyJSON.qi"); | 51 shouldBe("exportedJWK.qi", "privateKeyJSON.qi"); |
| 52 shouldBe("exportedJWK.oth", "privateKeyJSON.oth"); | 52 shouldBe("exportedJWK.oth", "privateKeyJSON.oth"); |
| 53 shouldBe("exportedJWK.alg", "privateKeyJSON.alg"); | 53 shouldBe("exportedJWK.alg", "privateKeyJSON.alg"); |
| 54 shouldBe("exportedJWK.ext", "true"); | 54 shouldBe("exportedJWK.ext", "true"); |
| 55 shouldBe("exportedJWK.key_ops", "['sign']"); | 55 shouldBe("exportedJWK.key_ops", "['sign']"); |
| 56 shouldBe("exportedJWK.use", "undefined"); | 56 shouldBe("exportedJWK.use", "undefined"); |
| 57 }).then(finishJSTest, failAndFinishJSTest); | 57 }).then(finishJSTest, failAndFinishJSTest); |
| 58 | 58 |
| 59 </script> | 59 </script> |
| 60 | 60 |
| 61 </body> | 61 </body> |
| 62 </html> | 62 </html> |
| OLD | NEW |