Filip Skokan
e6ef4774c2
crypto: align key argument names in docs and error messages
...
Signed-off-by: Filip Skokan <panva.ip@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/62527
Reviewed-By: James M Snell <jasnell@gmail.com >
2026-04-09 08:10:14 +02:00
Filip Skokan
1b5dc9bbc5
crypto: accept key data in crypto.diffieHellman() and cleanup DH jobs
...
Signed-off-by: Filip Skokan <panva.ip@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/62527
Reviewed-By: James M Snell <jasnell@gmail.com >
2026-04-09 08:10:12 +02:00
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
c3042c605b
crypto: recognize raw formats in keygen
...
Signed-off-by: Filip Skokan <panva.ip@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/62480
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2026-03-30 21:35:58 +02:00
Filip Skokan
adac077484
crypto: runtime-deprecate DEP0203 and DEP0204
...
PR-URL: https://github.com/nodejs/node/pull/62453
Refs: https://github.com/nodejs/node/issues/55293
Refs: https://github.com/nodejs/node/pull/62321
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2026-03-29 14:35:10 +00:00
Filip Skokan
d4fa60cf9f
crypto: add raw key formats support to the KeyObject APIs
...
Add raw key format support (raw-public, raw-private, raw-seed) to
KeyObject.prototype.export(), crypto.createPrivateKey(),
and crypto.createPublicKey() for applicable asymmetric keys (EC,
CFRG curves, ML-DSA, ML-KEM, and SLH-DSA).
Also wire these to the Web Cryptography APIs and remove the unnecessary
KeyExportJob. The KeyExportJob classes were removed because the export
operations they performed are not computationally expensive. They're
just serialization of already-available key data (SPKI, PKCS8, raw
bytes). Running them as async CryptoJobs on the libuv thread pool added
unnecessary overhead and complexity for operations that complete
instantly.
PR-URL: https://github.com/nodejs/node/pull/62240
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2026-03-26 10:31:26 +01:00
Filip Skokan
537df2eeb3
lib: refactor JWK import PQC support check
...
PR-URL: https://github.com/nodejs/node/pull/60586
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2025-11-13 21:45:28 +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
René
196f5466af
lib: revert to using default derived class constructors
...
PR-URL: https://github.com/nodejs/node/pull/59650
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2025-08-30 14:28:10 +00:00
Filip Skokan
27e2d81617
crypto: add Argon2 Web Cryptography algorithms
...
PR-URL: https://github.com/nodejs/node/pull/59544
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
2025-08-26 16:05:56 +00:00
Filip Skokan
8692e601cc
crypto: add AES-OCB Web Cryptography algorithm
...
PR-URL: https://github.com/nodejs/node/pull/59539
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2025-08-24 09:47:20 +00:00
Filip Skokan
589ef79bf8
crypto: support ML-KEM in Web Cryptography
...
PR-URL: https://github.com/nodejs/node/pull/59569
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2025-08-23 17:01:51 +02:00
Filip Skokan
d30090b427
crypto: return cached copies from CryptoKey algorithm and usages getters
...
Fixes: https://github.com/nodejs/node/issues/59534
PR-URL: https://github.com/nodejs/node/pull/59538
Fixes: https://github.com/nodejs/node/issues/59535
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
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
84aaed7597
crypto: add ChaCha20-Poly1305 Web Cryptography algorithm
...
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:57:08 +02:00
Filip Skokan
87f4f99c09
crypto: support ML-DSA in Web Cryptography
...
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:53 +02:00
Filip Skokan
24e28c41b5
crypto: support ML-DSA KeyObject, sign, and verify
...
PR-URL: https://github.com/nodejs/node/pull/59259
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
Reviewed-By: James M Snell <jasnell@gmail.com >
2025-08-06 21:49:30 +00: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
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
4e44322413
crypto: ensure CryptoKey usages and algorithm are cached objects
...
PR-URL: https://github.com/nodejs/node/pull/56108
Reviewed-By: Matthew Aitken <maitken033380023@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2024-12-04 10:46:27 +00:00
Aviv Keller
71785889c8
lib: prefer logical assignment
...
PR-URL: https://github.com/nodejs/node/pull/55044
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: LiviaMedeiros <livia@cirno.name >
2024-10-09 06:42:16 +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
Nathan Baulch
4c045351c1
lib: fix typos
...
PR-URL: https://github.com/nodejs/node/pull/55065
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: LiviaMedeiros <livia@cirno.name >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2024-09-25 14:35:18 +00:00
Antoine du Hamel
231548b5cf
lib: enforce ASCII order in error code imports
...
PR-URL: https://github.com/nodejs/node/pull/52625
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
2024-04-23 17:05:38 +00:00
Antoine du Hamel
a596af0819
tools: add lint rule to keep primordials in ASCII order
...
PR-URL: https://github.com/nodejs/node/pull/52592
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io >
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
2024-04-21 16:53:08 +00:00
Filip Skokan
f505a225d7
crypto: update CryptoKey symbol properties
...
PR-URL: https://github.com/nodejs/node/pull/50897
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2023-12-17 12:55:37 +00:00
Chengzhong Wu
38dee8a1c0
src: distinguish HTML transferable and cloneable
...
The HTML structured serialize algorithm treats transferable and
serializable as two different bits. A web platform interface can be
both transferable and serializable.
Splits BaseObject::TransferMode to be able to compose the two bits
and distinguishes the transferable and cloneable.
PR-URL: https://github.com/nodejs/node/pull/47956
Refs: https://github.com/v8/v8/commit/cf13b9b46572a9824d2d632abdd48c56161ace02
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com >
2023-07-07 17:00:00 +00:00
Antoine du Hamel
ab8942848b
lib: enforce use of trailing commas
...
PR-URL: https://github.com/nodejs/node/pull/46881
Reviewed-By: Debadree Chatterjee <debadree333@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
2023-03-06 10:44:14 +01:00
Antoine du Hamel
fe514bf960
lib: enforce use of trailing commas for functions
...
PR-URL: https://github.com/nodejs/node/pull/46629
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
2023-02-14 18:45:16 +01:00
Filip Skokan
13f518f6e3
crypto: add CryptoKey Symbol.toStringTag
...
closes #45987
PR-URL: https://github.com/nodejs/node/pull/46042
Fixes: https://github.com/nodejs/node/issues/45987
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com >
2023-01-18 18:07:26 +00:00
Filip Skokan
2d59d6b8b5
crypto: add KeyObject Symbol.toStringTag
...
PR-URL: https://github.com/nodejs/node/pull/46043
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2023-01-03 16:34:41 +00:00
Filip Skokan
560b24398c
crypto: fix CryptoKey prototype WPT
...
PR-URL: https://github.com/nodejs/node/pull/45857
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2022-12-20 13:35:58 +00:00
Filip Skokan
43b7189883
crypto: fix CryptoKey WebIDL conformance
...
PR-URL: https://github.com/nodejs/node/pull/45855
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2022-12-16 14:11:52 +01:00
Filip Skokan
d94833cf91
crypto: handle invalid prepareAsymmetricKey JWK inputs
...
Fixes #44471
PR-URL: https://github.com/nodejs/node/pull/44475
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
2022-09-03 12:36:20 +00:00
Filip Skokan
85107bdd66
crypto: allow zero-length secret KeyObject
...
PR-URL: https://github.com/nodejs/node/pull/44201
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2022-08-12 21:36:27 +02:00
Rich Trott
0e660ce09f
crypto: remove unneeded guard
...
createCFRGRaw() will always return an object. The error for an undefined
return value will never occur.
PR-URL: https://github.com/nodejs/node/pull/43856
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Filip Skokan <panva.ip@gmail.com >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2022-07-18 05:49:16 +01:00
Filip Skokan
7e5da97d15
crypto: add CFRG curves to Web Crypto API
...
PR-URL: https://github.com/nodejs/node/pull/42507
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2022-06-04 07:20:27 +01:00
Antoine du Hamel
06d8606960
lib: use null-prototype objects for property descriptors
...
Refs: https://github.com/nodejs/node/pull/42921
PR-URL: https://github.com/nodejs/node/pull/43270
Reviewed-By: Paolo Insogna <paolo@cowtech.it >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com >
2022-06-03 09:23:58 +01:00
Filip Skokan
aa97c9d973
crypto: add KeyObject.prototype.equals method
...
PR-URL: https://github.com/nodejs/node/pull/42093
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2022-02-26 13:51:09 +00:00
Shelley Vohr
17bb7b2936
crypto: handle initEDRaw pkey failure
...
PR-URL: https://github.com/nodejs/node/pull/40188
Reviewed-By: Filip Skokan <panva.ip@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-09-25 07:50:12 -07:00
Voltrex
55379eb454
crypto: use validateObject
...
The `validateObject()` validator can be used to cleanup validation and
keep consistency.
PR-URL: https://github.com/nodejs/node/pull/39872
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com >
Reviewed-By: Khaidi Chu <i@2333.moe >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-09-17 06:38:54 +00:00
Filip Skokan
4441c3e3b5
crypto: fix JWK RSA-PSS SubtleCrypto.exportKey
...
PR-URL: https://github.com/nodejs/node/pull/39828
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-08-25 08:24:41 -07:00
Mestery
2913211ba8
lib: use ERR_ILLEGAL_CONSTRUCTOR
...
Use ERR_ILLEGAL_CONSTRUCTOR error instead of `illegal constructor` or
`Illegal constructor` TypeError.
PR-URL: https://github.com/nodejs/node/pull/39556
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
2021-08-01 14:24:26 +00:00
himself65
257312ac75
crypto: fix generateKeyPair with encoding 'jwk'
...
Fixes: https://github.com/nodejs/node/issues/39205
PR-URL: https://github.com/nodejs/node/pull/39319
Reviewed-By: Filip Skokan <panva.ip@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-07-26 08:48:54 -07:00
Filip Skokan
3ee1f9a29a
util: add util.types.isKeyObject and util.types.isCryptoKey
...
closes #38611
PR-URL: https://github.com/nodejs/node/pull/38619
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2021-05-17 10:29:18 +02:00
Filip Skokan
117e293c37
crypto: support JWK objects in create*Key
...
PR-URL: https://github.com/nodejs/node/pull/37254
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2021-03-10 18:50:08 +01:00
Antoine du Hamel
f34d8de65a
lib: remove use of array destructuring
...
PR-URL: https://github.com/nodejs/node/pull/36818
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-03-03 19:53:24 +01:00
Rich Trott
b461a1b125
doc,lib: prepare for stricter multi-line array linting
...
We're about to turn on a requirement for dangling commas.
PR-URL: https://github.com/nodejs/node/pull/37088
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2021-02-19 09:55:35 -08:00
Antoine du Hamel
08a2383a5e
crypto: refactor to avoid unsafe array iteration
...
PR-URL: https://github.com/nodejs/node/pull/37364
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com >
2021-02-19 12:55:54 +01:00
Filip Skokan
a8d7de1efb
crypto: add keyObject.export() 'jwk' format option
...
Adds [JWK](https://tools.ietf.org/html/rfc7517 ) keyObject.export format
option.
Supported key types: `ec`, `rsa`, `ed25519`, `ed448`, `x25519`, `x448`,
and symmetric keys, resulting in JWK `kty` (Key Type) values `EC`,
`RSA`, `OKP`, and `oct`.
`rsa-pss` is not supported since the JWK format does not support
PSS Parameters.
`EC` JWK curves supported are `P-256`, `secp256k1`, `P-384`, and `P-521`
PR-URL: https://github.com/nodejs/node/pull/37081
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2021-02-02 23:16:51 +01:00