npm: add @peculiar/webcrypto-test
This commit is contained in:
parent
8b91f978c0
commit
c8f8c8dc3f
|
@ -129,20 +129,41 @@
|
|||
}
|
||||
},
|
||||
"@peculiar/asn1-schema": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@peculiar/asn1-schema/-/asn1-schema-1.0.3.tgz",
|
||||
"integrity": "sha512-Tfgj9eNJ6cTKEtEuidKenLHMx/Q5M8KEE9hnohHqvdpqHJXWYr5RlT3GjAHPjGXy5+mr7sSfuXfzE6aAkEGN7A==",
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@peculiar/asn1-schema/-/asn1-schema-1.0.5.tgz",
|
||||
"integrity": "sha512-rzzorGYnQNmVHleLvC8gJSbbdNYtg+EB9s075dHvwpxs10teXHYnRmTWhCVuWjbSVSofwdm7IYPtMTWTbcNUWA==",
|
||||
"requires": {
|
||||
"asn1js": "^2.0.22",
|
||||
"tslib": "^1.9.3"
|
||||
"asn1js": "^2.0.26",
|
||||
"tslib": "^1.11.1"
|
||||
}
|
||||
},
|
||||
"@peculiar/json-schema": {
|
||||
"version": "1.1.9",
|
||||
"resolved": "https://registry.npmjs.org/@peculiar/json-schema/-/json-schema-1.1.9.tgz",
|
||||
"integrity": "sha512-F2ST2y/IQPgY+1QMw1Q33sqJbGDCeO3lGqI69SL3Hgo0++7iHqprUB1QyxB/A7bN3tuM65MBxoM2JLbwh42lsQ==",
|
||||
"version": "1.1.10",
|
||||
"resolved": "https://registry.npmjs.org/@peculiar/json-schema/-/json-schema-1.1.10.tgz",
|
||||
"integrity": "sha512-kbpnG9CkF1y6wwGkW7YtSA+yYK4X5uk4rAwsd1hxiaYE3Hkw2EsGlbGh/COkMLyFf+Fe830BoFiMSB3QnC/ItA==",
|
||||
"requires": {
|
||||
"tslib": "^1.10.0"
|
||||
"tslib": "^1.11.1"
|
||||
}
|
||||
},
|
||||
"@peculiar/webcrypto-test": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@peculiar/webcrypto-test/-/webcrypto-test-1.0.1.tgz",
|
||||
"integrity": "sha512-0ScgGSff7wk2tsqZ1uUDqJW7kk1wcSKNlWKhzHdd7ZBhdYH7uFj8tuZ4cLzmjyagVhM4mcpXoplDGggf7ag49w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"pvtsutils": "^1.0.10",
|
||||
"tslib": "^1.11.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"pvtsutils": {
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/pvtsutils/-/pvtsutils-1.0.10.tgz",
|
||||
"integrity": "sha512-8ZKQcxnZKTn+fpDh7wL4yKax5fdl3UJzT8Jv49djZpB/dzPxacyN1Sez90b6YLdOmvIr9vaySJ5gw4aUA1EdSw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"tslib": "^1.10.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@types/color-name": {
|
||||
|
@ -176,12 +197,12 @@
|
|||
"dev": true
|
||||
},
|
||||
"@typescript-eslint/eslint-plugin": {
|
||||
"version": "2.23.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.23.0.tgz",
|
||||
"integrity": "sha512-8iA4FvRsz8qTjR0L/nK9RcRUN3QtIHQiOm69FzV7WS3SE+7P7DyGGwh3k4UNR2JBbk+Ej2Io+jLAaqKibNhmtw==",
|
||||
"version": "2.24.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.24.0.tgz",
|
||||
"integrity": "sha512-wJRBeaMeT7RLQ27UQkDFOu25MqFOBus8PtOa9KaT5ZuxC1kAsd7JEHqWt4YXuY9eancX0GK9C68i5OROnlIzBA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@typescript-eslint/experimental-utils": "2.23.0",
|
||||
"@typescript-eslint/experimental-utils": "2.24.0",
|
||||
"eslint-utils": "^1.4.3",
|
||||
"functional-red-black-tree": "^1.0.1",
|
||||
"regexpp": "^3.0.0",
|
||||
|
@ -189,32 +210,32 @@
|
|||
}
|
||||
},
|
||||
"@typescript-eslint/experimental-utils": {
|
||||
"version": "2.23.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.23.0.tgz",
|
||||
"integrity": "sha512-OswxY59RcXH3NNPmq+4Kis2CYZPurRU6mG5xPcn24CjFyfdVli5mySwZz/g/xDbJXgDsYqNGq7enV0IziWGXVQ==",
|
||||
"version": "2.24.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.24.0.tgz",
|
||||
"integrity": "sha512-DXrwuXTdVh3ycNCMYmWhUzn/gfqu9N0VzNnahjiDJvcyhfBy4gb59ncVZVxdp5XzBC77dCncu0daQgOkbvPwBw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/json-schema": "^7.0.3",
|
||||
"@typescript-eslint/typescript-estree": "2.23.0",
|
||||
"@typescript-eslint/typescript-estree": "2.24.0",
|
||||
"eslint-scope": "^5.0.0"
|
||||
}
|
||||
},
|
||||
"@typescript-eslint/parser": {
|
||||
"version": "2.23.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.23.0.tgz",
|
||||
"integrity": "sha512-k61pn/Nepk43qa1oLMiyqApC6x5eP5ddPz6VUYXCAuXxbmRLqkPYzkFRKl42ltxzB2luvejlVncrEpflgQoSUg==",
|
||||
"version": "2.24.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.24.0.tgz",
|
||||
"integrity": "sha512-H2Y7uacwSSg8IbVxdYExSI3T7uM1DzmOn2COGtCahCC3g8YtM1xYAPi2MAHyfPs61VKxP/J/UiSctcRgw4G8aw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/eslint-visitor-keys": "^1.0.0",
|
||||
"@typescript-eslint/experimental-utils": "2.23.0",
|
||||
"@typescript-eslint/typescript-estree": "2.23.0",
|
||||
"@typescript-eslint/experimental-utils": "2.24.0",
|
||||
"@typescript-eslint/typescript-estree": "2.24.0",
|
||||
"eslint-visitor-keys": "^1.1.0"
|
||||
}
|
||||
},
|
||||
"@typescript-eslint/typescript-estree": {
|
||||
"version": "2.23.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.23.0.tgz",
|
||||
"integrity": "sha512-pmf7IlmvXdlEXvE/JWNNJpEvwBV59wtJqA8MLAxMKLXNKVRC3HZBXR/SlZLPWTCcwOSg9IM7GeRSV3SIerGVqw==",
|
||||
"version": "2.24.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.24.0.tgz",
|
||||
"integrity": "sha512-RJ0yMe5owMSix55qX7Mi9V6z2FDuuDpN6eR5fzRJrp+8in9UF41IGNQHbg5aMK4/PjVaEQksLvz0IA8n+Mr/FA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"debug": "^4.1.1",
|
||||
|
@ -226,15 +247,6 @@
|
|||
"tsutils": "^3.17.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
|
||||
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ms": "^2.1.1"
|
||||
}
|
||||
},
|
||||
"glob": {
|
||||
"version": "7.1.6",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
|
||||
|
@ -469,9 +481,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"aws4": {
|
||||
"version": "1.9.0",
|
||||
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.9.0.tgz",
|
||||
"integrity": "sha512-Uvq6hVe90D0B2WEnUqtdgY1bATGz3mw33nH9Y+dmA+w5DHvUmBgkr5rM/KCHpCsiFNRUfokW/szpPPgMK2hm4A==",
|
||||
"version": "1.9.1",
|
||||
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.9.1.tgz",
|
||||
"integrity": "sha512-wMHVg2EOHaMRxbzgFJ9gtjOOCrI80OHLG14rxi28XwOW8ux6IiEbRCGGGqCtdAIg4FQCbW20k9RsT4y3gJlFug==",
|
||||
"dev": true
|
||||
},
|
||||
"balanced-match": {
|
||||
|
@ -698,15 +710,15 @@
|
|||
"dev": true
|
||||
},
|
||||
"coveralls": {
|
||||
"version": "3.0.9",
|
||||
"resolved": "https://registry.npmjs.org/coveralls/-/coveralls-3.0.9.tgz",
|
||||
"integrity": "sha512-nNBg3B1+4iDox5A5zqHKzUTiwl2ey4k2o0NEcVZYvl+GOSJdKBj4AJGKLv6h3SvWch7tABHePAQOSZWM9E2hMg==",
|
||||
"version": "3.0.11",
|
||||
"resolved": "https://registry.npmjs.org/coveralls/-/coveralls-3.0.11.tgz",
|
||||
"integrity": "sha512-LZPWPR2NyGKyaABnc49dR0fpeP6UqhvGq4B5nUrTQ1UBy55z96+ga7r+/ChMdMJUwBgyJDXBi88UBgz2rs9IiQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"js-yaml": "^3.13.1",
|
||||
"lcov-parse": "^1.0.0",
|
||||
"log-driver": "^1.2.7",
|
||||
"minimist": "^1.2.0",
|
||||
"minimist": "^1.2.5",
|
||||
"request": "^2.88.0"
|
||||
}
|
||||
},
|
||||
|
@ -746,9 +758,9 @@
|
|||
}
|
||||
},
|
||||
"debug": {
|
||||
"version": "3.2.6",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz",
|
||||
"integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==",
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
|
||||
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ms": "^2.1.1"
|
||||
|
@ -1608,26 +1620,6 @@
|
|||
"integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==",
|
||||
"dev": true
|
||||
},
|
||||
"handlebars": {
|
||||
"version": "4.5.3",
|
||||
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.5.3.tgz",
|
||||
"integrity": "sha512-3yPecJoJHK/4c6aZhSvxOyG4vJKDshV36VHp0iVCDVh7o9w2vwi3NSnL2MMPj3YdduqaBcu7cGbggJQM0br9xA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"neo-async": "^2.6.0",
|
||||
"optimist": "^0.6.1",
|
||||
"source-map": "^0.6.1",
|
||||
"uglify-js": "^3.1.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"source-map": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
||||
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"har-schema": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
|
||||
|
@ -1686,6 +1678,12 @@
|
|||
"integrity": "sha512-pzXIvANXEFrc5oFFXRMkbLPQ2rXRoDERwDLyrcUxGhaZhgP54BBSl9Oheh7Vv0T090cszWBxPjkQQ5Sq1PbBRQ==",
|
||||
"dev": true
|
||||
},
|
||||
"html-escaper": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.1.tgz",
|
||||
"integrity": "sha512-hNX23TjWwD3q56HpWjUHOKj1+4KKlnjv9PcmBUYKVpga+2cnb9nDx/B1o0yO4n+RZXZdiNxzx6B24C9aNMTkkQ==",
|
||||
"dev": true
|
||||
},
|
||||
"http-signature": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz",
|
||||
|
@ -2087,12 +2085,12 @@
|
|||
}
|
||||
},
|
||||
"istanbul-reports": {
|
||||
"version": "2.2.6",
|
||||
"resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-2.2.6.tgz",
|
||||
"integrity": "sha512-SKi4rnMyLBKe0Jy2uUdx28h8oG7ph2PPuQPvIAh31d+Ci+lSiEu4C+h3oBPuJ9+mPKhOyW0M8gY4U5NM1WLeXA==",
|
||||
"version": "2.2.7",
|
||||
"resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-2.2.7.tgz",
|
||||
"integrity": "sha512-uu1F/L1o5Y6LzPVSVZXNOoD/KXpJue9aeLRd0sM9uMXfZvzomB0WxVamWb5ue8kA2vVWEmW7EG+A5n3f1kqHKg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"handlebars": "^4.1.2"
|
||||
"html-escaper": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"js-tokens": {
|
||||
|
@ -2320,18 +2318,18 @@
|
|||
}
|
||||
},
|
||||
"mime-db": {
|
||||
"version": "1.42.0",
|
||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.42.0.tgz",
|
||||
"integrity": "sha512-UbfJCR4UAVRNgMpfImz05smAXK7+c+ZntjaA26ANtkXLlOe947Aag5zdIcKQULAiF9Cq4WxBi9jUs5zkA84bYQ==",
|
||||
"version": "1.43.0",
|
||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.43.0.tgz",
|
||||
"integrity": "sha512-+5dsGEEovYbT8UY9yD7eE4XTc4UwJ1jBYlgaQQF38ENsKR3wj/8q8RFZrF9WIZpB2V1ArTVFUva8sAul1NzRzQ==",
|
||||
"dev": true
|
||||
},
|
||||
"mime-types": {
|
||||
"version": "2.1.25",
|
||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.25.tgz",
|
||||
"integrity": "sha512-5KhStqB5xpTAeGqKBAMgwaYMnQik7teQN4IAzC7npDv6kzeU6prfkR67bc87J1kWMPGkoaZSq1npmexMgkmEVg==",
|
||||
"version": "2.1.26",
|
||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.26.tgz",
|
||||
"integrity": "sha512-01paPWYgLrkqAyrlDorC1uDwl2p3qZT7yl806vW7DvDoxwXi46jsjFbg+WdwotBIk6/MbEhO/dh5aZ5sNj/dWQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"mime-db": "1.42.0"
|
||||
"mime-db": "1.43.0"
|
||||
}
|
||||
},
|
||||
"mimic-fn": {
|
||||
|
@ -2352,29 +2350,22 @@
|
|||
"minimist": {
|
||||
"version": "1.2.5",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
|
||||
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
|
||||
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
|
||||
"dev": true
|
||||
},
|
||||
"mkdirp": {
|
||||
"version": "0.5.1",
|
||||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
|
||||
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
|
||||
"version": "0.5.3",
|
||||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.3.tgz",
|
||||
"integrity": "sha512-P+2gwrFqx8lhew375MQHHeTlY8AuOJSrGf0R5ddkEndUkmwpgUob/vQuBD1V22/Cw1/lJr4x+EjllSezBThzBg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"minimist": "0.0.8"
|
||||
},
|
||||
"dependencies": {
|
||||
"minimist": {
|
||||
"version": "0.0.8",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
|
||||
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
|
||||
"dev": true
|
||||
}
|
||||
"minimist": "^1.2.5"
|
||||
}
|
||||
},
|
||||
"mocha": {
|
||||
"version": "7.1.0",
|
||||
"resolved": "https://registry.npmjs.org/mocha/-/mocha-7.1.0.tgz",
|
||||
"integrity": "sha512-MymHK8UkU0K15Q/zX7uflZgVoRWiTjy0fXE/QjKts6mowUvGxOdPhZ2qj3b0iZdUrNZlW9LAIMFHB4IW+2b3EQ==",
|
||||
"version": "7.1.1",
|
||||
"resolved": "https://registry.npmjs.org/mocha/-/mocha-7.1.1.tgz",
|
||||
"integrity": "sha512-3qQsu3ijNS3GkWcccT5Zw0hf/rWvu1fTN9sPvEd81hlwsr30GX2GcDSSoBxo24IR8FelmrAydGC6/1J5QQP4WA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ansi-colors": "3.2.3",
|
||||
|
@ -2390,7 +2381,7 @@
|
|||
"js-yaml": "3.13.1",
|
||||
"log-symbols": "3.0.0",
|
||||
"minimatch": "3.0.4",
|
||||
"mkdirp": "0.5.1",
|
||||
"mkdirp": "0.5.3",
|
||||
"ms": "2.1.1",
|
||||
"node-environment-flags": "1.0.6",
|
||||
"object.assign": "4.1.0",
|
||||
|
@ -2398,8 +2389,8 @@
|
|||
"supports-color": "6.0.0",
|
||||
"which": "1.3.1",
|
||||
"wide-align": "1.1.3",
|
||||
"yargs": "13.3.0",
|
||||
"yargs-parser": "13.1.1",
|
||||
"yargs": "13.3.2",
|
||||
"yargs-parser": "13.1.2",
|
||||
"yargs-unparser": "1.6.0"
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -2420,6 +2411,24 @@
|
|||
"wrap-ansi": "^5.1.0"
|
||||
}
|
||||
},
|
||||
"debug": {
|
||||
"version": "3.2.6",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz",
|
||||
"integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ms": "^2.1.1"
|
||||
}
|
||||
},
|
||||
"mkdirp": {
|
||||
"version": "0.5.3",
|
||||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.3.tgz",
|
||||
"integrity": "sha512-P+2gwrFqx8lhew375MQHHeTlY8AuOJSrGf0R5ddkEndUkmwpgUob/vQuBD1V22/Cw1/lJr4x+EjllSezBThzBg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"minimist": "^1.2.5"
|
||||
}
|
||||
},
|
||||
"string-width": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz",
|
||||
|
@ -2452,9 +2461,9 @@
|
|||
}
|
||||
},
|
||||
"yargs": {
|
||||
"version": "13.3.0",
|
||||
"resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.0.tgz",
|
||||
"integrity": "sha512-2eehun/8ALW8TLoIl7MVaRUrg+yCnenu8B4kBlRxj3GJGDKU1Og7sMXPNm1BYyM1DOJmTZ4YeN/Nwxv+8XJsUA==",
|
||||
"version": "13.3.2",
|
||||
"resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz",
|
||||
"integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"cliui": "^5.0.0",
|
||||
|
@ -2466,13 +2475,13 @@
|
|||
"string-width": "^3.0.0",
|
||||
"which-module": "^2.0.0",
|
||||
"y18n": "^4.0.0",
|
||||
"yargs-parser": "^13.1.1"
|
||||
"yargs-parser": "^13.1.2"
|
||||
}
|
||||
},
|
||||
"yargs-parser": {
|
||||
"version": "13.1.1",
|
||||
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.1.tgz",
|
||||
"integrity": "sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ==",
|
||||
"version": "13.1.2",
|
||||
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz",
|
||||
"integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"camelcase": "^5.0.0",
|
||||
|
@ -2499,12 +2508,6 @@
|
|||
"integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=",
|
||||
"dev": true
|
||||
},
|
||||
"neo-async": {
|
||||
"version": "2.6.1",
|
||||
"resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.1.tgz",
|
||||
"integrity": "sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw==",
|
||||
"dev": true
|
||||
},
|
||||
"nested-error-stacks": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/nested-error-stacks/-/nested-error-stacks-2.1.0.tgz",
|
||||
|
@ -2674,24 +2677,6 @@
|
|||
"mimic-fn": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"optimist": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz",
|
||||
"integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"minimist": "~0.0.1",
|
||||
"wordwrap": "~0.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"minimist": {
|
||||
"version": "0.0.10",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz",
|
||||
"integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"optionator": {
|
||||
"version": "0.8.3",
|
||||
"resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz",
|
||||
|
@ -2850,9 +2835,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"picomatch": {
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.1.tgz",
|
||||
"integrity": "sha512-ISBaA8xQNmwELC7eOjqFKMESB2VIqt4PPDD0nsS95b/9dZXvVKOlz9keMSnoGGKcOHXfTvDD6WMaRoSc9UuhRA==",
|
||||
"version": "2.2.2",
|
||||
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz",
|
||||
"integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==",
|
||||
"dev": true
|
||||
},
|
||||
"pify": {
|
||||
|
@ -2889,9 +2874,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"psl": {
|
||||
"version": "1.6.0",
|
||||
"resolved": "https://registry.npmjs.org/psl/-/psl-1.6.0.tgz",
|
||||
"integrity": "sha512-SYKKmVel98NCOYXpkwUqZqh0ahZeeKfmisiLIcEZdsb+WbLv02g/dI5BUmZnIyOe7RzZtLax81nnb2HbvC2tzA==",
|
||||
"version": "1.7.0",
|
||||
"resolved": "https://registry.npmjs.org/psl/-/psl-1.7.0.tgz",
|
||||
"integrity": "sha512-5NsSEDv8zY70ScRnOTn7bK7eanl2MvFrOrS/R6x+dBt5g1ghnj9Zv90kO8GwT8gxcu2ANyFprnFYB85IogIJOQ==",
|
||||
"dev": true
|
||||
},
|
||||
"pump": {
|
||||
|
@ -2911,9 +2896,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"pvtsutils": {
|
||||
"version": "1.0.9",
|
||||
"resolved": "https://registry.npmjs.org/pvtsutils/-/pvtsutils-1.0.9.tgz",
|
||||
"integrity": "sha512-/kDsuCKPqJuIzn37w6+iN+TiSrN+zrwPEd7FjT61oNbRvceGdsS94fMEWZ4/h6QZU5EZhBMiV+79IYedroP/Yw==",
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/pvtsutils/-/pvtsutils-1.0.10.tgz",
|
||||
"integrity": "sha512-8ZKQcxnZKTn+fpDh7wL4yKax5fdl3UJzT8Jv49djZpB/dzPxacyN1Sez90b6YLdOmvIr9vaySJ5gw4aUA1EdSw==",
|
||||
"requires": {
|
||||
"tslib": "^1.10.0"
|
||||
}
|
||||
|
@ -2975,9 +2960,9 @@
|
|||
}
|
||||
},
|
||||
"request": {
|
||||
"version": "2.88.0",
|
||||
"resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz",
|
||||
"integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==",
|
||||
"version": "2.88.2",
|
||||
"resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz",
|
||||
"integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"aws-sign2": "~0.7.0",
|
||||
|
@ -2987,7 +2972,7 @@
|
|||
"extend": "~3.0.2",
|
||||
"forever-agent": "~0.6.1",
|
||||
"form-data": "~2.3.2",
|
||||
"har-validator": "~5.1.0",
|
||||
"har-validator": "~5.1.3",
|
||||
"http-signature": "~1.2.0",
|
||||
"is-typedarray": "~1.0.0",
|
||||
"isstream": "~0.1.2",
|
||||
|
@ -2997,7 +2982,7 @@
|
|||
"performance-now": "^2.1.0",
|
||||
"qs": "~6.5.2",
|
||||
"safe-buffer": "^5.1.2",
|
||||
"tough-cookie": "~2.4.3",
|
||||
"tough-cookie": "~2.5.0",
|
||||
"tunnel-agent": "^0.6.0",
|
||||
"uuid": "^3.3.2"
|
||||
}
|
||||
|
@ -3049,9 +3034,9 @@
|
|||
}
|
||||
},
|
||||
"rollup": {
|
||||
"version": "2.0.6",
|
||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-2.0.6.tgz",
|
||||
"integrity": "sha512-P42IlI6a/bxh52ed8hEXXe44LcHfep2f26OZybMJPN1TTQftibvQEl3CWeOmJrzqGbFxOA000QXDWO9WJaOQpA==",
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-2.1.0.tgz",
|
||||
"integrity": "sha512-gfE1455AEazVVTJoeQtcOq/U6GSxwoj4XPSWVsuWmgIxj7sBQNLDOSA82PbdMe+cP8ql8fR1jogPFe8Wg8g4SQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"fsevents": "~2.1.2"
|
||||
|
@ -3264,9 +3249,9 @@
|
|||
}
|
||||
},
|
||||
"spawn-wrap": {
|
||||
"version": "1.4.2",
|
||||
"resolved": "https://registry.npmjs.org/spawn-wrap/-/spawn-wrap-1.4.2.tgz",
|
||||
"integrity": "sha512-vMwR3OmmDhnxCVxM8M+xO/FtIp6Ju/mNaDfCMMW7FDcLRTPFWUswec4LXJHTJE2hwTI9O0YBfygu4DalFl7Ylg==",
|
||||
"version": "1.4.3",
|
||||
"resolved": "https://registry.npmjs.org/spawn-wrap/-/spawn-wrap-1.4.3.tgz",
|
||||
"integrity": "sha512-IgB8md0QW/+tWqcavuFgKYR/qIRvJkRLPJDFaoXtLLUaVcCDK0+HeFTkmQHj3eprcYhc+gOl0aEA1w7qZlYezw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"foreground-child": "^1.5.6",
|
||||
|
@ -3498,21 +3483,13 @@
|
|||
}
|
||||
},
|
||||
"tough-cookie": {
|
||||
"version": "2.4.3",
|
||||
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz",
|
||||
"integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==",
|
||||
"version": "2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz",
|
||||
"integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"psl": "^1.1.24",
|
||||
"punycode": "^1.4.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"punycode": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz",
|
||||
"integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=",
|
||||
"dev": true
|
||||
}
|
||||
"psl": "^1.1.28",
|
||||
"punycode": "^2.1.1"
|
||||
}
|
||||
},
|
||||
"trim-right": {
|
||||
|
@ -3522,9 +3499,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"ts-node": {
|
||||
"version": "8.6.2",
|
||||
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.6.2.tgz",
|
||||
"integrity": "sha512-4mZEbofxGqLL2RImpe3zMJukvEvcO1XP8bj8ozBPySdCUXEcU5cIRwR0aM3R+VoZq7iXc8N86NC0FspGRqP4gg==",
|
||||
"version": "8.8.1",
|
||||
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.8.1.tgz",
|
||||
"integrity": "sha512-10DE9ONho06QORKAaCBpPiFCdW+tZJuY/84tyypGtl6r+/C7Asq0dhqbRZURuUlLQtZxxDvT8eoj8cGW0ha6Bg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"arg": "^4.1.0",
|
||||
|
@ -3592,33 +3569,6 @@
|
|||
"integrity": "sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==",
|
||||
"dev": true
|
||||
},
|
||||
"uglify-js": {
|
||||
"version": "3.7.2",
|
||||
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.7.2.tgz",
|
||||
"integrity": "sha512-uhRwZcANNWVLrxLfNFEdltoPNhECUR3lc+UdJoG9CBpMcSnKyWA94tc3eAujB1GcMY5Uwq8ZMp4qWpxWYDQmaA==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"commander": "~2.20.3",
|
||||
"source-map": "~0.6.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"commander": {
|
||||
"version": "2.20.3",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
|
||||
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"source-map": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
||||
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"universalify": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
|
||||
|
@ -3668,12 +3618,12 @@
|
|||
}
|
||||
},
|
||||
"webcrypto-core": {
|
||||
"version": "1.0.17",
|
||||
"resolved": "https://registry.npmjs.org/webcrypto-core/-/webcrypto-core-1.0.17.tgz",
|
||||
"integrity": "sha512-7jxTLgtM+TahBPErx/Dd2XvxFDfWJrHxjVeTSvIa4LSgiYrmCPlC2INiAMAfb8MbtHiwJKKqF5sPS0AWNjBbXw==",
|
||||
"version": "1.0.18",
|
||||
"resolved": "https://registry.npmjs.org/webcrypto-core/-/webcrypto-core-1.0.18.tgz",
|
||||
"integrity": "sha512-wHRMXYxtDUWsTXNyRdaYlbcbq1OJF9pQov5THqvn5OBvixpCjnjU2spvEscxqRY8bLlpHk2S7RtROIMyNoEyFg==",
|
||||
"requires": {
|
||||
"pvtsutils": "^1.0.9",
|
||||
"tslib": "^1.10.0"
|
||||
"pvtsutils": "^1.0.10",
|
||||
"tslib": "^1.11.1"
|
||||
}
|
||||
},
|
||||
"which": {
|
||||
|
@ -3706,12 +3656,6 @@
|
|||
"integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==",
|
||||
"dev": true
|
||||
},
|
||||
"wordwrap": {
|
||||
"version": "0.0.3",
|
||||
"resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz",
|
||||
"integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=",
|
||||
"dev": true
|
||||
},
|
||||
"wrap-ansi": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz",
|
||||
|
@ -3914,9 +3858,9 @@
|
|||
}
|
||||
},
|
||||
"yargs": {
|
||||
"version": "13.3.0",
|
||||
"resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.0.tgz",
|
||||
"integrity": "sha512-2eehun/8ALW8TLoIl7MVaRUrg+yCnenu8B4kBlRxj3GJGDKU1Og7sMXPNm1BYyM1DOJmTZ4YeN/Nwxv+8XJsUA==",
|
||||
"version": "13.3.2",
|
||||
"resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz",
|
||||
"integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"cliui": "^5.0.0",
|
||||
|
@ -3928,13 +3872,13 @@
|
|||
"string-width": "^3.0.0",
|
||||
"which-module": "^2.0.0",
|
||||
"y18n": "^4.0.0",
|
||||
"yargs-parser": "^13.1.1"
|
||||
"yargs-parser": "^13.1.2"
|
||||
}
|
||||
},
|
||||
"yargs-parser": {
|
||||
"version": "13.1.1",
|
||||
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.1.tgz",
|
||||
"integrity": "sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ==",
|
||||
"version": "13.1.2",
|
||||
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz",
|
||||
"integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"camelcase": "^5.0.0",
|
||||
|
|
21
package.json
21
package.json
|
@ -49,28 +49,29 @@
|
|||
"homepage": "https://github.com/PeculiarVentures/webcrypto#readme",
|
||||
"banner": "// Copyright (c) 2020, Peculiar Ventures, All rights reserved.",
|
||||
"devDependencies": {
|
||||
"@peculiar/webcrypto-test": "^1.0.1",
|
||||
"@types/mocha": "^7.0.2",
|
||||
"@types/node": "^12.12.30",
|
||||
"@typescript-eslint/eslint-plugin": "^2.23.0",
|
||||
"@typescript-eslint/parser": "^2.23.0",
|
||||
"coveralls": "^3.0.9",
|
||||
"@typescript-eslint/eslint-plugin": "^2.24.0",
|
||||
"@typescript-eslint/parser": "^2.24.0",
|
||||
"coveralls": "^3.0.11",
|
||||
"eslint": "^6.8.0",
|
||||
"eslint-plugin-import": "^2.20.1",
|
||||
"mocha": "^7.1.0",
|
||||
"mocha": "^7.1.1",
|
||||
"nyc": "^14.1.1",
|
||||
"rimraf": "^3.0.2",
|
||||
"rollup": "^2.0.6",
|
||||
"rollup": "^2.1.0",
|
||||
"rollup-plugin-typescript2": "^0.26.0",
|
||||
"ts-node": "^8.6.2",
|
||||
"ts-node": "^8.8.1",
|
||||
"typescript": "^3.8.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@peculiar/asn1-schema": "^1.0.3",
|
||||
"@peculiar/json-schema": "^1.1.9",
|
||||
"@peculiar/asn1-schema": "^1.0.5",
|
||||
"@peculiar/json-schema": "^1.1.10",
|
||||
"asn1js": "^2.0.26",
|
||||
"pvtsutils": "^1.0.9",
|
||||
"pvtsutils": "^1.0.10",
|
||||
"tslib": "^1.11.1",
|
||||
"webcrypto-core": "^1.0.17"
|
||||
"webcrypto-core": "^1.0.18"
|
||||
},
|
||||
"nyc": {
|
||||
"extension": [
|
||||
|
|
1003
test/aes.ts
1003
test/aes.ts
File diff suppressed because it is too large
Load Diff
|
@ -1,9 +1,12 @@
|
|||
import assert from "assert";
|
||||
import { WebcryptoTest } from "@peculiar/webcrypto-test";
|
||||
import { Crypto } from "../src";
|
||||
|
||||
const crypto = new Crypto();
|
||||
|
||||
WebcryptoTest.check(crypto as any, {});
|
||||
context("Crypto", () => {
|
||||
|
||||
const crypto = new Crypto();
|
||||
|
||||
context("getRandomValues", () => {
|
||||
|
||||
|
|
128
test/des.ts
128
test/des.ts
|
@ -1,128 +0,0 @@
|
|||
import * as core from "webcrypto-core";
|
||||
import { Crypto } from "../src";
|
||||
import { DesCbcParams } from "../src/mechs";
|
||||
import { testCrypto } from "./helper";
|
||||
|
||||
context("DES", () => {
|
||||
|
||||
const crypto = new Crypto();
|
||||
|
||||
testCrypto(crypto, [
|
||||
{
|
||||
name: "DES-CBC",
|
||||
actions: {
|
||||
generateKey: [
|
||||
{
|
||||
algorithm: { name: "DES-CBC", length: 64 } as core.DesKeyGenParams,
|
||||
extractable: false,
|
||||
keyUsages: ["encrypt", "decrypt", "wrapKey", "unwrapKey"] as KeyUsage[],
|
||||
},
|
||||
],
|
||||
encrypt: [
|
||||
{
|
||||
algorithm: {
|
||||
name: "DES-CBC",
|
||||
iv: Buffer.from("12345678"),
|
||||
} as DesCbcParams,
|
||||
data: Buffer.from("test message"),
|
||||
encData: Buffer.from("3af3f901ff01fe0102dfbbf37d9bdb94", "hex"),
|
||||
key: {
|
||||
format: "raw" as KeyFormat,
|
||||
algorithm: { name: "DES-CBC" },
|
||||
extractable: true,
|
||||
keyUsages: ["encrypt", "decrypt"] as KeyUsage[],
|
||||
data: Buffer.from("12345678"),
|
||||
},
|
||||
},
|
||||
],
|
||||
import: [
|
||||
{
|
||||
name: "raw",
|
||||
format: "raw" as KeyFormat,
|
||||
data: Buffer.from("12345678"),
|
||||
algorithm: "DES-CBC",
|
||||
extractable: true,
|
||||
keyUsages: ["encrypt", "decrypt", "wrapKey", "unwrapKey"] as KeyUsage[],
|
||||
},
|
||||
{
|
||||
name: "jwk",
|
||||
format: "jwk" as KeyFormat,
|
||||
data: {
|
||||
kty: "oct",
|
||||
alg: "DES-CBC",
|
||||
k: "MTIzNDU2Nzg",
|
||||
ext: true,
|
||||
key_ops: ["encrypt", "decrypt", "wrapKey", "unwrapKey"],
|
||||
},
|
||||
algorithm: "DES-CBC",
|
||||
extractable: true,
|
||||
keyUsages: ["encrypt", "decrypt", "wrapKey", "unwrapKey"] as KeyUsage[],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "DES-EDE3-CBC",
|
||||
actions: {
|
||||
generateKey: [
|
||||
{
|
||||
algorithm: { name: "DES-EDE3-CBC", length: 192 } as core.DesKeyGenParams,
|
||||
extractable: false,
|
||||
keyUsages: ["encrypt", "decrypt", "wrapKey", "unwrapKey"] as KeyUsage[],
|
||||
},
|
||||
],
|
||||
encrypt: [
|
||||
{
|
||||
algorithm: {
|
||||
name: "DES-EDE3-CBC",
|
||||
iv: Buffer.from("12345678"),
|
||||
} as DesCbcParams,
|
||||
data: Buffer.from("test message"),
|
||||
encData: Buffer.from("b9ef20e7db926490e4ff8680d99d2141", "hex"),
|
||||
key: {
|
||||
format: "raw" as KeyFormat,
|
||||
algorithm: { name: "DES-EDE3-CBC" },
|
||||
extractable: true,
|
||||
keyUsages: ["encrypt", "decrypt"] as KeyUsage[],
|
||||
data: Buffer.from("1234567890abcdef12345678"),
|
||||
},
|
||||
},
|
||||
],
|
||||
import: [
|
||||
{
|
||||
name: "raw",
|
||||
format: "raw" as KeyFormat,
|
||||
data: Buffer.from("1234567890abcdef12345678"),
|
||||
algorithm: "DES-EDE3-CBC",
|
||||
extractable: true,
|
||||
keyUsages: ["encrypt", "decrypt", "wrapKey", "unwrapKey"] as KeyUsage[],
|
||||
},
|
||||
{
|
||||
name: "wrong key size",
|
||||
error: core.OperationError,
|
||||
format: "raw",
|
||||
data: Buffer.from("12345678"),
|
||||
algorithm: "DES-EDE3-CBC",
|
||||
extractable: true,
|
||||
keyUsages: ["encrypt", "decrypt", "wrapKey", "unwrapKey"],
|
||||
},
|
||||
{
|
||||
name: "jwk",
|
||||
format: "jwk",
|
||||
data: {
|
||||
kty: "oct",
|
||||
alg: "3DES-CBC",
|
||||
k: "MTIzNDU2Nzg5MGFiY2RlZjEyMzQ1Njc4",
|
||||
ext: true,
|
||||
key_ops: ["encrypt", "decrypt", "wrapKey", "unwrapKey"],
|
||||
},
|
||||
algorithm: "DES-EDE3-CBC",
|
||||
extractable: true,
|
||||
keyUsages: ["encrypt", "decrypt", "wrapKey", "unwrapKey"],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
});
|
539
test/ec.ts
539
test/ec.ts
|
@ -1,539 +0,0 @@
|
|||
import { Convert } from "pvtsutils";
|
||||
import { Crypto } from "../src";
|
||||
import { ITestGenerateKeyAction, testCrypto } from "./helper";
|
||||
|
||||
context("EC", () => {
|
||||
|
||||
const crypto = new Crypto();
|
||||
|
||||
testCrypto(crypto, [
|
||||
{
|
||||
name: "ECDSA",
|
||||
actions: {
|
||||
generateKey: ["P-256", "P-384", "P-521", "K-256"].map((namedCurve) => {
|
||||
return {
|
||||
name: namedCurve,
|
||||
algorithm: {
|
||||
name: "ECDSA",
|
||||
namedCurve,
|
||||
} as EcKeyGenParams,
|
||||
extractable: false,
|
||||
keyUsages: ["sign", "verify"],
|
||||
} as ITestGenerateKeyAction;
|
||||
}),
|
||||
import: [
|
||||
{
|
||||
name: "JWK public key P-256",
|
||||
format: "jwk" as KeyFormat,
|
||||
data: {
|
||||
crv: "P-256",
|
||||
ext: true,
|
||||
key_ops: ["verify"],
|
||||
kty: "EC",
|
||||
x: "dJ9C3NyXDa3fMeZ477NWdp9W6faytA7A_U1ub-tyRcs",
|
||||
y: "aS0_VVe_SeIm8w5TBWjUEco7us6EJUMPKKJaIh36Lho",
|
||||
},
|
||||
algorithm: {
|
||||
name: "ECDSA",
|
||||
namedCurve: "P-256",
|
||||
} as EcKeyImportParams,
|
||||
extractable: true,
|
||||
keyUsages: ["verify"],
|
||||
},
|
||||
{
|
||||
name: "JWK public key P-384",
|
||||
format: "jwk" as KeyFormat,
|
||||
data: {
|
||||
crv: "P-384",
|
||||
ext: true,
|
||||
key_ops: ["verify"],
|
||||
kty: "EC",
|
||||
x: "eHlLZ4jnt_Drs-qoVxK-SZZvhNhi34jLCgyaEZ9XI6bdlK3y1ettm8K5SnLtDhWO",
|
||||
y: "qbr3pOOViYDQ2wWG-_9pwQ0S8cHV0LP-x9JO5dl-dsFYtbGix9YH7fRNOl8GkP-6",
|
||||
},
|
||||
algorithm: {
|
||||
name: "ECDSA",
|
||||
namedCurve: "P-384",
|
||||
} as EcKeyImportParams,
|
||||
extractable: true,
|
||||
keyUsages: ["verify"],
|
||||
},
|
||||
{
|
||||
name: "JWK public key P-521",
|
||||
format: "jwk" as KeyFormat,
|
||||
data: {
|
||||
crv: "P-521",
|
||||
ext: true,
|
||||
key_ops: ["verify"],
|
||||
kty: "EC",
|
||||
x: "Adqn62IVQX8LIauAXrUtxH05DHlRygKcsP9qWAnd9tfJvpaG7bzIs16WMEUe1V-f4AxbQJceU4xCP8dJppK_fzdC",
|
||||
y: "AEo3s1eExCOvpuBtBWnWlr7TuFhq_fMzqX9eqDHiy8qWl4I_koQtMePodrAc85mVrJAjvsa77Y3Ul3QtIWpXXBqa",
|
||||
},
|
||||
algorithm: {
|
||||
name: "ECDSA",
|
||||
namedCurve: "P-521",
|
||||
} as EcKeyImportParams,
|
||||
extractable: true,
|
||||
keyUsages: ["verify"],
|
||||
},
|
||||
//#region SPKI
|
||||
{
|
||||
name: "SPKI P-256",
|
||||
format: "spki" as KeyFormat,
|
||||
data: Convert.FromBase64("MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEoZMMqyfA16N6bvloFHmalk/SGMisr3zSXFZdR8F9UkaY7hF13hHiQtwp2YO+1zd7jwYi1Y7SMA9iUrC+ap2OCw=="),
|
||||
algorithm: {
|
||||
name: "ECDSA",
|
||||
namedCurve: "P-256",
|
||||
} as EcKeyImportParams,
|
||||
extractable: true,
|
||||
keyUsages: ["verify"],
|
||||
},
|
||||
{
|
||||
name: "SPKI P-384",
|
||||
format: "spki" as KeyFormat,
|
||||
data: Convert.FromBase64("MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAE8Kf5Wv21nksy0LuMlkMZv9sxTVAmzNWt81b6MVlYuzxl9D2/obwoVp86pTe4BM79gWWj8pfLc1XrjaIyMSrV8+05IejRLB3i4c0KTGA6QARGm3/AOm0MbTt6kMQF7drL"),
|
||||
algorithm: {
|
||||
name: "ECDSA",
|
||||
namedCurve: "P-384",
|
||||
} as EcKeyImportParams,
|
||||
extractable: true,
|
||||
keyUsages: ["verify"],
|
||||
},
|
||||
{
|
||||
name: "SPKI P-521",
|
||||
format: "spki" as KeyFormat,
|
||||
data: Convert.FromBase64("MIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQB+/g37ii0T5iLHCAaXcYRRoNpT0LhfeAr88OwQY4cUpQm1S9lkR0EVUtyuYrYsMB8FarhAZYsLtOiyhjl/Y5f+lQAZ6veWILhbDcbrSNhTPSp3wamAm8QT3EjPUkJlYjHefuAUBIYS9pl5FWjK1pI9fkYe3bdAemkjP1ccHVzqZU9sjg="),
|
||||
algorithm: {
|
||||
name: "ECDSA",
|
||||
namedCurve: "P-521",
|
||||
} as EcKeyImportParams,
|
||||
extractable: true,
|
||||
keyUsages: ["verify"],
|
||||
},
|
||||
//#endregion
|
||||
//#region RAW
|
||||
{
|
||||
name: "RAW P-256",
|
||||
format: "raw" as KeyFormat,
|
||||
data: Convert.FromBase64("BEehen4AavxgJkx5EPZpBeopzgZuY+1i3cMR9iYdZj+IY7/h98Q/GboC2BKS6lT0hEyt6y1DFFXj8ytuof4zXR4="),
|
||||
algorithm: {
|
||||
name: "ECDSA",
|
||||
namedCurve: "P-256",
|
||||
} as EcKeyImportParams,
|
||||
extractable: true,
|
||||
keyUsages: ["verify"],
|
||||
},
|
||||
{
|
||||
name: "RAW P-384",
|
||||
format: "raw" as KeyFormat,
|
||||
data: Convert.FromBase64("BGYoCpP3Qv4o0s2GWg5xFnasdkI8h6K/LeBm4TV+9HCsqnoXFUJDM5SDeZ0rcCAUUuaPJVn5sedPEKEGW80zmLM1rBOG2RzaBq+uhEJkLpibongnzMZNX2LB58wGJ05f2g=="),
|
||||
algorithm: {
|
||||
name: "ECDSA",
|
||||
namedCurve: "P-384",
|
||||
} as EcKeyImportParams,
|
||||
extractable: true,
|
||||
keyUsages: ["verify"],
|
||||
},
|
||||
{
|
||||
name: "RAW P-521",
|
||||
format: "raw" as KeyFormat,
|
||||
data: Convert.FromBase64("BABIiZ3f90HQsl4CYHt7Q1WnOIOs+dxeecfQrew/z+73yI/bUrMlmR3mOVARtvg7ZPX7h3lSSqzA1Vv6iv7bPYekcwDKQPeLJkem//H7zY8xtKY+YrYnLUVv6vPE9jyk2vYkj8QPxQRdeIT5bzY2BzTiTcLHDwi2+w2Eonkt7M+zb4G6xw=="),
|
||||
algorithm: {
|
||||
name: "ECDSA",
|
||||
namedCurve: "P-521",
|
||||
} as EcKeyImportParams,
|
||||
extractable: true,
|
||||
keyUsages: ["verify"],
|
||||
},
|
||||
//#endregion
|
||||
//#region JWK Private key
|
||||
{
|
||||
name: "JWK private key P-256",
|
||||
format: "jwk" as KeyFormat,
|
||||
data: {
|
||||
crv: "P-256",
|
||||
d: "RIrfLaesGcEeNy7fOoVIkgMiImJOFw1Y44kdrtK_49I",
|
||||
ext: true,
|
||||
key_ops: ["sign"],
|
||||
kty: "EC",
|
||||
x: "wJls5KwIfRDxJEvyAlo3G84qNY0HjvsujyxDSMYAlm4",
|
||||
y: "I61bQbFgnzfDom68P86kRo98fTrV_9HLeqa4gYnGOdw",
|
||||
},
|
||||
algorithm: {
|
||||
name: "ECDSA",
|
||||
namedCurve: "P-256",
|
||||
} as EcKeyImportParams,
|
||||
extractable: true,
|
||||
keyUsages: ["sign"],
|
||||
},
|
||||
{
|
||||
name: "JWK private key P-384",
|
||||
format: "jwk" as KeyFormat,
|
||||
data: {
|
||||
crv: "P-384",
|
||||
d: "4YQRcOD-4LMLEr-qsRhQ1oq8hfPKa66BfGVUv3LUlsf2OU3aFG5FxabG5xFUoAE2",
|
||||
ext: true,
|
||||
key_ops: ["sign"],
|
||||
kty: "EC",
|
||||
x: "XKewC5QCVW9w-SFyZd3z1vlmCqbYYuJmoGRzKtjwkpYQD_RhNAc3ck29d_t0QmaT",
|
||||
y: "6oSrri3ry1_8c2NKM8aiaJcjwd146ITViezQ7-BpsE1-wDH18P1QkbmR3-Ho54We",
|
||||
},
|
||||
algorithm: {
|
||||
name: "ECDSA",
|
||||
namedCurve: "P-384",
|
||||
} as EcKeyImportParams,
|
||||
extractable: true,
|
||||
keyUsages: ["sign"],
|
||||
},
|
||||
{
|
||||
name: "JWK private key P-521",
|
||||
format: "jwk" as KeyFormat,
|
||||
data: {
|
||||
crv: "P-521",
|
||||
d: "AItxxufCXVzwPVePNe9Acy8HfbmYeUVkiEyFXdsYRnHxqgDpwucVnIJ44-ZWRpuWu5Ep5KVV3vY9Hp8nJfksi7z2",
|
||||
ext: true,
|
||||
key_ops: ["sign"],
|
||||
kty: "EC",
|
||||
x: "AJGuTezC-8F-d_0bBpS502OK0z63vo87Dw99a3NUm6gm5pQC1rwu7LcblGqFWOuFBZhsF8I6OFjYvsR-z3u7hhCA",
|
||||
y: "AFQT8BB9hBf7UwwBUV4im8bFJ7_MD0qOZMVetmdbooMjfec1q3wU5cSoy4LvCnWAaFqu5havUxwnAUuPUWGG_InR",
|
||||
},
|
||||
algorithm: {
|
||||
name: "ECDSA",
|
||||
namedCurve: "P-521",
|
||||
} as EcKeyImportParams,
|
||||
extractable: true,
|
||||
keyUsages: ["sign"],
|
||||
},
|
||||
//#endregion
|
||||
//#region PKCS8
|
||||
{
|
||||
name: "PKCS8 P-256",
|
||||
format: "pkcs8" as KeyFormat,
|
||||
data: Convert.FromBase64("MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgiVEY5OFo3J7g1BnSw/WEWykY/alrhNmpEBLy/7cNnuGhRANCAAQ4SFnMDGYc5kWv7D0gtgUj/Bzbu0B6Bq6XK1vqOo//2m8FS1D4kYKV4KDfFRWehKEtrMBjjkW6OZcM/n0qZ6Uw"),
|
||||
algorithm: {
|
||||
name: "ECDSA",
|
||||
namedCurve: "P-256",
|
||||
} as EcKeyImportParams,
|
||||
extractable: true,
|
||||
keyUsages: ["sign"],
|
||||
},
|
||||
{
|
||||
name: "PKCS8 P-384",
|
||||
format: "pkcs8" as KeyFormat,
|
||||
data: Convert.FromBase64("MIG2AgEAMBAGByqGSM49AgEGBSuBBAAiBIGeMIGbAgEBBDCY18ajGPCgLv4aF1UkkohMEaB5MU1MyfkuFQSQVDYHLWFTn8f9czce7aTIDjkCx0OhZANiAAR1fni8TC1N1NdXvx25kJyK3y3rpVVaAmA44Wm9jIFseGmSzm/EgmKOFclSzQdEpSC6jxi3olIJ4iYetjl36Ygfwed/xqrsiV6BUb/ny2mimzk3r0M9H6yvbEVQFd7rEAA="),
|
||||
algorithm: {
|
||||
name: "ECDSA",
|
||||
namedCurve: "P-384",
|
||||
} as EcKeyImportParams,
|
||||
extractable: true,
|
||||
keyUsages: ["sign"],
|
||||
},
|
||||
{
|
||||
name: "PKCS8 P-521",
|
||||
format: "pkcs8" as KeyFormat,
|
||||
data: Convert.FromBase64("MIHuAgEAMBAGByqGSM49AgEGBSuBBAAjBIHWMIHTAgEBBEIAbHGkGfik5q0l+ZMI70dbpTGWeKy1+c3mG98wHmnpU+d2bArcYDOXcoqg5Ic/pnmtHvxmk+El33u3XogGONKPlouhgYkDgYYABAH16CoJzEx+Oncpeam6ysUG17y9ttNm5Eg8WqD+BJkP9ju3R22I5PVyYYYZ3ICc1IyDGxFCS7leO1N7tqQLaLi8NAEFTkwCy1G6AAK7LbSa1hNC2fUAaC9L8QJNUNJpjgYiXPDmEnaRNT1XXL00Bjo5iMpE2Ddc/Kp6ktTAo2jOMnfmow=="),
|
||||
algorithm: {
|
||||
name: "ECDSA",
|
||||
namedCurve: "P-521",
|
||||
} as EcKeyImportParams,
|
||||
extractable: true,
|
||||
keyUsages: ["sign"],
|
||||
},
|
||||
//#endregion
|
||||
],
|
||||
sign: [
|
||||
{
|
||||
key: {
|
||||
privateKey: {
|
||||
format: "pkcs8" as KeyFormat,
|
||||
data: Convert.FromBase64("MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgsY5TBHM+9mLXGpFaPmrigl6+jl0XWzazxu1lbwb5KRahRANCAATqDP2L/xxSOlckG+j6oPHfzBE4WpmjA/YE9sP2rXpXW1qe9I/GJ7wjlOTXpqHUxQeBbps8jSvV+A7DzQqzjOst"),
|
||||
algorithm: {
|
||||
name: "ECDSA",
|
||||
namedCurve: "P-256",
|
||||
} as EcKeyImportParams,
|
||||
extractable: true,
|
||||
keyUsages: ["sign"],
|
||||
},
|
||||
publicKey: {
|
||||
format: "spki" as KeyFormat,
|
||||
data: Convert.FromBase64("MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE6gz9i/8cUjpXJBvo+qDx38wROFqZowP2BPbD9q16V1tanvSPxie8I5Tk16ah1MUHgW6bPI0r1fgOw80Ks4zrLQ=="),
|
||||
algorithm: {
|
||||
name: "ECDSA",
|
||||
namedCurve: "P-256",
|
||||
} as EcKeyImportParams,
|
||||
extractable: true,
|
||||
keyUsages: ["verify"],
|
||||
},
|
||||
},
|
||||
data: new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]),
|
||||
signature: Convert.FromBase64("gsTh0IcWfzj3hjjourRgzTIsNa+wcDEDlKnkEA4Jv8ygLF2IDIOXpCD7ocCGo7xlSMGTme78CyrPqWGSz95mZg=="),
|
||||
algorithm: {
|
||||
name: "ECDSA",
|
||||
hash: "SHA-256",
|
||||
} as EcdsaParams,
|
||||
},
|
||||
{
|
||||
key: {
|
||||
privateKey: {
|
||||
format: "pkcs8" as KeyFormat,
|
||||
data: Convert.FromBase64("MIGEAgEAMBAGByqGSM49AgEGBSuBBAAKBG0wawIBAQQg0h6+W+/4eFVP+i79hrzYeiEJ6UrveFYhuhoXRW+g/LGhRANCAASiJU6MaFN5fshUv6X5rCf/RjLQ0nAXj06gBdo3ruYiKZf8daAcYImniAq81PjF0j6eTwCy4bYbkyfBQtrtCTKR"),
|
||||
algorithm: {
|
||||
name: "ECDSA",
|
||||
namedCurve: "K-256",
|
||||
} as EcKeyImportParams,
|
||||
extractable: true,
|
||||
keyUsages: ["sign"],
|
||||
},
|
||||
publicKey: {
|
||||
format: "spki" as KeyFormat,
|
||||
data: Convert.FromBase64("MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEoiVOjGhTeX7IVL+l+awn/0Yy0NJwF49OoAXaN67mIimX/HWgHGCJp4gKvNT4xdI+nk8AsuG2G5MnwULa7QkykQ=="),
|
||||
algorithm: {
|
||||
name: "ECDSA",
|
||||
namedCurve: "K-256",
|
||||
} as EcKeyImportParams,
|
||||
extractable: true,
|
||||
keyUsages: ["verify"],
|
||||
},
|
||||
},
|
||||
data: new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]),
|
||||
signature: Convert.FromBase64("lqUTZHqf9v9KcOCw5r5wR1sCt9RPA0ONVW6vqejpoALehd6vtAb+ybVrDEtyUDpBFw9UIRIW6GnXRrAz4KaO4Q=="),
|
||||
algorithm: {
|
||||
name: "ECDSA",
|
||||
hash: "SHA-256",
|
||||
} as EcdsaParams,
|
||||
},
|
||||
],
|
||||
deriveBits: [
|
||||
{
|
||||
name: "P-256 128",
|
||||
key: {
|
||||
privateKey: {
|
||||
format: "pkcs8" as KeyFormat,
|
||||
data: Convert.FromBase64("MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgQA7bkTNYlIYVb9+DavBlJ3b08f0892or3XwfscA3tLGhRANCAARzsy+ZcbrNchF7SrpL0hYnGp6ICX77jXUrpMYkq0BuzfaPFWcu9YZH5ASUzQJGz9eCK3mDXEbLCuiHRw3dwkFs"),
|
||||
algorithm: {
|
||||
name: "ECDH",
|
||||
namedCurve: "P-256",
|
||||
} as EcKeyImportParams,
|
||||
extractable: true,
|
||||
keyUsages: ["deriveBits"],
|
||||
},
|
||||
publicKey: {
|
||||
format: "spki" as KeyFormat,
|
||||
data: Convert.FromBase64("MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEc7MvmXG6zXIRe0q6S9IWJxqeiAl++411K6TGJKtAbs32jxVnLvWGR+QElM0CRs/Xgit5g1xGywroh0cN3cJBbA=="),
|
||||
algorithm: {
|
||||
name: "ECDH",
|
||||
namedCurve: "P-256",
|
||||
} as EcKeyImportParams,
|
||||
extractable: true,
|
||||
keyUsages: [],
|
||||
},
|
||||
},
|
||||
data: Convert.FromBase64("Jlc1/Zqi/8mH1oQT8+YfCA=="),
|
||||
algorithm: {
|
||||
name: "ECDH",
|
||||
},
|
||||
length: 128,
|
||||
},
|
||||
{
|
||||
name: "P-384 192",
|
||||
key: {
|
||||
privateKey: {
|
||||
format: "pkcs8" as KeyFormat,
|
||||
data: Convert.FromBase64("MIG2AgEAMBAGByqGSM49AgEGBSuBBAAiBIGeMIGbAgEBBDAFOXcWxQ+YqPdUqc9Iar3ZDf012ZtQAFajBMApKpd2WPQccBmyPzvDZJSWKe3d5jShZANiAAQ4Z43bP7d5fUFIBorLA1pBFTwDLb6XA7J871VUwyu64q8L5qidV7iBZK3P+9m7eMMQWm0drWPvrEszE+4jEsS4HIbBeuduBU+6R46Orv+V6VXU1hAXKSdMFZOCzdbDFlE="),
|
||||
algorithm: {
|
||||
name: "ECDH",
|
||||
namedCurve: "P-384",
|
||||
} as EcKeyImportParams,
|
||||
extractable: true,
|
||||
keyUsages: ["deriveBits"],
|
||||
},
|
||||
publicKey: {
|
||||
format: "spki" as KeyFormat,
|
||||
data: Convert.FromBase64("MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEOGeN2z+3eX1BSAaKywNaQRU8Ay2+lwOyfO9VVMMruuKvC+aonVe4gWStz/vZu3jDEFptHa1j76xLMxPuIxLEuByGwXrnbgVPukeOjq7/lelV1NYQFyknTBWTgs3WwxZR"),
|
||||
algorithm: {
|
||||
name: "ECDH",
|
||||
namedCurve: "P-384",
|
||||
} as EcKeyImportParams,
|
||||
extractable: true,
|
||||
keyUsages: [],
|
||||
},
|
||||
},
|
||||
data: Convert.FromBase64("2EKT/nmV68wIXFMZiCv4CyOEhWzpwdQ5"),
|
||||
algorithm: {
|
||||
name: "ECDH",
|
||||
},
|
||||
length: 192,
|
||||
},
|
||||
{
|
||||
name: "P-521 256",
|
||||
key: {
|
||||
privateKey: {
|
||||
format: "pkcs8" as KeyFormat,
|
||||
data: Convert.FromBase64("MIHuAgEAMBAGByqGSM49AgEGBSuBBAAjBIHWMIHTAgEBBEIB6PyCXpJ4TWPpwlGAmayLz5ecYHT+1ilxD64HytpTaViUS72sEzG1JMApD31+STX0zeVcARfG+yh71dXLCTlqqHGhgYkDgYYABADgIblBbth8vnOZt/HLU9VdUJHmenwRRADVZWL+P5IeCDQs6B87API41R3+91xFDHnjst9VKksYl/NJIIfl6b9cmABO6z80mTz3+0klquIpSQLidK2aFaFbqiGnMdCO+AZfwxu2qBx+1f5MwbHXUW5HXsfmEvzBUC9xCQKLpQ8oZYBrSg=="),
|
||||
algorithm: {
|
||||
name: "ECDH",
|
||||
namedCurve: "P-521",
|
||||
} as EcKeyImportParams,
|
||||
extractable: true,
|
||||
keyUsages: ["deriveBits"],
|
||||
},
|
||||
publicKey: {
|
||||
format: "spki" as KeyFormat,
|
||||
data: Convert.FromBase64("MIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQA4CG5QW7YfL5zmbfxy1PVXVCR5np8EUQA1WVi/j+SHgg0LOgfOwDyONUd/vdcRQx547LfVSpLGJfzSSCH5em/XJgATus/NJk89/tJJariKUkC4nStmhWhW6ohpzHQjvgGX8MbtqgcftX+TMGx11FuR17H5hL8wVAvcQkCi6UPKGWAa0o="),
|
||||
algorithm: {
|
||||
name: "ECDH",
|
||||
namedCurve: "P-521",
|
||||
} as EcKeyImportParams,
|
||||
extractable: true,
|
||||
keyUsages: [],
|
||||
},
|
||||
},
|
||||
data: Convert.FromBase64("AS2ene28pmWYdJwW6dyTXUe1eq1p2i8QEIo/rXSiJRo="),
|
||||
algorithm: {
|
||||
name: "ECDH",
|
||||
},
|
||||
length: 256,
|
||||
},
|
||||
{
|
||||
name: "K-256 128",
|
||||
key: {
|
||||
privateKey: {
|
||||
format: "pkcs8" as KeyFormat,
|
||||
data: Convert.FromBase64("MIGEAgEAMBAGByqGSM49AgEGBSuBBAAKBG0wawIBAQQghgLhhrz/EYuB0G08/UoM5nV9jS7Pl/rtIcXeJkc2b3uhRANCAARgMfEiAPcF7pmEuLRGRRFXEKSwcJwqURKK/Pqo8MaqU0cl7eNQmLJ7mFpBtTDY8hr9xxJeIP9sI/u83A1F5ag7"),
|
||||
algorithm: {
|
||||
name: "ECDH",
|
||||
namedCurve: "K-256",
|
||||
} as EcKeyImportParams,
|
||||
extractable: true,
|
||||
keyUsages: ["deriveBits"],
|
||||
},
|
||||
publicKey: {
|
||||
format: "spki" as KeyFormat,
|
||||
data: Convert.FromBase64("MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEYDHxIgD3Be6ZhLi0RkURVxCksHCcKlESivz6qPDGqlNHJe3jUJiye5haQbUw2PIa/ccSXiD/bCP7vNwNReWoOw=="),
|
||||
algorithm: {
|
||||
name: "ECDH",
|
||||
namedCurve: "K-256",
|
||||
} as EcKeyImportParams,
|
||||
extractable: true,
|
||||
keyUsages: [],
|
||||
},
|
||||
},
|
||||
data: Convert.FromBase64("3+2JX3D4/veBGJXnvU+aTg=="),
|
||||
algorithm: {
|
||||
name: "ECDH",
|
||||
},
|
||||
length: 128,
|
||||
},
|
||||
],
|
||||
deriveKey: [
|
||||
{
|
||||
name: "P-256 128",
|
||||
key: {
|
||||
privateKey: {
|
||||
format: "pkcs8" as KeyFormat,
|
||||
data: Convert.FromBase64("MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgQA7bkTNYlIYVb9+DavBlJ3b08f0892or3XwfscA3tLGhRANCAARzsy+ZcbrNchF7SrpL0hYnGp6ICX77jXUrpMYkq0BuzfaPFWcu9YZH5ASUzQJGz9eCK3mDXEbLCuiHRw3dwkFs"),
|
||||
algorithm: {
|
||||
name: "ECDH",
|
||||
namedCurve: "P-256",
|
||||
} as EcKeyImportParams,
|
||||
extractable: true,
|
||||
keyUsages: ["deriveKey"],
|
||||
},
|
||||
publicKey: {
|
||||
format: "spki" as KeyFormat,
|
||||
data: Convert.FromBase64("MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEc7MvmXG6zXIRe0q6S9IWJxqeiAl++411K6TGJKtAbs32jxVnLvWGR+QElM0CRs/Xgit5g1xGywroh0cN3cJBbA=="),
|
||||
algorithm: {
|
||||
name: "ECDH",
|
||||
namedCurve: "P-256",
|
||||
} as EcKeyImportParams,
|
||||
extractable: true,
|
||||
keyUsages: [],
|
||||
},
|
||||
},
|
||||
algorithm: {
|
||||
name: "ECDH",
|
||||
},
|
||||
derivedKeyType: {
|
||||
name: "AES-CBC",
|
||||
length: 128,
|
||||
} as AesKeyAlgorithm,
|
||||
keyUsages: ["encrypt", "decrypt"],
|
||||
format: "raw",
|
||||
keyData: Convert.FromBase64("Jlc1/Zqi/8mH1oQT8+YfCA=="),
|
||||
},
|
||||
{
|
||||
name: "P-384 192",
|
||||
key: {
|
||||
privateKey: {
|
||||
format: "pkcs8" as KeyFormat,
|
||||
data: Convert.FromBase64("MIG2AgEAMBAGByqGSM49AgEGBSuBBAAiBIGeMIGbAgEBBDAFOXcWxQ+YqPdUqc9Iar3ZDf012ZtQAFajBMApKpd2WPQccBmyPzvDZJSWKe3d5jShZANiAAQ4Z43bP7d5fUFIBorLA1pBFTwDLb6XA7J871VUwyu64q8L5qidV7iBZK3P+9m7eMMQWm0drWPvrEszE+4jEsS4HIbBeuduBU+6R46Orv+V6VXU1hAXKSdMFZOCzdbDFlE="),
|
||||
algorithm: {
|
||||
name: "ECDH",
|
||||
namedCurve: "P-384",
|
||||
} as EcKeyImportParams,
|
||||
extractable: true,
|
||||
keyUsages: ["deriveKey"],
|
||||
},
|
||||
publicKey: {
|
||||
format: "spki" as KeyFormat,
|
||||
data: Convert.FromBase64("MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEOGeN2z+3eX1BSAaKywNaQRU8Ay2+lwOyfO9VVMMruuKvC+aonVe4gWStz/vZu3jDEFptHa1j76xLMxPuIxLEuByGwXrnbgVPukeOjq7/lelV1NYQFyknTBWTgs3WwxZR"),
|
||||
algorithm: {
|
||||
name: "ECDH",
|
||||
namedCurve: "P-384",
|
||||
} as EcKeyImportParams,
|
||||
extractable: true,
|
||||
keyUsages: [],
|
||||
},
|
||||
},
|
||||
algorithm: {
|
||||
name: "ECDH",
|
||||
},
|
||||
derivedKeyType: {
|
||||
name: "AES-GCM",
|
||||
length: 192,
|
||||
} as AesKeyAlgorithm,
|
||||
keyUsages: ["encrypt", "decrypt"],
|
||||
format: "raw",
|
||||
keyData: Convert.FromBase64("2EKT/nmV68wIXFMZiCv4CyOEhWzpwdQ5"),
|
||||
},
|
||||
{
|
||||
name: "P-521 256",
|
||||
key: {
|
||||
privateKey: {
|
||||
format: "pkcs8" as KeyFormat,
|
||||
data: Convert.FromBase64("MIHuAgEAMBAGByqGSM49AgEGBSuBBAAjBIHWMIHTAgEBBEIB6PyCXpJ4TWPpwlGAmayLz5ecYHT+1ilxD64HytpTaViUS72sEzG1JMApD31+STX0zeVcARfG+yh71dXLCTlqqHGhgYkDgYYABADgIblBbth8vnOZt/HLU9VdUJHmenwRRADVZWL+P5IeCDQs6B87API41R3+91xFDHnjst9VKksYl/NJIIfl6b9cmABO6z80mTz3+0klquIpSQLidK2aFaFbqiGnMdCO+AZfwxu2qBx+1f5MwbHXUW5HXsfmEvzBUC9xCQKLpQ8oZYBrSg=="),
|
||||
algorithm: {
|
||||
name: "ECDH",
|
||||
namedCurve: "P-521",
|
||||
} as EcKeyImportParams,
|
||||
extractable: true,
|
||||
keyUsages: ["deriveKey"],
|
||||
},
|
||||
publicKey: {
|
||||
format: "spki" as KeyFormat,
|
||||
data: Convert.FromBase64("MIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQA4CG5QW7YfL5zmbfxy1PVXVCR5np8EUQA1WVi/j+SHgg0LOgfOwDyONUd/vdcRQx547LfVSpLGJfzSSCH5em/XJgATus/NJk89/tJJariKUkC4nStmhWhW6ohpzHQjvgGX8MbtqgcftX+TMGx11FuR17H5hL8wVAvcQkCi6UPKGWAa0o="),
|
||||
algorithm: {
|
||||
name: "ECDH",
|
||||
namedCurve: "P-521",
|
||||
} as EcKeyImportParams,
|
||||
extractable: true,
|
||||
keyUsages: [],
|
||||
},
|
||||
},
|
||||
algorithm: {
|
||||
name: "ECDH",
|
||||
},
|
||||
derivedKeyType: {
|
||||
name: "AES-CTR",
|
||||
length: 256,
|
||||
} as AesKeyAlgorithm,
|
||||
keyUsages: ["encrypt", "decrypt"],
|
||||
format: "raw",
|
||||
keyData: Convert.FromBase64("AS2ene28pmWYdJwW6dyTXUe1eq1p2i8QEIo/rXSiJRo="),
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
});
|
374
test/helper.ts
374
test/helper.ts
|
@ -1,374 +0,0 @@
|
|||
import assert from "assert";
|
||||
import { Convert } from "pvtsutils";
|
||||
import { Crypto, CryptoKey } from "webcrypto-core";
|
||||
|
||||
/**
|
||||
* Returns true if blobs from keys are equal
|
||||
* @param a Crypto key
|
||||
* @param b Crypto key
|
||||
*/
|
||||
export function isKeyEqual(a: CryptoKey, b: CryptoKey) {
|
||||
if (a instanceof CryptoKey && b instanceof CryptoKey) {
|
||||
return (a as any).data.equals((b as any).data);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export interface ITestAction {
|
||||
name?: string;
|
||||
only?: boolean;
|
||||
skip?: boolean;
|
||||
error?: any;
|
||||
}
|
||||
|
||||
export interface ITestGenerateKeyAction extends ITestAction {
|
||||
algorithm: Algorithm;
|
||||
extractable: boolean;
|
||||
keyUsages: KeyUsage[];
|
||||
}
|
||||
|
||||
export interface IImportKeyParams {
|
||||
format: KeyFormat;
|
||||
data: JsonWebKey | BufferSource;
|
||||
algorithm: AlgorithmIdentifier;
|
||||
extractable: boolean;
|
||||
keyUsages: KeyUsage[];
|
||||
}
|
||||
|
||||
export interface IImportKeyPairParams {
|
||||
privateKey: IImportKeyParams;
|
||||
publicKey: IImportKeyParams;
|
||||
}
|
||||
|
||||
export interface ITestEncryptAction extends ITestAction {
|
||||
algorithm: Algorithm;
|
||||
data: BufferSource;
|
||||
encData: BufferSource;
|
||||
key: IImportKeyParams | IImportKeyPairParams;
|
||||
}
|
||||
|
||||
export interface ITestSignAction extends ITestAction {
|
||||
algorithm: Algorithm;
|
||||
data: BufferSource;
|
||||
signature: BufferSource;
|
||||
key: IImportKeyParams | IImportKeyPairParams;
|
||||
}
|
||||
|
||||
export interface ITestDeriveBitsAction extends ITestAction {
|
||||
algorithm: Algorithm;
|
||||
key: IImportKeyParams | IImportKeyPairParams;
|
||||
data: BufferSource;
|
||||
length: number;
|
||||
}
|
||||
|
||||
export interface ITestDeriveKeyAction extends ITestAction {
|
||||
algorithm: Algorithm;
|
||||
key: IImportKeyParams | IImportKeyPairParams;
|
||||
derivedKeyType: Algorithm;
|
||||
keyUsages: KeyUsage[];
|
||||
format: KeyFormat;
|
||||
keyData: BufferSource | JsonWebKey;
|
||||
}
|
||||
|
||||
export interface ITestWrapKeyAction extends ITestAction {
|
||||
key: IImportKeyParams | IImportKeyPairParams;
|
||||
algorithm: Algorithm;
|
||||
wKey: IImportKeyParams;
|
||||
wrappedKey?: BufferSource;
|
||||
}
|
||||
|
||||
export interface ITestImportAction extends IImportKeyParams, ITestAction {
|
||||
}
|
||||
|
||||
export interface ITestDigestAction extends ITestAction {
|
||||
algorithm: AlgorithmIdentifier;
|
||||
data: BufferSource;
|
||||
hash: BufferSource;
|
||||
}
|
||||
|
||||
export interface ITestActions {
|
||||
generateKey?: ITestGenerateKeyAction[];
|
||||
encrypt?: ITestEncryptAction[];
|
||||
wrapKey?: ITestWrapKeyAction[];
|
||||
sign?: ITestSignAction[];
|
||||
import?: ITestImportAction[];
|
||||
deriveBits?: ITestDeriveBitsAction[];
|
||||
deriveKey?: ITestDeriveKeyAction[];
|
||||
digest?: ITestDigestAction[];
|
||||
}
|
||||
|
||||
export interface ITestParams {
|
||||
name: string;
|
||||
only?: boolean;
|
||||
actions: ITestActions;
|
||||
}
|
||||
|
||||
async function getKeys(crypto: Crypto, key: IImportKeyParams | IImportKeyPairParams) {
|
||||
const keys = {} as CryptoKeyPair;
|
||||
if ("privateKey" in key) {
|
||||
keys.privateKey = await crypto.subtle.importKey(
|
||||
key.privateKey.format,
|
||||
key.privateKey.data,
|
||||
key.privateKey.algorithm,
|
||||
key.privateKey.extractable,
|
||||
key.privateKey.keyUsages);
|
||||
keys.publicKey = await crypto.subtle.importKey(
|
||||
key.publicKey.format,
|
||||
key.publicKey.data,
|
||||
key.publicKey.algorithm,
|
||||
key.publicKey.extractable,
|
||||
key.publicKey.keyUsages);
|
||||
} else {
|
||||
keys.privateKey = keys.publicKey = await crypto.subtle.importKey(
|
||||
key.format,
|
||||
key.data,
|
||||
key.algorithm,
|
||||
key.extractable,
|
||||
key.keyUsages);
|
||||
}
|
||||
|
||||
return keys;
|
||||
}
|
||||
|
||||
async function wrapTest(promise: () => Promise<void>, action: ITestAction, index: number) {
|
||||
const test = action.skip
|
||||
? it.skip
|
||||
: action.only
|
||||
? it.only
|
||||
: it;
|
||||
|
||||
test(action.name || `#${index + 1}`, async () => {
|
||||
if (action.error) {
|
||||
await assert.rejects(promise(), action.error);
|
||||
} else {
|
||||
await promise();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export function testCrypto(crypto: Crypto, params: ITestParams[]) {
|
||||
params.forEach((param) => {
|
||||
context(param.name, () => {
|
||||
//#region Generate key
|
||||
const generateKey = param.actions.generateKey;
|
||||
if (generateKey) {
|
||||
context("Generate Key", () => {
|
||||
generateKey.forEach((action, index) => {
|
||||
wrapTest(async () => {
|
||||
const algorithm = Object.assign({}, action.algorithm);
|
||||
algorithm.name = algorithm.name.toLowerCase();
|
||||
|
||||
const key = await crypto.subtle.generateKey(
|
||||
algorithm,
|
||||
action.extractable,
|
||||
action.keyUsages,
|
||||
);
|
||||
|
||||
assert(key);
|
||||
if (key instanceof CryptoKey) {
|
||||
assert.equal(key.algorithm.name, action.algorithm.name, "Algorithm name MUST be equal to incoming algorithm and in the same case");
|
||||
assert.equal(key.extractable, action.extractable);
|
||||
assert.deepEqual(key.usages, action.keyUsages);
|
||||
} else {
|
||||
assert(key.privateKey);
|
||||
assert.equal(key.privateKey.algorithm.name, action.algorithm.name, "Algorithm name MUST be equal to incoming algorithm and in the same case");
|
||||
assert.equal(key.privateKey.extractable, action.extractable);
|
||||
|
||||
assert(key.publicKey);
|
||||
assert.equal(key.publicKey.algorithm.name, action.algorithm.name, "Algorithm name MUST be equal to incoming algorithm and in the same case");
|
||||
assert.equal(key.publicKey.extractable, true);
|
||||
}
|
||||
}, action, index);
|
||||
});
|
||||
});
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//#region encrypt
|
||||
const encrypt = param.actions.encrypt;
|
||||
if (encrypt) {
|
||||
context("Encrypt/Decrypt", () => {
|
||||
encrypt.forEach((action, index) => {
|
||||
wrapTest(async () => {
|
||||
// import keys
|
||||
const keys = await getKeys(crypto, action.key);
|
||||
const encKey = keys.publicKey;
|
||||
const decKey = keys.privateKey;
|
||||
|
||||
const algorithm = Object.assign({}, action.algorithm);
|
||||
algorithm.name = algorithm.name.toLowerCase();
|
||||
|
||||
// encrypt
|
||||
const enc = await crypto.subtle.encrypt(algorithm, encKey, action.data);
|
||||
|
||||
// decrypt
|
||||
let dec = await crypto.subtle.decrypt(algorithm, decKey, enc);
|
||||
assert.equal(Convert.ToHex(dec), Convert.ToHex(action.data));
|
||||
|
||||
dec = await crypto.subtle.decrypt(algorithm, decKey, action.encData);
|
||||
assert.equal(Convert.ToHex(dec), Convert.ToHex(action.data));
|
||||
}, action, index);
|
||||
});
|
||||
});
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//#region Import/Export
|
||||
const importFn = param.actions.import;
|
||||
if (importFn) {
|
||||
context("Import/Export", () => {
|
||||
importFn.forEach((action, index) => {
|
||||
wrapTest(async () => {
|
||||
const importedKey = await crypto.subtle.importKey(
|
||||
action.format,
|
||||
action.data,
|
||||
action.algorithm,
|
||||
action.extractable,
|
||||
action.keyUsages);
|
||||
|
||||
// Can't continue if key is not extractable.
|
||||
if (!action.extractable) {
|
||||
return;
|
||||
}
|
||||
|
||||
const exportedData = await crypto.subtle.exportKey(
|
||||
action.format,
|
||||
importedKey);
|
||||
|
||||
if (action.format === "jwk") {
|
||||
assert.deepEqual(exportedData, action.data);
|
||||
} else {
|
||||
assert.equal(Buffer.from(exportedData as ArrayBuffer).toString("hex"), Buffer.from(action.data as ArrayBuffer).toString("hex"));
|
||||
}
|
||||
}, action, index);
|
||||
});
|
||||
});
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//#region Sign/Verify
|
||||
const sign = param.actions.sign;
|
||||
if (sign) {
|
||||
context("Sign/Verify", () => {
|
||||
sign.forEach((action, index) => {
|
||||
wrapTest(async () => {
|
||||
// import keys
|
||||
const keys = await getKeys(crypto, action.key);
|
||||
const verifyKey = keys.publicKey;
|
||||
const signKey = keys.privateKey;
|
||||
|
||||
const algorithm = Object.assign({}, action.algorithm);
|
||||
algorithm.name = algorithm.name.toLowerCase();
|
||||
|
||||
// sign
|
||||
const signature = await crypto.subtle.sign(algorithm, signKey, action.data);
|
||||
|
||||
// verify
|
||||
let ok = await crypto.subtle.verify(algorithm, verifyKey, signature, action.data);
|
||||
assert.equal(true, ok, "Cannot verify signature from Action data");
|
||||
|
||||
ok = await crypto.subtle.verify(algorithm, verifyKey, action.signature, action.data);
|
||||
if (!ok) {
|
||||
assert.equal(Convert.ToHex(signature), Convert.ToHex(action.signature));
|
||||
}
|
||||
assert.equal(true, ok);
|
||||
}, action, index);
|
||||
});
|
||||
});
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//#region Derive bits
|
||||
const deriveBits = param.actions.deriveBits;
|
||||
if (deriveBits) {
|
||||
context("Derive bits", () => {
|
||||
deriveBits.forEach((action, index) => {
|
||||
wrapTest(async () => {
|
||||
// import keys
|
||||
const keys = await getKeys(crypto, action.key);
|
||||
|
||||
const algorithm = Object.assign({}, action.algorithm, { public: keys.publicKey }) as any;
|
||||
algorithm.name = algorithm.name.toLowerCase();
|
||||
|
||||
// derive bits
|
||||
const derivedBits = await crypto.subtle.deriveBits(algorithm, keys.privateKey, action.length);
|
||||
assert.equal(Convert.ToHex(derivedBits), Convert.ToHex(action.data));
|
||||
}, action, index);
|
||||
});
|
||||
});
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//#region Derive key
|
||||
const deriveKey = param.actions.deriveKey;
|
||||
if (deriveKey) {
|
||||
context("Derive key", () => {
|
||||
deriveKey.forEach((action, index) => {
|
||||
wrapTest(async () => {
|
||||
// import keys
|
||||
const keys = await getKeys(crypto, action.key);
|
||||
|
||||
const algorithm = Object.assign({}, action.algorithm, { public: keys.publicKey }) as any;
|
||||
algorithm.name = algorithm.name.toLowerCase();
|
||||
|
||||
// derive key
|
||||
const derivedKey = await crypto.subtle.deriveKey(algorithm, keys.privateKey, action.derivedKeyType, true, action.keyUsages);
|
||||
const keyData = await crypto.subtle.exportKey(action.format, derivedKey);
|
||||
if (action.format === "jwk") {
|
||||
assert.deepEqual(keyData, action.keyData);
|
||||
} else {
|
||||
assert.equal(Convert.ToHex(keyData as ArrayBuffer), Convert.ToHex(action.keyData as ArrayBuffer));
|
||||
}
|
||||
}, action, index);
|
||||
});
|
||||
});
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//#region Digest
|
||||
const digest = param.actions.digest;
|
||||
if (digest) {
|
||||
context("Digest", () => {
|
||||
digest.forEach((action, index) => {
|
||||
wrapTest(async () => {
|
||||
const hash = await crypto.subtle.digest(action.algorithm, action.data);
|
||||
assert.equal(Convert.ToHex(hash), Convert.ToHex(action.hash));
|
||||
}, action, index);
|
||||
});
|
||||
});
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//#region Wrap/Unwrap key
|
||||
const wrapKey = param.actions.wrapKey;
|
||||
if (wrapKey) {
|
||||
context("Wrap/Unwrap key", () => {
|
||||
wrapKey.forEach((action, index) => {
|
||||
wrapTest(async () => {
|
||||
const wKey = (await getKeys(crypto, action.wKey)).privateKey;
|
||||
const key = await getKeys(crypto, action.key);
|
||||
|
||||
const wrappedKey = await crypto.subtle.wrapKey(action.wKey.format, wKey, key.publicKey, action.algorithm);
|
||||
|
||||
if (action.wrappedKey) {
|
||||
assert.equal(Convert.ToHex(wrappedKey), Convert.ToHex(action.wrappedKey));
|
||||
}
|
||||
|
||||
const unwrappedKey = await crypto.subtle.unwrapKey(
|
||||
action.wKey.format,
|
||||
wrappedKey,
|
||||
key.privateKey,
|
||||
action.algorithm,
|
||||
action.wKey.algorithm,
|
||||
action.wKey.extractable,
|
||||
action.wKey.keyUsages);
|
||||
|
||||
assert.deepEqual(unwrappedKey.algorithm, wKey.algorithm);
|
||||
}, action, index);
|
||||
});
|
||||
});
|
||||
}
|
||||
//#endregion
|
||||
});
|
||||
});
|
||||
}
|
86
test/hkdf.ts
86
test/hkdf.ts
|
@ -1,86 +0,0 @@
|
|||
import { Crypto } from "../src";
|
||||
import { testCrypto } from "./helper";
|
||||
|
||||
context("HKDF", () => {
|
||||
|
||||
const crypto = new Crypto();
|
||||
|
||||
testCrypto(crypto, [
|
||||
{
|
||||
name: "HKDF",
|
||||
actions: {
|
||||
import: [
|
||||
{
|
||||
name: "raw",
|
||||
format: "raw",
|
||||
data: Buffer.from("0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b", "hex"),
|
||||
algorithm: {
|
||||
name: "HKDF",
|
||||
},
|
||||
extractable: false,
|
||||
keyUsages: ["deriveBits", "deriveKey"],
|
||||
},
|
||||
],
|
||||
deriveBits: [
|
||||
{
|
||||
key: {
|
||||
format: "raw",
|
||||
data: Buffer.from("0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b", "hex"),
|
||||
algorithm: {
|
||||
name: "HKDF",
|
||||
},
|
||||
extractable: false,
|
||||
keyUsages: ["deriveBits"],
|
||||
},
|
||||
algorithm: {
|
||||
name: "HKDF",
|
||||
hash: {name: "SHA-256"},
|
||||
salt: Buffer.from("000102030405060708090a0b0c", "hex"),
|
||||
info: Buffer.from("f0f1f2f3f4f5f6f7f8f9", "hex"),
|
||||
} as HkdfParams,
|
||||
data: Buffer.from("3cb25f25faacd57a90434f64d0362f2a2d2d0a90cf1a5a4c5db02d56ecc4c5bf34007208d5b887185865", "hex"),
|
||||
length: 42 * 8,
|
||||
},
|
||||
{
|
||||
key: {
|
||||
format: "raw",
|
||||
data: Buffer.from("000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f", "hex"),
|
||||
algorithm: {
|
||||
name: "HKDF",
|
||||
},
|
||||
extractable: false,
|
||||
keyUsages: ["deriveBits"],
|
||||
},
|
||||
algorithm: {
|
||||
name: "HKDF",
|
||||
hash: "SHA-256",
|
||||
salt: Buffer.from("606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeaf", "hex"),
|
||||
info: Buffer.from("b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff", "hex"),
|
||||
} as HkdfParams,
|
||||
data: Buffer.from("b11e398dc80327a1c8e7f78c596a49344f012eda2d4efad8a050cc4c19afa97c59045a99cac7827271cb41c65e590e09da3275600c2f09b8367793a9aca3db71cc30c58179ec3e87c14c01d5c1f3434f1d87", "hex"),
|
||||
length: 82 * 8,
|
||||
},
|
||||
{
|
||||
key: {
|
||||
format: "raw",
|
||||
data: Buffer.from("0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b", "hex"),
|
||||
algorithm: {
|
||||
name: "HKDF",
|
||||
},
|
||||
extractable: false,
|
||||
keyUsages: ["deriveBits"],
|
||||
},
|
||||
algorithm: {
|
||||
name: "HKDF",
|
||||
hash: "SHA-256",
|
||||
salt: Buffer.from([]),
|
||||
info: Buffer.from([]),
|
||||
} as HkdfParams,
|
||||
data: Buffer.from("8da4e775a563c18f715f802a063c5a31b8a11f5c5ee1879ec3454e5f3c738d2d9d201395faa4b61a96c8", "hex"),
|
||||
length: 42 * 8,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
]);
|
||||
});
|
177
test/hmac.ts
177
test/hmac.ts
|
@ -1,177 +0,0 @@
|
|||
import { Convert } from "pvtsutils";
|
||||
import { Crypto } from "../src";
|
||||
import { ITestGenerateKeyAction, testCrypto } from "./helper";
|
||||
|
||||
context("HMAC", () => {
|
||||
|
||||
const crypto = new Crypto();
|
||||
|
||||
testCrypto(crypto, [
|
||||
{
|
||||
name: "HMAC",
|
||||
actions: {
|
||||
generateKey: [
|
||||
{
|
||||
name: "default length",
|
||||
algorithm: {
|
||||
name: "HMAC",
|
||||
hash: "SHA-256",
|
||||
} as HmacKeyGenParams,
|
||||
extractable: true,
|
||||
keyUsages: ["sign", "verify"],
|
||||
},
|
||||
...["SHA-1", "SHA-256", "SHA-384", "SHA-512"].map((hash) => {
|
||||
return {
|
||||
name: hash,
|
||||
algorithm: {
|
||||
name: "HMAC",
|
||||
hash,
|
||||
length: 128,
|
||||
},
|
||||
extractable: true,
|
||||
keyUsages: ["sign", "verify"],
|
||||
} as ITestGenerateKeyAction;
|
||||
}),
|
||||
{
|
||||
name: "length:160",
|
||||
algorithm: {
|
||||
name: "HMAC",
|
||||
hash: "SHA-256",
|
||||
length: 160,
|
||||
},
|
||||
extractable: true,
|
||||
keyUsages: ["sign", "verify"],
|
||||
} as ITestGenerateKeyAction,
|
||||
],
|
||||
sign: [
|
||||
{
|
||||
name: "HMAC-SHA256 with length param which is less than hash size",
|
||||
key: {
|
||||
format: "raw",
|
||||
data: new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6]),
|
||||
algorithm: {
|
||||
name: "HMAC",
|
||||
hash: "SHA-256",
|
||||
length: 128,
|
||||
} as HmacImportParams,
|
||||
extractable: false,
|
||||
keyUsages: ["sign", "verify"],
|
||||
},
|
||||
algorithm: { name: "HMAC" },
|
||||
data: new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]),
|
||||
signature: Convert.FromBase64("9yMF9ReX1EhdBWTRjSR+AC21NA05H9W8vx0HZGVmgNc="),
|
||||
},
|
||||
{
|
||||
name: "HMAC-SHA256 without length param",
|
||||
key: {
|
||||
format: "raw",
|
||||
data: new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6]),
|
||||
algorithm: {
|
||||
name: "HMAC",
|
||||
hash: "SHA-256",
|
||||
} as HmacImportParams,
|
||||
extractable: false,
|
||||
keyUsages: ["sign", "verify"],
|
||||
},
|
||||
algorithm: { name: "HMAC" },
|
||||
data: new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]),
|
||||
signature: Convert.FromHex("ad05febab44cd369e27433bbf00e63e6271f6a350614bec453f5d0efd6503a31"),
|
||||
},
|
||||
],
|
||||
import: [
|
||||
{ // JWK SHA-1
|
||||
name: "JWK SHA-1",
|
||||
format: "jwk",
|
||||
data: {
|
||||
alg: "HS1",
|
||||
ext: true,
|
||||
k: "AQIDBAUGBwgJAAECAwQFBg",
|
||||
key_ops: ["sign", "verify"],
|
||||
kty: "oct",
|
||||
},
|
||||
algorithm: {
|
||||
name: "HMAC",
|
||||
hash: "SHA-1",
|
||||
length: 128,
|
||||
} as HmacImportParams,
|
||||
extractable: true,
|
||||
keyUsages: ["sign", "verify"],
|
||||
},
|
||||
{ // JWK SHA-256
|
||||
name: "JWK SHA-256",
|
||||
format: "jwk",
|
||||
data: {
|
||||
alg: "HS256",
|
||||
ext: true,
|
||||
k: "AQIDBAUGBwgJAAECAwQFBg",
|
||||
key_ops: ["sign", "verify"],
|
||||
kty: "oct",
|
||||
},
|
||||
algorithm: {
|
||||
name: "HMAC",
|
||||
hash: "SHA-256",
|
||||
} as HmacImportParams,
|
||||
extractable: true,
|
||||
keyUsages: ["sign", "verify"],
|
||||
},
|
||||
{ // JWK SHA-384
|
||||
name: "JWK SHA-384",
|
||||
format: "jwk",
|
||||
data: {
|
||||
alg: "HS384",
|
||||
ext: true,
|
||||
k: "AQIDBAUGBwgJAAECAwQFBg",
|
||||
key_ops: ["sign", "verify"],
|
||||
kty: "oct",
|
||||
},
|
||||
algorithm: {
|
||||
name: "HMAC",
|
||||
hash: "SHA-384",
|
||||
} as HmacImportParams,
|
||||
extractable: true,
|
||||
keyUsages: ["sign", "verify"],
|
||||
},
|
||||
{ // JWK SHA-512
|
||||
name: "JWK SHA-512",
|
||||
format: "jwk",
|
||||
data: {
|
||||
alg: "HS512",
|
||||
ext: true,
|
||||
k: "AQIDBAUGBwgJAAECAwQFBg",
|
||||
key_ops: ["sign", "verify"],
|
||||
kty: "oct",
|
||||
},
|
||||
algorithm: {
|
||||
name: "HMAC",
|
||||
hash: "SHA-512",
|
||||
} as HmacImportParams,
|
||||
extractable: true,
|
||||
keyUsages: ["sign", "verify"],
|
||||
},
|
||||
{ // raw 128
|
||||
name: "raw 128",
|
||||
format: "raw",
|
||||
data: Convert.FromBase64("AQIDBAUGBwgJAAECAwQFBg"),
|
||||
algorithm: {
|
||||
name: "HMAC",
|
||||
hash: "SHA-512",
|
||||
} as HmacImportParams,
|
||||
extractable: true,
|
||||
keyUsages: ["sign", "verify"],
|
||||
},
|
||||
{ // raw 160
|
||||
name: "raw 160",
|
||||
format: "raw",
|
||||
data: new Uint8Array(20),
|
||||
algorithm: {
|
||||
name: "HMAC",
|
||||
hash: "SHA-512",
|
||||
} as HmacImportParams,
|
||||
extractable: true,
|
||||
keyUsages: ["sign", "verify"],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
]);
|
||||
});
|
|
@ -1,63 +0,0 @@
|
|||
import { Convert } from "pvtsutils";
|
||||
import { Crypto } from "../src";
|
||||
import { testCrypto } from "./helper";
|
||||
|
||||
context("PBKDF", () => {
|
||||
|
||||
const crypto = new Crypto();
|
||||
|
||||
testCrypto(crypto, [
|
||||
{
|
||||
name: "PBKDF2",
|
||||
actions: {
|
||||
deriveBits: [
|
||||
{
|
||||
key: {
|
||||
format: "raw",
|
||||
data: new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]),
|
||||
algorithm: {
|
||||
name: "PBKDF2",
|
||||
},
|
||||
extractable: false,
|
||||
keyUsages: ["deriveBits"],
|
||||
},
|
||||
algorithm: {
|
||||
name: "PBKDF2",
|
||||
salt: new Uint8Array([1, 2, 3, 4]),
|
||||
hash: "SHA-256",
|
||||
iterations: 1000,
|
||||
} as Pbkdf2Params,
|
||||
data: Convert.FromBase64("3GK58/4RT+UPLooz5HT1MQ=="),
|
||||
length: 128,
|
||||
},
|
||||
],
|
||||
deriveKey: [
|
||||
{
|
||||
key: {
|
||||
format: "raw",
|
||||
data: new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]),
|
||||
algorithm: {
|
||||
name: "PBKDF2",
|
||||
},
|
||||
extractable: false,
|
||||
keyUsages: ["deriveKey"],
|
||||
},
|
||||
algorithm: {
|
||||
name: "PBKDF2",
|
||||
salt: new Uint8Array([1, 2, 3, 4]),
|
||||
hash: "SHA-256",
|
||||
iterations: 1000,
|
||||
} as Pbkdf2Params,
|
||||
derivedKeyType: {
|
||||
name: "AES-CBC",
|
||||
length: 128,
|
||||
} as AesDerivedKeyParams,
|
||||
keyUsages: ["encrypt"],
|
||||
format: "raw",
|
||||
keyData: Convert.FromBase64("3GK58/4RT+UPLooz5HT1MQ=="),
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
]);
|
||||
});
|
367
test/rsa.ts
367
test/rsa.ts
|
@ -1,367 +0,0 @@
|
|||
import { Convert } from "pvtsutils";
|
||||
import { Crypto } from "../src";
|
||||
import { ITestGenerateKeyAction, testCrypto } from "./helper";
|
||||
|
||||
context("RSA", () => {
|
||||
|
||||
const crypto = new Crypto();
|
||||
|
||||
testCrypto(crypto, [
|
||||
// RSASSA-PKCS1-v1_5
|
||||
{
|
||||
name: "RSASSA-PKCS1-v1_5",
|
||||
actions: {
|
||||
generateKey: ["SHA-1", "SHA-256", "SHA-384", "SHA-512"].map((hash) => {
|
||||
return {
|
||||
name: hash,
|
||||
algorithm: {
|
||||
name: "RSASSA-PKCS1-v1_5",
|
||||
hash,
|
||||
publicExponent: new Uint8Array([1, 0, 1]),
|
||||
modulusLength: 1024,
|
||||
} as RsaHashedKeyGenParams,
|
||||
extractable: false,
|
||||
keyUsages: ["sign", "verify"],
|
||||
} as ITestGenerateKeyAction;
|
||||
}),
|
||||
sign: [
|
||||
{
|
||||
algorithm: {
|
||||
name: "RSASSA-PKCS1-v1_5",
|
||||
},
|
||||
data: new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]),
|
||||
signature: Convert.FromBase64("f8OvbYnwX5YPVPjWkOTalYTFJjS1Ks7iNmPdLEby/kK6BEGk5uPvY/ebcok6sTQpQXJXJFJbOcMrZftmJXpm1szcgOdNgVW6FDc3722a9Mzvk/YfvNUCQRNEMON9lYKdpOLSXAFpXR5ovZytbFQ2w2ztpKkJvNY2QZQlizcZKSg="),
|
||||
key: {
|
||||
publicKey: {
|
||||
format: "jwk" as KeyFormat,
|
||||
algorithm: { name: "RSASSA-PKCS1-v1_5", hash: "SHA-256" } as RsaHashedImportParams,
|
||||
data: {
|
||||
alg: "RS256",
|
||||
e: "AQAB",
|
||||
ext: true,
|
||||
key_ops: ["verify"],
|
||||
kty: "RSA",
|
||||
n: "vqpvdxuyZ6rKYnWTj_ZzDBFZAAAlpe5hpoiYHqa2j5kK7v8U5EaPY2bLib9m4B40j-n3FV9xUCGiplWdqMJJKT-4PjGO5E3S4N9kjFhu57noYT7z7302J0sJXeoFbXxlgE-4G55Oxlm52ID2_RJesP5nzcGTriQwoRbrJP5OEt0",
|
||||
},
|
||||
extractable: true,
|
||||
keyUsages: ["verify"] as KeyUsage[],
|
||||
},
|
||||
privateKey: {
|
||||
format: "jwk" as KeyFormat,
|
||||
algorithm: { name: "RSASSA-PKCS1-v1_5", hash: "SHA-256" } as RsaHashedImportParams,
|
||||
data: {
|
||||
alg: "RS256",
|
||||
d: "AkeIWJywp9OfYsj0ECsKmhDVBw55ZL_yU-rbIrashQ_31P6gsc_0I-SVN1rd8Hz79OJ_rTY8ZRBZ4PIyFdPoyvuo5apHdAHH6riJKxDHWPxhE-ReNVEPSTiF1ry8DSe5zC7w9BLnH_QM8bkN4cOnvgqrg7EbrGWomAGJVvoRwOM",
|
||||
dp: "pOolqL7HwnmWLn7GDX8zGkm0Q1IAj-ouBL7ZZbaTm3wETLtwu-dGsQheEdzP_mfL_CTiCAwGuQBcSItimD0DdQ",
|
||||
dq: "FTSY59AnkgmB7TsErWNBE3xlVB_pMpE2xWyCBCz96gyDOUOFDz8vlSV-clhjawJeRd1n30nZOPSBtOHozhwZmQ",
|
||||
e: "AQAB",
|
||||
ext: true,
|
||||
key_ops: ["sign"],
|
||||
kty: "RSA",
|
||||
n: "vqpvdxuyZ6rKYnWTj_ZzDBFZAAAlpe5hpoiYHqa2j5kK7v8U5EaPY2bLib9m4B40j-n3FV9xUCGiplWdqMJJKT-4PjGO5E3S4N9kjFhu57noYT7z7302J0sJXeoFbXxlgE-4G55Oxlm52ID2_RJesP5nzcGTriQwoRbrJP5OEt0",
|
||||
p: "6jFtmBJJQFIlQUXXZYIgvH70Y9a03oWKjNuF2veb5Zf09EtLNE86NpnIm463OnoHJPW0m8wHFXZZfcYVTIPR_w",
|
||||
q: "0GttDMl1kIzSV2rNzGXpOS8tUqr5Lz0EtVZwIb9GJPMmJ0P3gZ801zEgZZ4-esU7cLUf-BSZEAmfnKA80G2jIw",
|
||||
qi: "FByTxX4G2eXkk1xe0IuiEv7I5NS-CnFyp8iB4XLG0rabnfcIZFKpf__X0sNyVOAVo5-jJMuUYjCRTdaXNAWhkg",
|
||||
},
|
||||
extractable: true,
|
||||
keyUsages: ["sign"] as KeyUsage[],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
import: [
|
||||
{
|
||||
name: "public key JWK",
|
||||
format: "jwk" as KeyFormat,
|
||||
algorithm: { name: "RSASSA-PKCS1-v1_5", hash: "SHA-256" } as RsaHashedImportParams,
|
||||
data: {
|
||||
alg: "RS256",
|
||||
e: "AQAB",
|
||||
ext: true,
|
||||
key_ops: ["verify"],
|
||||
kty: "RSA",
|
||||
n: "vqpvdxuyZ6rKYnWTj_ZzDBFZAAAlpe5hpoiYHqa2j5kK7v8U5EaPY2bLib9m4B40j-n3FV9xUCGiplWdqMJJKT-4PjGO5E3S4N9kjFhu57noYT7z7302J0sJXeoFbXxlgE-4G55Oxlm52ID2_RJesP5nzcGTriQwoRbrJP5OEt0",
|
||||
},
|
||||
extractable: true,
|
||||
keyUsages: ["verify"] as KeyUsage[],
|
||||
},
|
||||
{
|
||||
name: "public key SPKI",
|
||||
format: "spki" as KeyFormat,
|
||||
algorithm: { name: "RSASSA-PKCS1-v1_5", hash: "SHA-256" } as RsaHashedImportParams,
|
||||
data: Convert.FromBase64("MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC+qm93G7JnqspidZOP9nMMEVkAACWl7mGmiJgepraPmQru/xTkRo9jZsuJv2bgHjSP6fcVX3FQIaKmVZ2owkkpP7g+MY7kTdLg32SMWG7nuehhPvPvfTYnSwld6gVtfGWAT7gbnk7GWbnYgPb9El6w/mfNwZOuJDChFusk/k4S3QIDAQAB"),
|
||||
extractable: true,
|
||||
keyUsages: ["verify"] as KeyUsage[],
|
||||
},
|
||||
{
|
||||
name: "private key JWK",
|
||||
format: "jwk" as KeyFormat,
|
||||
algorithm: { name: "RSASSA-PKCS1-v1_5", hash: "SHA-256" } as RsaHashedImportParams,
|
||||
data: {
|
||||
alg: "RS256",
|
||||
d: "AkeIWJywp9OfYsj0ECsKmhDVBw55ZL_yU-rbIrashQ_31P6gsc_0I-SVN1rd8Hz79OJ_rTY8ZRBZ4PIyFdPoyvuo5apHdAHH6riJKxDHWPxhE-ReNVEPSTiF1ry8DSe5zC7w9BLnH_QM8bkN4cOnvgqrg7EbrGWomAGJVvoRwOM",
|
||||
dp: "pOolqL7HwnmWLn7GDX8zGkm0Q1IAj-ouBL7ZZbaTm3wETLtwu-dGsQheEdzP_mfL_CTiCAwGuQBcSItimD0DdQ",
|
||||
dq: "FTSY59AnkgmB7TsErWNBE3xlVB_pMpE2xWyCBCz96gyDOUOFDz8vlSV-clhjawJeRd1n30nZOPSBtOHozhwZmQ",
|
||||
e: "AQAB",
|
||||
ext: true,
|
||||
key_ops: ["sign"],
|
||||
kty: "RSA",
|
||||
n: "vqpvdxuyZ6rKYnWTj_ZzDBFZAAAlpe5hpoiYHqa2j5kK7v8U5EaPY2bLib9m4B40j-n3FV9xUCGiplWdqMJJKT-4PjGO5E3S4N9kjFhu57noYT7z7302J0sJXeoFbXxlgE-4G55Oxlm52ID2_RJesP5nzcGTriQwoRbrJP5OEt0",
|
||||
p: "6jFtmBJJQFIlQUXXZYIgvH70Y9a03oWKjNuF2veb5Zf09EtLNE86NpnIm463OnoHJPW0m8wHFXZZfcYVTIPR_w",
|
||||
q: "0GttDMl1kIzSV2rNzGXpOS8tUqr5Lz0EtVZwIb9GJPMmJ0P3gZ801zEgZZ4-esU7cLUf-BSZEAmfnKA80G2jIw",
|
||||
qi: "FByTxX4G2eXkk1xe0IuiEv7I5NS-CnFyp8iB4XLG0rabnfcIZFKpf__X0sNyVOAVo5-jJMuUYjCRTdaXNAWhkg",
|
||||
},
|
||||
extractable: true,
|
||||
keyUsages: ["sign"] as KeyUsage[],
|
||||
},
|
||||
{
|
||||
name: "private key pkcs8",
|
||||
format: "pkcs8" as KeyFormat,
|
||||
algorithm: { name: "RSASSA-PKCS1-v1_5", hash: "SHA-256" } as RsaHashedImportParams,
|
||||
data: Convert.FromBase64("MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAL6qb3cbsmeqymJ1k4/2cwwRWQAAJaXuYaaImB6mto+ZCu7/FORGj2Nmy4m/ZuAeNI/p9xVfcVAhoqZVnajCSSk/uD4xjuRN0uDfZIxYbue56GE+8+99NidLCV3qBW18ZYBPuBueTsZZudiA9v0SXrD+Z83Bk64kMKEW6yT+ThLdAgMBAAECgYACR4hYnLCn059iyPQQKwqaENUHDnlkv/JT6tsitqyFD/fU/qCxz/Qj5JU3Wt3wfPv04n+tNjxlEFng8jIV0+jK+6jlqkd0AcfquIkrEMdY/GET5F41UQ9JOIXWvLwNJ7nMLvD0Eucf9AzxuQ3hw6e+CquDsRusZaiYAYlW+hHA4wJBAOoxbZgSSUBSJUFF12WCILx+9GPWtN6Fiozbhdr3m+WX9PRLSzRPOjaZyJuOtzp6ByT1tJvMBxV2WX3GFUyD0f8CQQDQa20MyXWQjNJXas3MZek5Ly1SqvkvPQS1VnAhv0Yk8yYnQ/eBnzTXMSBlnj56xTtwtR/4FJkQCZ+coDzQbaMjAkEApOolqL7HwnmWLn7GDX8zGkm0Q1IAj+ouBL7ZZbaTm3wETLtwu+dGsQheEdzP/mfL/CTiCAwGuQBcSItimD0DdQJAFTSY59AnkgmB7TsErWNBE3xlVB/pMpE2xWyCBCz96gyDOUOFDz8vlSV+clhjawJeRd1n30nZOPSBtOHozhwZmQJAFByTxX4G2eXkk1xe0IuiEv7I5NS+CnFyp8iB4XLG0rabnfcIZFKpf//X0sNyVOAVo5+jJMuUYjCRTdaXNAWhkg=="),
|
||||
extractable: true,
|
||||
keyUsages: ["sign"] as KeyUsage[],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
// RSA-PSS
|
||||
{
|
||||
name: "RSA-PSS",
|
||||
actions: {
|
||||
generateKey: ["SHA-1", "SHA-256", "SHA-384", "SHA-512"].map((hash) => {
|
||||
return {
|
||||
name: hash,
|
||||
algorithm: {
|
||||
name: "RSA-PSS",
|
||||
hash,
|
||||
publicExponent: new Uint8Array([1, 0, 1]),
|
||||
modulusLength: 1024,
|
||||
} as RsaHashedKeyGenParams,
|
||||
extractable: false,
|
||||
keyUsages: ["sign", "verify"],
|
||||
} as ITestGenerateKeyAction;
|
||||
}),
|
||||
sign: [
|
||||
{
|
||||
algorithm: {
|
||||
name: "RSA-PSS",
|
||||
saltLength: 64,
|
||||
} as RsaPssParams,
|
||||
data: new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]),
|
||||
signature: Convert.FromBase64("OYz/7fv71ELOs5kuz5IiYq1NsXuOazl22xqIFjiY++hYFzJMWaR+ZI0WPoMOifvb1PNKmdQ4dY+QbpYC1vdzlAKfkLe22l5htLyQaXzjD/yeMZYrL0KmrabC9ayL6bxrMW+ccePStkbrF1Jn0LT09l22aX/r1y3SPrl0b+zwo/Q="),
|
||||
key: {
|
||||
publicKey: {
|
||||
format: "jwk" as KeyFormat,
|
||||
algorithm: { name: "RSA-PSS", hash: "SHA-256" } as RsaHashedImportParams,
|
||||
data: {
|
||||
alg: "PS256",
|
||||
e: "AQAB",
|
||||
ext: true,
|
||||
key_ops: ["verify"],
|
||||
kty: "RSA",
|
||||
n: "vqpvdxuyZ6rKYnWTj_ZzDBFZAAAlpe5hpoiYHqa2j5kK7v8U5EaPY2bLib9m4B40j-n3FV9xUCGiplWdqMJJKT-4PjGO5E3S4N9kjFhu57noYT7z7302J0sJXeoFbXxlgE-4G55Oxlm52ID2_RJesP5nzcGTriQwoRbrJP5OEt0",
|
||||
},
|
||||
extractable: true,
|
||||
keyUsages: ["verify"] as KeyUsage[],
|
||||
},
|
||||
privateKey: {
|
||||
format: "jwk" as KeyFormat,
|
||||
algorithm: { name: "RSA-PSS", hash: "SHA-256" } as RsaHashedImportParams,
|
||||
data: {
|
||||
alg: "PS256",
|
||||
d: "AkeIWJywp9OfYsj0ECsKmhDVBw55ZL_yU-rbIrashQ_31P6gsc_0I-SVN1rd8Hz79OJ_rTY8ZRBZ4PIyFdPoyvuo5apHdAHH6riJKxDHWPxhE-ReNVEPSTiF1ry8DSe5zC7w9BLnH_QM8bkN4cOnvgqrg7EbrGWomAGJVvoRwOM",
|
||||
dp: "pOolqL7HwnmWLn7GDX8zGkm0Q1IAj-ouBL7ZZbaTm3wETLtwu-dGsQheEdzP_mfL_CTiCAwGuQBcSItimD0DdQ",
|
||||
dq: "FTSY59AnkgmB7TsErWNBE3xlVB_pMpE2xWyCBCz96gyDOUOFDz8vlSV-clhjawJeRd1n30nZOPSBtOHozhwZmQ",
|
||||
e: "AQAB",
|
||||
ext: true,
|
||||
key_ops: ["sign"],
|
||||
kty: "RSA",
|
||||
n: "vqpvdxuyZ6rKYnWTj_ZzDBFZAAAlpe5hpoiYHqa2j5kK7v8U5EaPY2bLib9m4B40j-n3FV9xUCGiplWdqMJJKT-4PjGO5E3S4N9kjFhu57noYT7z7302J0sJXeoFbXxlgE-4G55Oxlm52ID2_RJesP5nzcGTriQwoRbrJP5OEt0",
|
||||
p: "6jFtmBJJQFIlQUXXZYIgvH70Y9a03oWKjNuF2veb5Zf09EtLNE86NpnIm463OnoHJPW0m8wHFXZZfcYVTIPR_w",
|
||||
q: "0GttDMl1kIzSV2rNzGXpOS8tUqr5Lz0EtVZwIb9GJPMmJ0P3gZ801zEgZZ4-esU7cLUf-BSZEAmfnKA80G2jIw",
|
||||
qi: "FByTxX4G2eXkk1xe0IuiEv7I5NS-CnFyp8iB4XLG0rabnfcIZFKpf__X0sNyVOAVo5-jJMuUYjCRTdaXNAWhkg",
|
||||
},
|
||||
extractable: true,
|
||||
keyUsages: ["sign"] as KeyUsage[],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
// RSA-OAEP
|
||||
{
|
||||
name: "RSA-OAEP",
|
||||
actions: {
|
||||
generateKey: ["SHA-1", "SHA-256", "SHA-384", "SHA-512"].map((hash) => {
|
||||
return {
|
||||
name: hash,
|
||||
algorithm: {
|
||||
name: "RSA-OAEP",
|
||||
hash,
|
||||
publicExponent: new Uint8Array([1, 0, 1]),
|
||||
modulusLength: 1024,
|
||||
} as RsaHashedKeyGenParams,
|
||||
extractable: false,
|
||||
keyUsages: ["encrypt", "decrypt"],
|
||||
} as ITestGenerateKeyAction;
|
||||
}),
|
||||
encrypt: [
|
||||
{
|
||||
name: "with label",
|
||||
algorithm: {
|
||||
name: "RSA-OAEP",
|
||||
label: new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]),
|
||||
} as RsaOaepParams,
|
||||
data: new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]),
|
||||
encData: Convert.FromBase64("aHu8PBZuctYecfINKgUdB8gBoLyUUFxTZDTzTHUk9KKxtYywYml48HoijBG5DyaIWUUbOIdPgap9C8pFG2iYShQnE9Aj3gzKLHacBbFw1P79+Ei/Tm0j/THiXqCplBZC4dIp4jhTDepmdrlXZcY0slmjG+h8h8TpSmWKP3pEGGk="),
|
||||
key: {
|
||||
publicKey: {
|
||||
format: "jwk" as KeyFormat,
|
||||
algorithm: { name: "RSA-OAEP", hash: "SHA-256" } as RsaHashedImportParams,
|
||||
data: {
|
||||
alg: "RSA-OAEP-256",
|
||||
e: "AQAB",
|
||||
ext: true,
|
||||
key_ops: ["encrypt"],
|
||||
kty: "RSA",
|
||||
n: "vqpvdxuyZ6rKYnWTj_ZzDBFZAAAlpe5hpoiYHqa2j5kK7v8U5EaPY2bLib9m4B40j-n3FV9xUCGiplWdqMJJKT-4PjGO5E3S4N9kjFhu57noYT7z7302J0sJXeoFbXxlgE-4G55Oxlm52ID2_RJesP5nzcGTriQwoRbrJP5OEt0",
|
||||
},
|
||||
extractable: true,
|
||||
keyUsages: ["encrypt"] as KeyUsage[],
|
||||
},
|
||||
privateKey: {
|
||||
format: "jwk" as KeyFormat,
|
||||
algorithm: { name: "RSA-OAEP", hash: "SHA-256" } as RsaHashedImportParams,
|
||||
data: {
|
||||
alg: "RSA-OAEP-256",
|
||||
d: "AkeIWJywp9OfYsj0ECsKmhDVBw55ZL_yU-rbIrashQ_31P6gsc_0I-SVN1rd8Hz79OJ_rTY8ZRBZ4PIyFdPoyvuo5apHdAHH6riJKxDHWPxhE-ReNVEPSTiF1ry8DSe5zC7w9BLnH_QM8bkN4cOnvgqrg7EbrGWomAGJVvoRwOM",
|
||||
dp: "pOolqL7HwnmWLn7GDX8zGkm0Q1IAj-ouBL7ZZbaTm3wETLtwu-dGsQheEdzP_mfL_CTiCAwGuQBcSItimD0DdQ",
|
||||
dq: "FTSY59AnkgmB7TsErWNBE3xlVB_pMpE2xWyCBCz96gyDOUOFDz8vlSV-clhjawJeRd1n30nZOPSBtOHozhwZmQ",
|
||||
e: "AQAB",
|
||||
ext: true,
|
||||
key_ops: ["decrypt"],
|
||||
kty: "RSA",
|
||||
n: "vqpvdxuyZ6rKYnWTj_ZzDBFZAAAlpe5hpoiYHqa2j5kK7v8U5EaPY2bLib9m4B40j-n3FV9xUCGiplWdqMJJKT-4PjGO5E3S4N9kjFhu57noYT7z7302J0sJXeoFbXxlgE-4G55Oxlm52ID2_RJesP5nzcGTriQwoRbrJP5OEt0",
|
||||
p: "6jFtmBJJQFIlQUXXZYIgvH70Y9a03oWKjNuF2veb5Zf09EtLNE86NpnIm463OnoHJPW0m8wHFXZZfcYVTIPR_w",
|
||||
q: "0GttDMl1kIzSV2rNzGXpOS8tUqr5Lz0EtVZwIb9GJPMmJ0P3gZ801zEgZZ4-esU7cLUf-BSZEAmfnKA80G2jIw",
|
||||
qi: "FByTxX4G2eXkk1xe0IuiEv7I5NS-CnFyp8iB4XLG0rabnfcIZFKpf__X0sNyVOAVo5-jJMuUYjCRTdaXNAWhkg",
|
||||
},
|
||||
extractable: true,
|
||||
keyUsages: ["decrypt"] as KeyUsage[],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "without label",
|
||||
algorithm: {
|
||||
name: "RSA-OAEP",
|
||||
} as RsaOaepParams,
|
||||
data: new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]),
|
||||
encData: Convert.FromBase64("NcsyyVE/y4Z1K5bWGElWAkvlN+jWpfgPtcytlydWUUz4RqFeW5w6KA1cQMHy3eNh920YXDjsLSYHe6Dz1CEqjIKkHS9HBuOhLA39yUArOu/fmn1lMnwb9N9roTxHDxpgY3y98DXEVkAKU4Py0rlzJLVazDV/+1YcbzFLCSKUNaI="),
|
||||
key: {
|
||||
publicKey: {
|
||||
format: "jwk" as KeyFormat,
|
||||
algorithm: { name: "RSA-OAEP", hash: "SHA-256" } as RsaHashedImportParams,
|
||||
data: {
|
||||
alg: "RSA-OAEP-256",
|
||||
e: "AQAB",
|
||||
ext: true,
|
||||
key_ops: ["encrypt"],
|
||||
kty: "RSA",
|
||||
n: "vqpvdxuyZ6rKYnWTj_ZzDBFZAAAlpe5hpoiYHqa2j5kK7v8U5EaPY2bLib9m4B40j-n3FV9xUCGiplWdqMJJKT-4PjGO5E3S4N9kjFhu57noYT7z7302J0sJXeoFbXxlgE-4G55Oxlm52ID2_RJesP5nzcGTriQwoRbrJP5OEt0",
|
||||
},
|
||||
extractable: true,
|
||||
keyUsages: ["encrypt"] as KeyUsage[],
|
||||
},
|
||||
privateKey: {
|
||||
format: "jwk" as KeyFormat,
|
||||
algorithm: { name: "RSA-OAEP", hash: "SHA-256" } as RsaHashedImportParams,
|
||||
data: {
|
||||
alg: "RSA-OAEP-256",
|
||||
d: "AkeIWJywp9OfYsj0ECsKmhDVBw55ZL_yU-rbIrashQ_31P6gsc_0I-SVN1rd8Hz79OJ_rTY8ZRBZ4PIyFdPoyvuo5apHdAHH6riJKxDHWPxhE-ReNVEPSTiF1ry8DSe5zC7w9BLnH_QM8bkN4cOnvgqrg7EbrGWomAGJVvoRwOM",
|
||||
dp: "pOolqL7HwnmWLn7GDX8zGkm0Q1IAj-ouBL7ZZbaTm3wETLtwu-dGsQheEdzP_mfL_CTiCAwGuQBcSItimD0DdQ",
|
||||
dq: "FTSY59AnkgmB7TsErWNBE3xlVB_pMpE2xWyCBCz96gyDOUOFDz8vlSV-clhjawJeRd1n30nZOPSBtOHozhwZmQ",
|
||||
e: "AQAB",
|
||||
ext: true,
|
||||
key_ops: ["decrypt"],
|
||||
kty: "RSA",
|
||||
n: "vqpvdxuyZ6rKYnWTj_ZzDBFZAAAlpe5hpoiYHqa2j5kK7v8U5EaPY2bLib9m4B40j-n3FV9xUCGiplWdqMJJKT-4PjGO5E3S4N9kjFhu57noYT7z7302J0sJXeoFbXxlgE-4G55Oxlm52ID2_RJesP5nzcGTriQwoRbrJP5OEt0",
|
||||
p: "6jFtmBJJQFIlQUXXZYIgvH70Y9a03oWKjNuF2veb5Zf09EtLNE86NpnIm463OnoHJPW0m8wHFXZZfcYVTIPR_w",
|
||||
q: "0GttDMl1kIzSV2rNzGXpOS8tUqr5Lz0EtVZwIb9GJPMmJ0P3gZ801zEgZZ4-esU7cLUf-BSZEAmfnKA80G2jIw",
|
||||
qi: "FByTxX4G2eXkk1xe0IuiEv7I5NS-CnFyp8iB4XLG0rabnfcIZFKpf__X0sNyVOAVo5-jJMuUYjCRTdaXNAWhkg",
|
||||
},
|
||||
extractable: true,
|
||||
keyUsages: ["decrypt"] as KeyUsage[],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
// RSAES-PKCS1-v1_5
|
||||
{
|
||||
name: "RSAES-PKCS1-v1_5",
|
||||
actions: {
|
||||
generateKey: [
|
||||
{
|
||||
algorithm: {
|
||||
name: "RSAES-PKCS1-v1_5",
|
||||
publicExponent: new Uint8Array([1, 0, 1]),
|
||||
modulusLength: 1024,
|
||||
} as RsaKeyGenParams,
|
||||
extractable: false,
|
||||
keyUsages: ["encrypt", "decrypt"],
|
||||
} as ITestGenerateKeyAction,
|
||||
],
|
||||
encrypt: [
|
||||
{
|
||||
algorithm: {
|
||||
name: "RSAES-PKCS1-v1_5",
|
||||
} as Algorithm,
|
||||
data: Convert.FromHex("01435e62ad3ec4850720e34f8cab620e203749f2315b203d"),
|
||||
encData: Convert.FromHex("76e5ea6e1df52471454f790923f60e2baa7adf5017fe0a36c0af3e32f6390d570e1d592375ba6035fdf4ffa70764b797ab54d0ab1efe89cf31d7fc98240a4d08c2476b7eb4c2d92355b8bf60e3897c3fcbfe09f20c7b159d9a9c4a6b2ce5021dd313e492afa762c24930f97f03a429f7b2b1e1d6088651d60e323835807c6fefe7952f74e5da29e8e327ea46e69a0a6684272f022bf18ec602ffcd10a62666b35a51ec7c7d101096f663ddfa0924a86bdbcde0433b4f71dc42bfd9facf329558026f8667f1a71c3365e09843a12339d8aaf31987b0d800e53fd0835e990096cb145e278153faf1188cd5713c6fcd289cb77d80515e1d200139b8ccac4d3bcebc"),
|
||||
key: {
|
||||
publicKey: {
|
||||
format: "jwk" as KeyFormat,
|
||||
algorithm: { name: "RSAES-PKCS1-v1_5" } as Algorithm,
|
||||
data: {
|
||||
alg: "RS1",
|
||||
e: "AQAB",
|
||||
ext: true,
|
||||
key_ops: ["encrypt"],
|
||||
kty: "RSA",
|
||||
n: "xr8ELXq5dGFycys8jrc8vVPkWl2GzuRgyOxATtjcNIy5MD7j1XVsUH62VVdIVUUGt0IQ7K288ij3gkIPcIkRO6GmV0vbQAqHrjSHYUAtKQXbIgNRIuJGZvO5AXsxSo1X-tfhOxe140pseOkaehz1bGduhdcYWNR3xLmp7i-GQTRDo-v6CQXtFvSUwG_EIOXnl1trN2Q1Yw4wA1dbtY9FDz69uH-dEWTx7BFCAXVTQMjNe7BTvgGeQcX7XZIw5e2pd0pXjdIgb0xMgziwmc5bbABrGlhK7TmKqA47RlWzY_Lcj7VcTUfMfh7YKKichGTUbqxlgsRTma_e-0-vgDEz6w",
|
||||
},
|
||||
extractable: true,
|
||||
keyUsages: ["encrypt"] as KeyUsage[],
|
||||
},
|
||||
privateKey: {
|
||||
format: "jwk" as KeyFormat,
|
||||
algorithm: { name: "RSAES-PKCS1-v1_5" } as Algorithm,
|
||||
data: {
|
||||
kty: "RSA",
|
||||
alg: "RS1",
|
||||
key_ops: ["decrypt"],
|
||||
ext: true,
|
||||
n: "xr8ELXq5dGFycys8jrc8vVPkWl2GzuRgyOxATtjcNIy5MD7j1XVsUH62VVdIVUUGt0IQ7K288ij3gkIPcIkRO6GmV0vbQAqHrjSHYUAtKQXbIgNRIuJGZvO5AXsxSo1X-tfhOxe140pseOkaehz1bGduhdcYWNR3xLmp7i-GQTRDo-v6CQXtFvSUwG_EIOXnl1trN2Q1Yw4wA1dbtY9FDz69uH-dEWTx7BFCAXVTQMjNe7BTvgGeQcX7XZIw5e2pd0pXjdIgb0xMgziwmc5bbABrGlhK7TmKqA47RlWzY_Lcj7VcTUfMfh7YKKichGTUbqxlgsRTma_e-0-vgDEz6w",
|
||||
e: "AQAB",
|
||||
d: "kZ2IoQ3G7UcshMdL8kC85vadW7wktldLtkqqf1qSVIo6cOfTJCWJe5yrWPG_VIJjfkeQgOh2hHKRjcV67HfwwWEZr-IrPMu6R1_DRPSxYdohiNUnUEi7TlkJ1tT882OF74rWQeaIZIS13wzjUk7_XjKWHsfO1d6t9dwWbiYx1nj4syQCcUrvHIgVXCfL85Tyu3NHqpxOdbzRb2OLmkv5ciHFExm4ai98xAgsEXbNvZQeSOOfKNsiCb-NjBXLYrbaDIsakAEV75893JubfeD51UHn7dPT8M8MmKEvrTOKCscShf01scTDHfx_hiOXK3XG4tVx9l2YGEkt3xCedljocQ",
|
||||
p: "_dWMJ57SECcBbOjPRCvT97ypDyw9ydvnSZXTsn9c7ScxvUxBk6-wuMtgsLI8OWkhZGDBLyVrn-I3RMAN-A5QI_adoGdK7fq5lFWmQYvb1u1xUaGEInVFsM3BW7RBBF8N7OzHwULEQLTXb4jkpgwyCynsX0OEbVVvVerqrcr7osM",
|
||||
q: "yHEjuQe9TNo-leMrL6cu-yDPfA85M8xQuBM59Cwz06-ggBRi9EOpbV-CrejGUbVlE9QmKGqIBT8C3NVBQwybzlgUihgIpnVgkb01lLEf13ohQ_GWV1mS8ybznjMgaVtVF5Lva4WixIDlXbOu4svVQpkr-KRpKvEMUCTsX-Sxx7k",
|
||||
dp: "jMP4TaCN7dczuyoAh1Wm3yQIvRlTyrXgtbYZCEwJRJsPwmKfmz87Sb-_hz3QmCXtFrVxbKvb23agH8hB9uY5GziQgXvG2eLJN7Gn2YGuEKrsxNBFbraKR1pTeH-l7r6oAlPtEwfrvdaMApZv9oWc2wQMyWev8NIIRCVar7Z5hfE",
|
||||
dq: "wi2g3sJZp9cRpGEDWFHM2KnrdxLEZqK7W-f8T8h2mM9eXFXjmyDlRLivP0zuuv9QoUn3gVXa2cI2QrsxUwQm-Fop47Hux1uUpvs2qgqBf1yoV0r2Sz7Sdk442fxLnOVG5OSKno5Cpbz89q54cOvoeHEswN59p4UHWai7eRZzB7k",
|
||||
qi: "k9hlEyvZCWj8Fvxrknj5WHgaLrSqaVku3PVod2wUJox3aZ8vUsGmmD27lfiWwVKNRmgxLiazY40pLPu07SEmlJgF8QjzDb33k5Pcn9wRuezcCi-53LBRK6-EptZ-UjEINBlM_Cx_WOuxs7P77pwcCo2NV76ilxP5PP_34SUZ0ts",
|
||||
},
|
||||
extractable: true,
|
||||
keyUsages: ["decrypt"] as KeyUsage[],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
});
|
44
test/sha.ts
44
test/sha.ts
|
@ -1,44 +0,0 @@
|
|||
import { Convert } from "pvtsutils";
|
||||
import { Crypto } from "../src";
|
||||
import { testCrypto } from "./helper";
|
||||
|
||||
context("SHA", () => {
|
||||
|
||||
const crypto = new Crypto();
|
||||
const data = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]);
|
||||
|
||||
testCrypto(crypto, [
|
||||
{
|
||||
name: "SHA",
|
||||
actions: {
|
||||
digest: [
|
||||
{
|
||||
name: "SHA-1",
|
||||
algorithm: "SHA-1",
|
||||
data,
|
||||
hash: Convert.FromBase64("6JrVqWMcPv3e1+Psznm00P7c4b8="),
|
||||
},
|
||||
{
|
||||
name: "SHA-256",
|
||||
algorithm: "SHA-256",
|
||||
data,
|
||||
hash: Convert.FromBase64("monGjExeKLjEpVZ2c9Ri//UV20YRb5kAYk0JxHT1k/s="),
|
||||
},
|
||||
{
|
||||
name: "SHA-384",
|
||||
algorithm: "SHA-384",
|
||||
data,
|
||||
hash: Convert.FromBase64("E9WqubQC9JnxffIniWwf0soI91o5z0Kbvk+s/32Fi3z28kAh+Fcne7Hgy1nnW4rR"),
|
||||
},
|
||||
{
|
||||
name: "SHA-512",
|
||||
algorithm: "SHA-512",
|
||||
data,
|
||||
hash: Convert.FromBase64("OtPzaXlFDU9TNmJE7PEBD0+RIdaIgoX/FBBP1a3thdSKoXG/HjOhEmAvkrenCIsph4kBL7h7kFYyEkGhn7dOCw=="),
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
});
|
Reference in New Issue