Commit Graph

31 Commits

Author SHA1 Message Date
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
cd6b86bb5a
crypto: ensure valid point on elliptic curve in SubtleCrypto.importKey
PR-URL: https://github.com/nodejs/node/pull/50234
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2023-10-20 16:25:42 +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
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
a6dd939ce8 crypto: refactor verify acceptable key usage functions
PR-URL: https://github.com/nodejs/node/pull/45569
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2022-11-26 14:41:28 +00:00
Filip Skokan
8fef4746fc crypto: fix ECDH webcrypto public CryptoKey usages
PR-URL: https://github.com/nodejs/node/pull/45569
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2022-11-26 14:41:27 +00:00
Filip Skokan
e73e89eedf crypto: use DataError for webcrypto keyData import failures
PR-URL: https://github.com/nodejs/node/pull/45569
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2022-11-26 14:41:24 +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
Antoine du Hamel
eb32a8443a
lib: add lint rule to protect against Object.prototype.then pollution
PR-URL: https://github.com/nodejs/node/pull/45061
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
2022-10-21 03:12:03 +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
4b7761441e crypto: fix webcrypto EC key namedCurve validation errors
PR-URL: https://github.com/nodejs/node/pull/44172
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2022-08-12 21:30:41 +02: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
4420d5218c
crypto: fix webcrypto JWK EC and OKP import crv check
PR-URL: https://github.com/nodejs/node/pull/43346
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2022-06-15 12:44:07 +01: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
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
gc
28f711b552
crypto: remove incorrect constructor invocation
PR-URL: https://github.com/nodejs/node/pull/40300
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
2021-10-05 20:51:54 +02: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
Filip Skokan
453bb6be99
crypto: fix webcrypto ed(25519|448) spki/pkcs8 import
PR-URL: https://github.com/nodejs/node/pull/40131
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2021-09-20 08:29:46 +02:00
Filip Skokan
5d34ef509e crypto: check webcrypto asymmetric key types during importKey
PR-URL: https://github.com/nodejs/node/pull/39962
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-09-07 18:25:39 +00: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
Filip Skokan
e8cb6446ef crypto: reconcile oneshot sign/verify sync and async implementations
PR-URL: https://github.com/nodejs/node/pull/37816
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2021-04-08 10:08:26 +02:00
Filip Skokan
25985d6522
crypto: add optional callback to crypto.sign and crypto.verify
PR-URL: https://github.com/nodejs/node/pull/37500
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2021-03-10 15:11:17 -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
Filip Skokan
8ddee73efc crypto: check ed/x webcrypto key import algorithm names
PR-URL: https://github.com/nodejs/node/pull/37305
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-02-26 11:16:52 +01: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
51249a11c0 crypto: fix subtle.importKey JWK OKP public key import
PR-URL: https://github.com/nodejs/node/pull/37255
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2021-02-09 21:26:45 +01:00
Filip Skokan
8b65004193 crypto: generateKeyPair('ec') should not support NODE-ED* and NODE-X*
Fixes https://github.com/nodejs/node/issues/37055

PR-URL: https://github.com/nodejs/node/pull/37063
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-01-27 14:55:03 +01:00
James M Snell
bd899bc656
crypto: experimental (Ed/X)25519/(Ed/X)448 support
Implements initial experimental support for Curve25519 and
Curve448 support for both ECDH and sign/verify in Web Crypto.

Introduced as a Node.js-specific extension to Web Crypto.

Signed-off-by: James M Snell <jasnell@gmail.com>
Fixes: https://github.com/nodejs/node/issues/36076

PR-URL: https://github.com/nodejs/node/pull/36879
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
2021-01-18 08:12:08 -08:00
Filip Skokan
e8fe38f7cf crypto: fix webcrypto ECDH JWK import
This fixes the importKey operation when importing a JWK for the ECDH
algorithm. As per the Web Crypto API specification the JWK `alg`
property is not checked (as opposed to ECDSA).

PR-URL: https://github.com/nodejs/node/pull/35855
Fixes: https://github.com/nodejs/node/issues/35812
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2020-10-30 05:48:12 +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