Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: LayoutTests/crypto/rsa-oaep-key-manipulation.html

Issue 338993002: [webcrypto] exportKey() now returns dictionary when format='jwk' (CL 2 of 2). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase and fix rsa-oaep-key-manipulation.html Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 logError(result); 54 logError(result);
55 testPassed("Promise rejected for exporting public key"); 55 testPassed("Promise rejected for exporting public key");
56 return crypto.subtle.exportKey('raw', keyPair.privateKey); 56 return crypto.subtle.exportKey('raw', keyPair.privateKey);
57 }).then(failAndFinishJSTest, function(result) { 57 }).then(failAndFinishJSTest, function(result) {
58 logError(result); 58 logError(result);
59 testPassed("Promise rejected for exporting private key"); 59 testPassed("Promise rejected for exporting private key");
60 60
61 debug("\nExporting public key to JWK..."); 61 debug("\nExporting public key to JWK...");
62 return crypto.subtle.exportKey("jwk", keyPair.publicKey); 62 return crypto.subtle.exportKey("jwk", keyPair.publicKey);
63 }).then(function(result) { 63 }).then(function(result) {
64 jwkPublicKeyArray = result; 64 jwkPublicKey = result;
65 jwkPublicKey = JSON.parse(bytesToASCIIString(jwkPublicKeyArray));
66 shouldBe("jwkPublicKey.alg", "'RSA-OAEP'"); 65 shouldBe("jwkPublicKey.alg", "'RSA-OAEP'");
67 shouldBe("jwkPublicKey.ext", "true"); 66 shouldBe("jwkPublicKey.ext", "true");
68 shouldBe("jwkPublicKey.key_ops", "['encrypt', 'wrapKey']"); 67 shouldBe("jwkPublicKey.key_ops", "['encrypt', 'wrapKey']");
69 shouldBe("jwkPublicKey.use", "undefined"); 68 shouldBe("jwkPublicKey.use", "undefined");
70 shouldBe("jwkPublicKey.kty", "'RSA'"); 69 shouldBe("jwkPublicKey.kty", "'RSA'");
71 shouldBe("bytesToHexString(Base64URL.parse(jwkPublicKey.e))", "'010001'"); 70 shouldBe("bytesToHexString(Base64URL.parse(jwkPublicKey.e))", "'010001'");
72 71
73 debug("\nImporting it back..."); 72 debug("\nImporting it back...");
74 return crypto.subtle.importKey("jwk", jwkPublicKey, { name: "RSA-OAEP", hash : {name: "sha-1"} }, extractable, ["encrypt", "wrapKey"]); 73 return crypto.subtle.importKey("jwk", jwkPublicKey, { name: "RSA-OAEP", hash : {name: "sha-1"} }, extractable, ["encrypt", "wrapKey"]);
75 }).then(function(result) { 74 }).then(function(result) {
76 exportedPublicKey = result; 75 exportedPublicKey = result;
77 shouldBe("exportedPublicKey.type", "'public'"); 76 shouldBe("exportedPublicKey.type", "'public'");
78 shouldBe("exportedPublicKey.algorithm.name", "'RSA-OAEP'"); 77 shouldBe("exportedPublicKey.algorithm.name", "'RSA-OAEP'");
79 shouldBe("exportedPublicKey.algorithm.modulusLength", "512"); 78 shouldBe("exportedPublicKey.algorithm.modulusLength", "512");
80 shouldBe("bytesToHexString(exportedPublicKey.algorithm.publicExponent)", "'0 10001'"); 79 shouldBe("bytesToHexString(exportedPublicKey.algorithm.publicExponent)", "'0 10001'");
81 shouldBe("exportedPublicKey.algorithm.hash.name", "'SHA-1'"); 80 shouldBe("exportedPublicKey.algorithm.hash.name", "'SHA-1'");
82 shouldBe("exportedPublicKey.extractable", "true"); 81 shouldBe("exportedPublicKey.extractable", "true");
83 shouldBe("exportedPublicKey.usages", "['encrypt','wrapKey']"); 82 shouldBe("exportedPublicKey.usages", "['encrypt','wrapKey']");
84 83
85 }).then(finishJSTest, failAndFinishJSTest); 84 }).then(finishJSTest, failAndFinishJSTest);
86 85
87 </script> 86 </script>
88 87
89 </body> 88 </body>
90 </html> 89 </html>
OLDNEW
« no previous file with comments | « LayoutTests/crypto/rsa-export-private-key.html ('k') | Source/modules/crypto/CryptoResultImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698