4 <script src=
"../../../resources/js-test.js"></script>
5 <script src=
"../resources/common.js"></script>
8 <p id=
"description"></p>
9 <div id=
"console"></div>
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)
17 var extractable
= true;
19 // openssl genrsa 1024 >1024.pem
20 // openssl asn1parse -in 1024.pem
24 n
: Base64URL
.stringify(hexStringToUint8Array("B7F103F8412CCD26F5D54FC3157CD8CE1F134F4EABF0A042350BDD7F00FEA2B77EEF19915B10AA2417BB2CB4EC1D57B9661A20072469B9DF9C6E89CB35CCC8543CC40770DCC30D0BBFF1BF9DA1E2549F40476EDADB9312985DAE8C7527C1C12AAFEDF4584989968CDCC9EFEB197438C534D1BFAAC30B1D41F75EADB86CC581B9")),
25 e
: Base64URL
.stringify(hexStringToUint8Array("010001"))
28 var privateKeyJSON
= {
31 n
: Base64URL
.stringify(hexStringToUint8Array("B7F103F8412CCD26F5D54FC3157CD8CE1F134F4EABF0A042350BDD7F00FEA2B77EEF19915B10AA2417BB2CB4EC1D57B9661A20072469B9DF9C6E89CB35CCC8543CC40770DCC30D0BBFF1BF9DA1E2549F40476EDADB9312985DAE8C7527C1C12AAFEDF4584989968CDCC9EFEB197438C534D1BFAAC30B1D41F75EADB86CC581B9")),
32 e
: Base64URL
.stringify(hexStringToUint8Array("010001")),
33 d
: Base64URL
.stringify(hexStringToUint8Array("5BA6F4F26B0F36BDB5FA6EBEE6E3096853259CFBB742B3A7A9A4DADDE0920063EC149929CB3557819A6D824E37E43B04BF323F492FC49A8028031017B81BECA8EC2A85ABCF193501D80DC251DB8863B8673D8B6772DB2D2AE08CD1829C3F542141461CACE4E8A1F112AD13FF4A4DD865A89AEA94E984D487E5798EF07643B9CD")),
34 p
: Base64URL
.stringify(hexStringToUint8Array("E06BFE5722A68E5D597DD8DB937483CBA352AB817209275ADAD103772B7A8EF4EA946311A2B51805959818CEB362F257D6998B475FEA9E34F2A30205B5F5A7FF")),
35 q
: Base64URL
.stringify(hexStringToUint8Array("D1D2DBDB1F4DCBFE8D16CDD2CF83C7B5FADFC7891F22FC527BF208F81B92F2543569C3AD22224B82D407DEB65F651D09D2558FEE8BC6E5DA51F6F13206CC1647")),
36 dp
: Base64URL
.stringify(hexStringToUint8Array("73ECB4F3D3AD4F6ABEF877D56C84CA339D88ED98AF0C356D040CE58A60462DA42BAC3CC47654AF34EB4226C656F96C8F9D05B1614C1588657754668E06A0FF87")),
37 dq
: Base64URL
.stringify(hexStringToUint8Array("5B9C5ACDB33F3E5FE7AE1B337DD325B138D5D7C2F0CB4FAB9BDE333850A1BA183631F5737441D102501D178A3CE062EB54E072B54E660B19654C12472B5C9425")),
38 qi
: Base64URL
.stringify(hexStringToUint8Array("D6A920B241178923C59BCBD1A815764619225A90F2C090A9FBD594A61561542D0DF179590413C26C8A72FC6E14EC63A377169970671B3A1EB5E4F4DF1A4CA725"))
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
) {
45 shouldEvaluateAs("key.algorithm.modulusLength", 1024);
46 return crypto
.subtle
.importKey("jwk", privateKeyJSON
, {name
: 'RSASSA-PKCS1-v1_5', hash
: {name
: 'sha-512'}}, extractable
, ["sign"]);
47 }).then(function(result
) {
49 shouldEvaluateAs("key.algorithm.modulusLength", 1024);
50 }).then(finishJSTest
, failAndFinishJSTest
);