OLD | NEW |
| (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("A key of size smaller than 2048 bits can be used with RS256, RS384,
RS512 JWK algorithms."); | |
13 // (Contrary to what the JWA spec says) | |
14 | |
15 jsTestIsAsync = true; | |
16 | |
17 var extractable = true; | |
18 | |
19 // openssl genrsa 1024 >1024.pem | |
20 // openssl asn1parse -in 1024.pem | |
21 var publicKeyJSON = { | |
22 kty: "RSA", | |
23 alg: "RS256", | |
24 n: Base64URL.stringify(hexStringToUint8Array("B7F103F8412CCD26F5D54FC3157CD8
CE1F134F4EABF0A042350BDD7F00FEA2B77EEF19915B10AA2417BB2CB4EC1D57B9661A20072469B9
DF9C6E89CB35CCC8543CC40770DCC30D0BBFF1BF9DA1E2549F40476EDADB9312985DAE8C7527C1C1
2AAFEDF4584989968CDCC9EFEB197438C534D1BFAAC30B1D41F75EADB86CC581B9")), | |
25 e: Base64URL.stringify(hexStringToUint8Array("010001")) | |
26 }; | |
27 | |
28 var privateKeyJSON = { | |
29 kty: "RSA", | |
30 alg: "RS512", | |
31 n: Base64URL.stringify(hexStringToUint8Array("B7F103F8412CCD26F5D54FC3157CD8
CE1F134F4EABF0A042350BDD7F00FEA2B77EEF19915B10AA2417BB2CB4EC1D57B9661A20072469B9
DF9C6E89CB35CCC8543CC40770DCC30D0BBFF1BF9DA1E2549F40476EDADB9312985DAE8C7527C1C1
2AAFEDF4584989968CDCC9EFEB197438C534D1BFAAC30B1D41F75EADB86CC581B9")), | |
32 e: Base64URL.stringify(hexStringToUint8Array("010001")), | |
33 d: Base64URL.stringify(hexStringToUint8Array("5BA6F4F26B0F36BDB5FA6EBEE6E309
6853259CFBB742B3A7A9A4DADDE0920063EC149929CB3557819A6D824E37E43B04BF323F492FC49A
8028031017B81BECA8EC2A85ABCF193501D80DC251DB8863B8673D8B6772DB2D2AE08CD1829C3F54
2141461CACE4E8A1F112AD13FF4A4DD865A89AEA94E984D487E5798EF07643B9CD")), | |
34 p: Base64URL.stringify(hexStringToUint8Array("E06BFE5722A68E5D597DD8DB937483
CBA352AB817209275ADAD103772B7A8EF4EA946311A2B51805959818CEB362F257D6998B475FEA9E
34F2A30205B5F5A7FF")), | |
35 q: Base64URL.stringify(hexStringToUint8Array("D1D2DBDB1F4DCBFE8D16CDD2CF83C7
B5FADFC7891F22FC527BF208F81B92F2543569C3AD22224B82D407DEB65F651D09D2558FEE8BC6E5
DA51F6F13206CC1647")), | |
36 dp: Base64URL.stringify(hexStringToUint8Array("73ECB4F3D3AD4F6ABEF877D56C84C
A339D88ED98AF0C356D040CE58A60462DA42BAC3CC47654AF34EB4226C656F96C8F9D05B1614C158
8657754668E06A0FF87")), | |
37 dq: Base64URL.stringify(hexStringToUint8Array("5B9C5ACDB33F3E5FE7AE1B337DD32
5B138D5D7C2F0CB4FAB9BDE333850A1BA183631F5737441D102501D178A3CE062EB54E072B54E660
B19654C12472B5C9425")), | |
38 qi: Base64URL.stringify(hexStringToUint8Array("D6A920B241178923C59BCBD1A8157
64619225A90F2C090A9FBD594A61561542D0DF179590413C26C8A72FC6E14EC63A377169970671B3
A1EB5E4F4DF1A4CA725")) | |
39 }; | |
40 | |
41 Promise.resolve(null).then(function(result) { | |
42 return crypto.subtle.importKey("jwk", publicKeyJSON, {name: 'RSASSA-PKCS1-v1
_5', hash: {name: 'sha-256'}}, extractable, ["verify"]); | |
43 }).then(function(result) { | |
44 key = result; | |
45 shouldEvaluateAs("key.algorithm.modulusLength", 1024); | |
46 return crypto.subtle.importKey("jwk", privateKeyJSON, {name: 'RSASSA-PKCS1-v
1_5', hash: {name: 'sha-512'}}, extractable, ["sign"]); | |
47 }).then(function(result) { | |
48 key = result; | |
49 shouldEvaluateAs("key.algorithm.modulusLength", 1024); | |
50 }).then(finishJSTest, failAndFinishJSTest); | |
51 | |
52 </script> | |
53 | |
54 </body> | |
55 </html> | |
OLD | NEW |