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

Side by Side Diff: LayoutTests/crypto/aes-cbc-unwrap-rsa.html

Issue 298023002: [webcrypto] Import WebKit's webcrypto tests. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove FIXME for unrecognized jwk usages (supported now) 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
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../resources/js-test.js"></script>
5 <script src="resources/common.js"></script>
6 </head>
7 <body>
8 <p id="description"></p>
9 <div id="console"></div>
10
11 <script>
12 description("Test unwrapping an RSA key with AES-CBC.");
13
14 jsTestIsAsync = true;
15
16 var nonExtractable = false;
17
18 var publicKeyJSON = {
19 kty: "RSA",
20 alg: "RS256",
21 n: "rcCUCv7Oc1HVam1DIhCzqknThWawOp8QLk8Ziy2p10ByjQFCajoFiyuAWl-R1WXZaf4xitLR racT9agpzIzc-MbLSHIGgWQGO21lGiImy5ftZ-D8bHAqRz2y15pzD4c4CEou7XSSLDoRnR0QG5MsDhD6 s2gV9mwHkrtkCxtMWdBi-77as8wGmlNRldcOSgZDLK8UnCSgA1OguZ989bFyc8tOOEIb0xUSfPSz3LPS CnyYz68aDjmKVeNH-ig857OScyWbGyEy3Biw64qun3juUlNWsJ3zngkOdteYWytx5Qr4XKNs6R-Myyq7 2KUp02mJDZiiyiglxML_i3-_CeecCw",
22 e: "AQAB",
23 ext: false,
24 use: "sig"
25 };
26
27 var unwrappingKeyOctets = hexStringToUint8Array("2a00e0e776e94e4dc89bf947cebdebe 1");
28 var wrappedKey = hexStringToUint8Array("3511f6028db04ea97e7cfad3c4cc60837bceff25 cb6c88292fbcb4547570afdc32e4003fe4d65f1e7df60dc1fdb3df36c3f58ab228e33aa31005852d 46d0c2ad1318435a071bbb5bbb05650ea63d551698b0c040dd95ed0d379b5e2eccb545ae5620acb8 051174cd2ad647328ad99dcd462fec40748724eb1e68f209f779faa2c35b4d4d1b6604a74e62a184 6249ea6192954a5af10c71ebfea79948142441ed307e9f52e797a51a8007a6f87b57c51f9e7eef54 b7e4a1f818ba6ac25ee5935c23b3253d6d9d222262c79ccdb7147d9c07527c22fe7a4ab91af20479 edf5930b3c053c0a0b27092cfb53203633d01dcf6e333b5be7c1933c321c953f962b934ebefd9df8 cca6c0a25fcd5fb96105435c42d9902406f82bc8daa8ec12fa85d9afa65adbfe3f60828ef64adaf4 3ad8e3b0af104cbfafd994323732bba08f84d5cac1d157b276233dffecafe47942b83c85ead6d588 6c6badf534d4a32d3f545e8032dd5e419d7bff3acde2c37a96fc34fda8747d89500bf9f7ef45873c 6b3b2741aaf74ff96a2f950028f38eb62f1be936fe0a994ebfa928021c0c96172d84584e");
29
30 debug("Importing an unwrapping key...");
31 crypto.subtle.importKey("raw", unwrappingKeyOctets, {name:"AES-CBC"}, nonExtract able, ["unwrapKey"]).then(function(result) {
32 unwrappingKey = result;
33 shouldBe("unwrappingKey.algorithm.name", "'AES-CBC'");
34 var unwrapAlgorithm = {name: "AES-CBC", iv: hexStringToUint8Array("000102030 405060708090a0b0c0d0e0f")};
35 debug("Unwrapping a key...");
36 var importAlgorithm = {name: 'RSASSA-PKCS1-v1_5', hash: {name: 'sha-256'} };
37 return crypto.subtle.unwrapKey("jwk", wrappedKey, unwrappingKey, unwrapAlgor ithm, importAlgorithm, nonExtractable, ["verify"]);
38 }).then(function(result) {
39 unwrappedKey = result;
40
41 shouldBe("unwrappedKey.toString()", "'[object Key]'");
42 shouldBe("unwrappedKey.type", "'public'");
43 shouldBe("unwrappedKey.usages", "['verify']");
44 shouldBe("unwrappedKey.algorithm.name", "'RSASSA-PKCS1-v1_5'");
45 shouldBe("unwrappedKey.algorithm.modulusLength", "2048");
46 shouldBe("Base64URL.stringify(unwrappedKey.algorithm.publicExponent)", "publ icKeyJSON.e");
47 shouldBe("unwrappedKey.algorithm.hash.name", "'SHA-256'");
48 shouldBe("unwrappedKey.extractable", "false");
49 }).then(finishJSTest, failAndFinishJSTest);
50
51 </script>
52
53 </body>
54 </html>
OLDNEW
« no previous file with comments | « LayoutTests/crypto/aes-cbc-unwrap-failure-expected.txt ('k') | LayoutTests/crypto/aes-cbc-unwrap-rsa-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698