1'use strict'; 2 3module.exports = function () { 4 const pkcs8 = Buffer.from( 5 '308204bf020100300d06092a864886f70d0101010500048204a9308204a50201000282' + 6 '010100d3576092e62957364544e7e4233b7bdb293db2085122c479328546f9f0f712f6' + 7 '57c4b17868c930908cc594f7ed00c01442c1af04c2f678a48ba2c80fd1713e30b5ac50' + 8 '787ac3516589f171967f6386ada34900a6bb04eecea42bf043ced9a0f94d0cc09e919b' + 9 '9d7166c08ab6ce204640aea4c4920db6d86eb916d0dcc0f4341a10380429e7e1032144' + 10 'ea949de8f6c0ccbf95fa8e928d70d8a38ce168db45f6f134663d6f656f5ceabc725da8' + 11 'c02aabeaaa13ac36a75cc0bae135df3114b66589c7ed3cb61559ae5a384f162bfa80db' + 12 'e4617f86c3f1d010c94fe2c9bf019a6e63b3efc028d43cee611c85ec263c906c463772' + 13 'c6911b19eec096ca76ec5e31e1e3020301000102820101008b375ccb87c825c5ff3d53' + 14 'd009916e9641057e18527227a07ab226be1088813a3b38bb7b48f377055165fa2a9339' + 15 'd24dc667d5c5ba3427e6a481176eac15ffd49068311e1c283b9f3a8e0cb809b4630c50' + 16 'aa8f3e45a60b359e19bf8cbb5ecad64e761f1095743ff36aaf5cf0ecb97fedaddda60b' + 17 '5bf35d811a75b822230cfaa0192fad40547e275448aa3316bf8e2b4ce0854fc7708b53' + 18 '7ba22d13210b09aec37a2759efc082a1531b23a91730037dde4ef26b5f96efdcc39fd3' + 19 '4c345ad51cbbe44fe58b8a3b4ec997866c086dff1b8831ef0a1fea263cf7dacd03c04c' + 20 'bcc2b279e57fa5b953996bfb1dd68817af7fb42cdef7a5294a57fac2b8ad739f1b0299' + 21 '02818100fbf833c2c631c970240c8e7485f06a3ea2a84822511a8627dd464ef8afaf71' + 22 '48d1a425b6b8657ddd5246832b8e533020c5bbb568855a6aec3e4221d793f1dc5b2f25' + 23 '84e2415e48e9a2bd292b134031f99c8eb42fc0bcd0449bf22ce6dec97014efe5ac93eb' + 24 'e835877656252cbbb16c415b67b184d2284568a277d59335585cfd02818100d6b8ce27' + 25 'c7295d5d16fc3570ed64c8da9303fad29488c1a65e9ad711f90370187dbbfd81316d69' + 26 '648bc88cc5c83551afff45debacfb61105f709e4c30809b90031ebd686244496c6f69e' + 27 '692ebdc814f64239f4ad15756ecb78c5a5b09931db183077c546a38c4c743889ad3d3e' + 28 'd079b5622ed0120fa0e1f93b593db7d852e05f02818038874b9d83f78178ce2d9efc17' + 29 '5c83897fd67f306bbfa69f64ee342368ced47c80c3f1ce177a758d64bafb0c9786a442' + 30 '85fa01cdec3507cdee7dc9b7e2b21d3cbbcc100eee9967843b057329fdcca62998ed0f' + 31 '11b38ce8b0abc7de39017c71cfd0ae57546c559144cdd0afd0645f7ea8ff07b974d1ed' + 32 '44fd1f8e00f560bf6d45028181008529ef9073cf8f7b5ff9e21abadf3a4173d3900670' + 33 'dfaf59426abcdf0493c13d2f1d1b46b824a6ac1894b3d925250c181e3472c16078056e' + 34 'b19a8d28f71f308092753481d49444fdf78c9ea6c24407dc018e77d3afef385b2ff743' + 35 '9e96237941332dd446cebeffdb4404fe4f71595161d016402c334d0f57c61abe4ff9f4' + 36 'cbf90281810087d87708d46763e4ccbeb2d1e9712e5bf0216d70de9420a5b2069b7459' + 37 'b99f5d9f7f2fad7cd79aaee67a7f9a34437e3c79a84af0cd8de9dff268eb0c4793f501' + 38 'f988d540f6d3475c2079b8227a23d968dec4e3c66503187193459630472bfdb6ba1de7' + 39 '86c797fa6f4ea65a2a8419262f29678856cb73c9bd4bc89b5e041b2277', 'hex'); 40 41 const spki = Buffer.from( 42 '30820122300d06092a864886f70d01010105000382010f003082010a0282010100d357' + 43 '6092e62957364544e7e4233b7bdb293db2085122c479328546f9f0f712f657c4b17868' + 44 'c930908cc594f7ed00c01442c1af04c2f678a48ba2c80fd1713e30b5ac50787ac35165' + 45 '89f171967f6386ada34900a6bb04eecea42bf043ced9a0f94d0cc09e919b9d7166c08a' + 46 'b6ce204640aea4c4920db6d86eb916d0dcc0f4341a10380429e7e1032144ea949de8f6' + 47 'c0ccbf95fa8e928d70d8a38ce168db45f6f134663d6f656f5ceabc725da8c02aabeaaa' + 48 '13ac36a75cc0bae135df3114b66589c7ed3cb61559ae5a384f162bfa80dbe4617f86c3' + 49 'f1d010c94fe2c9bf019a6e63b3efc028d43cee611c85ec263c906c463772c6911b19ee' + 50 'c096ca76ec5e31e1e30203010001', 'hex'); 51 52 // plaintext 53 const plaintext = Buffer.from( 54 '5f4dba4f320c0ce876725afce5fbd25bf83e5a7125a08cafe73c3ebac421779df9d55d' + 55 '180c3ae9942645e1d82fee8c9d294b3cb1a08a9931201b3c0e81fc47cacf8315a2af66' + 56 '324113c3b66230c34608c4f4593634ce02b267362277f0a840ca74bc3d1a6236952c5e' + 57 'd7aaf8a8fecbddfa7584e6978cea5d2a5b9fb7f1b48c8b0be58a305202754d83761073' + 58 '74793cf026aaee5300727d836cd71e71b345ddb2e44446ffc5b901635413890d910ea3' + 59 '80984a90191031323f16dbcc9d6be168b84885384ca03e12600ac1c248028af3726cc9' + 60 '3463882ea8c02aab', 'hex'); 61 62 // For verification tests. 63 const signatures = { 64 'sha-1': Buffer.from( 65 '532e2f1b69cc2ee8472ef28f7f36a81a24cde4ee83858a7d17054ac3602c98dd432' + 66 'e3b3690440935072bb7c031e680701d19b97cb5510d86c9bedbe7d1c06839ceed8a' + 67 '3b6ac9564131c4512bbbabde237b4daa29fa0d3c97487b48a8fee9d63b50569dc6b' + 68 '7d10850c8320559343b8537b61214a7e4543a714d65e21c4e478294eb4246cea668' + 69 'e351fce0b4e118c758be4fdc46c7b3226bbf40b5b3950d62b8bdaa4f6bb76a30222' + 70 'ba32734ed5df4ac8d4fffa7557105087a6acfba5b48516163bb916864e82cb861eb' + 71 '910dcf6f1adbad5399afd497fb7afb7f75da83c80592ea1ade3e3803b4bb6831b93' + 72 '3297c0fccc36937e46018797fca85947d29c6a27a81', 'hex'), 73 'sha-256': Buffer.from( 74 '13306aba251dee526459c28352a429cdd85554c7e4a6790a2c6e44b45ebbc4a00a0' + 75 'a55244d62a60ddf0ed7d42d7714f12f783ac6709d0e2702db2692aeaacc5a5cdbbe' + 76 'c173198caab0d14fe885d0a8da1f166a965c9e25d48470b4884d5c92a4d84417440' + 77 '5568f4ac0340df6c410fc44cf7ee6d59ba634f9c6240c96b59a06fceeff4dd29622' + 78 'e7f983aebf00ecf241f1c912cfd5dc6eeeb94f9d916113e843a98555c24257f8c3e' + 79 'dab1f27839f8cc9a963e8b85465a56ec1d876225ae001fbd4244701e2e47d81b557' + 80 '847e3827e33b36f3f5e8fedfa49a0d34d01dbdaf84fa5c752f0202a8cab2c4cc2cb' + 81 '5076f6537d9c22d353738e9b39c97026b059ce95d89', 'hex'), 82 'sha-384': Buffer.from( 83 '354fcd1c62e2362d4e8bcedf5150f7b27bec33ab32a27975345a4c8cfeb234669bc' + 84 '4abaf81e719ddf4c1afae45432cb7aeb9133cbd878de766e872628178a33ac20a02' + 85 '8a7d8c2b641a5c523b16bbe65eb20bab331c983a961bae6de64e6b9077aa89c846b' + 86 '8d69dcf7101478d10751a3b87b2a5de2ca6ce71a0bfed7f587a216e053a1e53c4a2' + 87 'ace93c261b440fecd4330dd7cbd792b8398502b2a20845a4c2918d872aacf50b302' + 88 '71357019a58ae18819e75c48e9ef80810860fa04964776ca04b200329674dca5320' + 89 'b400f517864e71e087b68b81df613ee24bac34dcf2e64595e12c799070f3f719d93' + 90 'd7843b69592346cfc20c6bbf93107f279d6207ec657', 'hex'), 91 'sha-512': Buffer.from( 92 '6229b70897f8620b635487cd4aa996269831ff2931d28714f01e58b165f1082c319' + 93 '8b8f451788cfd3ed59a78f834d11ce285d1051c42a5cea0227fdefe293444c2518e' + 94 'be5cb0055bea4b5806f0eba1b665022a63be44c088fe9ad26325d79f7c41ed97f90' + 95 '9cd4ca28328e4c4a9de8da67c35dc1c85b71ed6ffaaf99d74b2b88e9f5f05a732f6' + 96 '688c993b58a0ed35e8f0a106d4e8b1b360e334415c742e94675823db0fd25e22cff' + 97 '7a6335c70e193235dcda48add6858626bd96311e60f7e5ea4491b6c1e6248afe12b' + 98 'bbd54f8869b043a5b0444562813f0a98b300356f306e6b783a29f3bec97ca40ea20' + 99 '062cab8926ec5d96aa387cc84821a6d72b8ea126e7d', 'hex') 100 } 101 102 const vectors = [ 103 { 104 publicKeyBuffer: spki, 105 privateKeyBuffer: pkcs8, 106 algorithm: { name: 'RSASSA-PKCS1-v1_5' }, 107 hash: 'SHA-1', 108 plaintext, 109 signature: signatures['sha-1'] 110 }, 111 { 112 publicKeyBuffer: spki, 113 privateKeyBuffer: pkcs8, 114 algorithm: { name: 'RSASSA-PKCS1-v1_5' }, 115 hash: 'SHA-256', 116 plaintext, 117 signature: signatures['sha-256'] 118 }, 119 { 120 publicKeyBuffer: spki, 121 privateKeyBuffer: pkcs8, 122 algorithm: { name: 'RSASSA-PKCS1-v1_5' }, 123 hash: 'SHA-384', 124 plaintext, 125 signature: signatures['sha-384'] 126 }, 127 { 128 publicKeyBuffer: spki, 129 privateKeyBuffer: pkcs8, 130 algorithm: { name: 'RSASSA-PKCS1-v1_5' }, 131 hash: 'SHA-512', 132 plaintext, 133 signature: signatures['sha-512'] 134 } 135 ]; 136 137 return vectors; 138} 139