Title: Accepting `CryptoKey` in `node:crypto` APIs · Issue #55293 · nodejs/node · GitHub
Open Graph Title: Accepting `CryptoKey` in `node:crypto` APIs · Issue #55293 · nodejs/node
X Title: Accepting `CryptoKey` in `node:crypto` APIs · Issue #55293 · nodejs/node
Description: The following APIs accept a CryptoKey instance and process the operation despite the restrictions put forth on the CryptoKey instance (e.g. algorithm, usages, extractable) KeyObject.from (ignores extractable) crypto.publicDecrypt crypto....
Open Graph Description: The following APIs accept a CryptoKey instance and process the operation despite the restrictions put forth on the CryptoKey instance (e.g. algorithm, usages, extractable) KeyObject.from (ignores e...
X Description: The following APIs accept a CryptoKey instance and process the operation despite the restrictions put forth on the CryptoKey instance (e.g. algorithm, usages, extractable) KeyObject.from (ignores e...
Opengraph URL: https://github.com/nodejs/node/issues/55293
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Accepting `CryptoKey` in `node:crypto` APIs","articleBody":"The following APIs accept a `CryptoKey` instance and process the operation despite the restrictions put forth on the `CryptoKey` instance (e.g. algorithm, usages, extractable)\r\n\r\n- KeyObject.from (ignores `extractable`)\r\n- crypto.publicDecrypt\r\n- crypto.publicEncrypt\r\n- crypto.privateDecrypt\r\n- crypto.privateEncrypt\r\n- crypto.sign\r\n- crypto.verify\r\n- Sign.sign\r\n- Verify.verify\r\n- Cipher.final\r\n- Decipher.final\r\n- Hmac.digest\r\n\r\nThis list is according to the docs, but i suspect it's possible that hkdf and pbkdf2 allow this too.\r\n\r\nThis issue is to discuss a way forward to deal with this issues.\r\n\r\n## KeyObject.from\r\n\r\nhttps://github.com/nodejs/node/pull/37240 attempted to do something about KeyObject.from but i think the outcome would not solve the issues above.\r\n\r\nI believe that converting key representations is not an issue so long as the more restrictive key representation's properties are upheld.\r\n\r\nWe can take a drastic stance and deprecate / in due time remove KeyObject.from entirely, or make KeyObject.from respect the `extractable` property and duly document that once the key is converted the CryptoKey restrictions are not upheld anymore. I'd much rather see the latter.\r\n\r\nAnother possible approach would be to disable KeyObject.export on keys that came from non-extractable CryptoKey.\r\n\r\n## APIs accepting CryptoKey but ignoring its parameters.\r\n\r\nWe could deprecate the use of CryptoKey in these APIs entirely or emulate WebCryptoAPI behaviour and check the CryptoKey usages and algorithm slots, either way this would be a doc-only deprecation at first, then --pending-deprecation, runtime deprecation, throw behaviour at the end.","author":{"url":"https://github.com/panva","@type":"Person","name":"panva"},"datePublished":"2024-10-06T13:00:46.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/55293/node/issues/55293"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:b3e3047b-aa8d-0337-c39f-0f0a4ee9c835 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EBC4:2C345B:115E07E:1765662:6A4C6EE7 |
| html-safe-nonce | a32ed42d50e9d653c234e5e43f0f6069f9aab092d959650605184c51b3362802 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQkM0OjJDMzQ1QjoxMTVFMDdFOjE3NjU2NjI6NkE0QzZFRTciLCJ2aXNpdG9yX2lkIjoiNjg0NjQ3MTE5MDk3NDU4NDA3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 228b9e59fdab716d90154be42997931ba56a6ceeb80f5540340fa6ee464155b9 |
| hovercard-subject-tag | issue:2568649454 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/55293/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f72bfe7c523a84e932c5cf237e8c3bf17d09fbe63f1898abad958f55724b2b44/nodejs/node/issues/55293 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f72bfe7c523a84e932c5cf237e8c3bf17d09fbe63f1898abad958f55724b2b44/nodejs/node/issues/55293 |
| og:image:alt | The following APIs accept a CryptoKey instance and process the operation despite the restrictions put forth on the CryptoKey instance (e.g. algorithm, usages, extractable) KeyObject.from (ignores e... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | panva |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3d11bb817438277de2a940854450e83a7d32b6aeb5014e9e6b00a6423900251c |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 14099438da5379150f15a2892474c7c7e6c0e55e |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width