Filip Skokan
1ccae7cce4
crypto: unify asymmetric key import through KeyObjectHandle::Init
...
Consolidate all asymmetric key import paths (DER/PEM, JWK, raw) into
a single KeyObjectHandle::Init() entry point with a uniform signature.
Remove the per-type C++ init methods (InitECRaw, InitEDRaw, InitPqcRaw,
InitJwk, InitECPrivateRaw) and their JS-side callers, replacing them
with shared C++ and JS helpers.
createPublicKey, createPrivateKey, sign, verify, and other operations
that accept key material now handle JWK and raw formats directly in
C++, removing redundant JS-to-C++ key handle round-trips.
Signed-off-by: Filip Skokan <panva.ip@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/62499
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2026-03-31 19:57:34 +00:00
Filip Skokan
ab8dc2b84c
crypto: rename CShakeParams and KmacParams length to outputLength
...
PR-URL: https://github.com/nodejs/node/pull/61875
Refs: https://github.com/web-platform-tests/wpt/pull/57802
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
2026-03-16 22:04:01 +01:00
Renegade334
33e3e423d9
crypto: avoid calls to promise.catch()
...
This avoids explicit calls to the user-mutable
`%Promise.prototype%.catch`, and by association, implicit calls to the
user-mutable `%Promise.prototype%.then`.
PR-URL: https://github.com/nodejs/node/pull/59841
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Jordan Harband <ljharb@gmail.com >
Reviewed-By: Filip Skokan <panva.ip@gmail.com >
2025-09-12 14:21:49 +00:00
Filip Skokan
14c68e3b53
crypto: add KMAC Web Cryptography algorithms
...
PR-URL: https://github.com/nodejs/node/pull/59647
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
2025-09-06 22:43:15 +00:00
Filip Skokan
9d744b5b63
crypto: use CryptoKey internal slots in Web Cryptography
...
PR-URL: https://github.com/nodejs/node/pull/59538
Fixes: https://github.com/nodejs/node/issues/59535
Fixes: https://github.com/nodejs/node/issues/59534
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
2025-08-21 14:14:57 +00:00
Filip Skokan
1c4d534b75
crypto: add SHA-3 Web Cryptography digest algorithms
...
PR-URL: https://github.com/nodejs/node/pull/59365
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2025-08-19 15:55:57 +02:00
Filip Skokan
327618c430
crypto: add SHAKE Web Cryptography digest algorithms
...
PR-URL: https://github.com/nodejs/node/pull/59365
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2025-08-19 15:55:56 +02:00
Filip Skokan
700a965dc3
crypto: prepare webcrypto key import/export for modern algorithms
...
PR-URL: https://github.com/nodejs/node/pull/59284
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
2025-08-05 13:25:29 +00:00
Filip Skokan
d18f4878cf
src: refactor SubtleCrypto algorithm and length validations
...
PR-URL: https://github.com/nodejs/node/pull/57319
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2025-03-08 06:38:17 -08:00
Filip Skokan
6fdd4e6dcf
src: refactor SubtleCrypto algorithm and length validations
...
PR-URL: https://github.com/nodejs/node/pull/57273
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Jason Zhang <xzha4350@gmail.com >
Reviewed-By: Mattias Buelens <mattias@buelens.com >
2025-03-04 17:45:51 +00:00
Filip Skokan
90e3e5e173
crypto: add KeyObject.prototype.toCryptoKey
...
PR-URL: https://github.com/nodejs/node/pull/55262
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2024-10-06 18:09:02 +00:00
Filip Skokan
b64006c0ed
crypto: ensure invalid SubtleCrypto JWK data import results in DataError
...
PR-URL: https://github.com/nodejs/node/pull/55041
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
2024-09-23 15:28:44 +00:00
Filip Skokan
3ef38c4bd7
crypto: use WebIDL converters in WebCryptoAPI
...
WebCryptoAPI functions' arguments are now coersed and validated as per
their WebIDL definitions like in other Web Crypto API implementations.
This further improves interoperability with other implementations of
Web Crypto API.
PR-URL: https://github.com/nodejs/node/pull/46067
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2023-01-17 08:57:58 +00:00
Filip Skokan
73a5112583
crypto: handle more webcrypto errors with OperationError
...
PR-URL: https://github.com/nodejs/node/pull/45320
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2022-11-07 06:35:35 +00:00
Filip Skokan
214354fc9f
crypto: fix webcrypto HMAC "get key length" in deriveKey and generateKey
...
PR-URL: https://github.com/nodejs/node/pull/44917
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2022-10-12 19:18:38 +00:00
Filip Skokan
0d80e7344e
crypto: add causes to applicable webcrypto's OperationError
...
PR-URL: https://github.com/nodejs/node/pull/44890
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2022-10-10 01:12:28 +00:00
Filip Skokan
ac1b90eed1
crypto: fix webcrypto operation errors to be OperationError
...
PR-URL: https://github.com/nodejs/node/pull/44171
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2022-08-12 19:29:14 +00:00
Filip Skokan
fbfb91ba33
crypto: remove Node.js-specific webcrypto extensions
...
PR-URL: https://github.com/nodejs/node/pull/43310
Reviewed-By: James M Snell <jasnell@gmail.com >
2022-06-11 08:04:20 +01:00
XadillaX
2de139b5d5
lib: make lazyDOMException more common
...
PR-URL: https://github.com/nodejs/node/pull/39105
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2021-06-28 13:44:28 +08:00
Antoine du Hamel
75259c7492
crypto: refactor hasAnyNotIn to avoid unsafe array iteration
...
PR-URL: https://github.com/nodejs/node/pull/37433
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com >
2021-02-26 16:34:04 +01:00
James M Snell
dae283d96f
crypto: refactoring internals, add WebCrypto
...
Fixes: https://github.com/nodejs/node/issues/678
Refs: https://github.com/nodejs/node/issues/26854
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/35093
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2020-10-07 17:27:05 -07:00