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

Side by Side Diff: LayoutTests/crypto/exportKey-unextractable.html

Issue 806913006: [WebCrypto] Move LayoutTests from crypto to crypto/subtle (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update path for deserialize legacy tests Created 6 years 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
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 <script src="resources/keys.js"></script>
7 </head>
8 <body>
9 <p id="description"></p>
10 <div id="console"></div>
11
12 <script>
13 description("Tests that an unextractable key cannot be exported.");
14
15 jsTestIsAsync = true;
16
17 // FIXME: Should also test unextractable keys created from generateKey().
18
19 function importUnextractableAesKey()
20 {
21 var keyData = new Uint8Array(16);
22 var usages = ['encrypt'];
23 var extractable = false;
24 var algorithm = {name: 'aes-cbc'};
25
26 return crypto.subtle.importKey('raw', keyData, algorithm, extractable, usage s);
27 }
28
29 function importUnextractableHmacKey()
30 {
31 var keyData = new Uint8Array(16);
32 var usages = ['sign'];
33 var extractable = false;
34 var algorithm = {name: 'HMAC', hash: {name: 'sha-1'}};
35
36 return crypto.subtle.importKey('raw', keyData, algorithm, extractable, usage s);
37 }
38
39 function importUnextractableRsaPrivateKey()
40 {
41 var keyData = hexStringToUint8Array(kKeyData.rsa1.pkcs8);
42 var usages = ['sign'];
43 var extractable = false;
44 var algorithm = {name: 'RSASSA-PKCS1-v1_5', hash: {name: "sha-1"}};
45
46 return crypto.subtle.importKey('pkcs8', keyData, algorithm, extractable, usa ges);
47 }
48
49 importUnextractableAesKey().then(function(key) {
50 return crypto.subtle.exportKey('raw', key);
51 }).then(failAndFinishJSTest, function(result) {
52 logError(result);
53
54 return importUnextractableHmacKey();
55 }).then(function(key) {
56 return crypto.subtle.exportKey('raw', key);
57 }).then(failAndFinishJSTest, function(result) {
58 logError(result);
59
60 return importUnextractableRsaPrivateKey();
61 }).then(function(key) {
62 return crypto.subtle.exportKey('pkcs8', key);
63 }).then(failAndFinishJSTest, function(result) {
64 logError(result);
65 }).then(finishJSTest, failAndFinishJSTest);
66
67 </script>
68
69 </body>
70 </html>
OLDNEW
« no previous file with comments | « LayoutTests/crypto/exportKey-badParameters-expected.txt ('k') | LayoutTests/crypto/exportKey-unextractable-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698