Skip to content

Commit 4d09c04

Browse files
authored
crypto: move DEP0203 and DEP0204 to End-of-Life
Moves support for passing CryptoKey instances to node:crypto APIs to End-of-Life status (DEP0203). Moves support for passing a non-extractable CryptoKey instances to KeyObject.from() End-of-Life status (DEP0204). Closes #55293 Signed-off-by: Filip Skokan <panva.ip@gmail.com> PR-URL: #63188 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
1 parent 3fd0e11 commit 4d09c04

10 files changed

Lines changed: 181 additions & 131 deletions

doc/api/crypto.md

Lines changed: 62 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2256,6 +2256,10 @@ be listed in the `transferList` argument.
22562256
<!-- YAML
22572257
added: v15.0.0
22582258
changes:
2259+
- version: REPLACEME
2260+
pr-url: https://github.com/nodejs/node/pull/63188
2261+
description: Passing a non-extractable CryptoKey as `key` is no longer
2262+
supported.
22592263
- version: v26.0.0
22602264
pr-url: https://github.com/nodejs/node/pull/62453
22612265
description: Passing a non-extractable CryptoKey as `key` is deprecated.
@@ -2264,11 +2268,11 @@ changes:
22642268
* `key` {CryptoKey}
22652269
* Returns: {KeyObject}
22662270

2267-
Returns the underlying {KeyObject} of a {CryptoKey}. The returned {KeyObject}
2268-
does not retain any of the restrictions imposed by the Web Crypto API on the
2269-
original {CryptoKey}, such as the allowed key usages, the algorithm or hash
2270-
algorithm bindings, and the extractability flag. In particular, the underlying
2271-
key material of the returned {KeyObject} can always be exported.
2271+
Returns a {KeyObject} representation of the underlying key material of an
2272+
extractable {CryptoKey}.
2273+
The returned {KeyObject} does not retain any of the restrictions imposed by
2274+
the Web Crypto API on the original {CryptoKey}, such as the allowed key usages,
2275+
the algorithm or hash algorithm bindings.
22722276

22732277
```mjs
22742278
const { KeyObject } = await import('node:crypto');
@@ -2622,6 +2626,9 @@ console.log(verify.verify(publicKey, signature));
26222626
<!-- YAML
26232627
added: v0.1.92
26242628
changes:
2629+
- version: REPLACEME
2630+
pr-url: https://github.com/nodejs/node/pull/63188
2631+
description: Passing a CryptoKey as `privateKey` is no longer supported.
26252632
- version: v15.0.0
26262633
pr-url: https://github.com/nodejs/node/pull/35093
26272634
description: The privateKey can also be an ArrayBuffer and CryptoKey.
@@ -2643,7 +2650,7 @@ changes:
26432650

26442651
<!--lint disable maximum-line-length remark-lint-->
26452652

2646-
* `privateKey` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject|CryptoKey}
2653+
* `privateKey` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject}
26472654
* `dsaEncoding` {string}
26482655
* `padding` {integer}
26492656
* `saltLength` {integer}
@@ -2752,6 +2759,9 @@ This can be called many times with new data as it is streamed.
27522759
<!-- YAML
27532760
added: v0.1.92
27542761
changes:
2762+
- version: REPLACEME
2763+
pr-url: https://github.com/nodejs/node/pull/63188
2764+
description: Passing a CryptoKey as `key` is no longer supported.
27552765
- version: v15.0.0
27562766
pr-url: https://github.com/nodejs/node/pull/35093
27572767
description: The key can also be an ArrayBuffer and CryptoKey.
@@ -2773,7 +2783,7 @@ changes:
27732783

27742784
<!--lint disable maximum-line-length remark-lint-->
27752785

2776-
* `key` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject|CryptoKey}
2786+
* `key` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject}
27772787
* `dsaEncoding` {string}
27782788
* `padding` {integer}
27792789
* `saltLength` {integer}
@@ -3530,6 +3540,9 @@ operations. The specific constants currently defined are described in
35303540
<!-- YAML
35313541
added: v0.1.94
35323542
changes:
3543+
- version: REPLACEME
3544+
pr-url: https://github.com/nodejs/node/pull/63188
3545+
description: Passing a CryptoKey as `key` is no longer supported.
35333546
- version: v26.0.0
35343547
pr-url: https://github.com/nodejs/node/pull/62453
35353548
description: Passing a CryptoKey as `key` is deprecated.
@@ -3566,7 +3579,7 @@ changes:
35663579
-->
35673580

35683581
* `algorithm` {string}
3569-
* `key` {string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject|CryptoKey}
3582+
* `key` {string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject}
35703583
* `iv` {string|ArrayBuffer|Buffer|TypedArray|DataView|null}
35713584
* `options` {Object} [`stream.transform` options][]
35723585
* Returns: {Cipheriv}
@@ -3607,6 +3620,9 @@ given IV will be.
36073620
<!-- YAML
36083621
added: v0.1.94
36093622
changes:
3623+
- version: REPLACEME
3624+
pr-url: https://github.com/nodejs/node/pull/63188
3625+
description: Passing a CryptoKey as `key` is no longer supported.
36103626
- version: v26.0.0
36113627
pr-url: https://github.com/nodejs/node/pull/62453
36123628
description: Passing a CryptoKey as `key` is deprecated.
@@ -3639,7 +3655,7 @@ changes:
36393655
-->
36403656

36413657
* `algorithm` {string}
3642-
* `key` {string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject|CryptoKey}
3658+
* `key` {string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject}
36433659
* `iv` {string|ArrayBuffer|Buffer|TypedArray|DataView|null}
36443660
* `options` {Object} [`stream.transform` options][]
36453661
* Returns: {Decipheriv}
@@ -3833,6 +3849,9 @@ input.on('readable', () => {
38333849
<!-- YAML
38343850
added: v0.1.94
38353851
changes:
3852+
- version: REPLACEME
3853+
pr-url: https://github.com/nodejs/node/pull/63188
3854+
description: Passing a CryptoKey as `key` is no longer supported.
38363855
- version: v26.0.0
38373856
pr-url: https://github.com/nodejs/node/pull/62453
38383857
description: Passing a CryptoKey as `key` is deprecated.
@@ -3847,7 +3866,7 @@ changes:
38473866
-->
38483867

38493868
* `algorithm` {string}
3850-
* `key` {string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject|CryptoKey}
3869+
* `key` {string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject}
38513870
* `options` {Object} [`stream.transform` options][]
38523871
* `encoding` {string} The string encoding to use when `key` is a string.
38533872
* Returns: {Hmac}
@@ -3926,6 +3945,9 @@ input.on('readable', () => {
39263945
<!-- YAML
39273946
added: v11.6.0
39283947
changes:
3948+
- version: REPLACEME
3949+
pr-url: https://github.com/nodejs/node/pull/63188
3950+
description: Passing a CryptoKey as `key` is no longer supported.
39293951
- version: v26.1.0
39303952
pr-url: https://github.com/nodejs/node/pull/62706
39313953
description: Added JWK format support for ML-KEM and SLH-DSA
@@ -3981,6 +4003,9 @@ of the passphrase is limited to 1024 bytes.
39814003
<!-- YAML
39824004
added: v11.6.0
39834005
changes:
4006+
- version: REPLACEME
4007+
pr-url: https://github.com/nodejs/node/pull/63188
4008+
description: Passing a CryptoKey as `key` is no longer supported.
39844009
- version: v26.1.0
39854010
pr-url: https://github.com/nodejs/node/pull/62706
39864011
description: Added JWK format support for ML-KEM and SLH-DSA
@@ -5212,6 +5237,9 @@ An array of supported digest functions can be retrieved using
52125237
<!-- YAML
52135238
added: v0.11.14
52145239
changes:
5240+
- version: REPLACEME
5241+
pr-url: https://github.com/nodejs/node/pull/63188
5242+
description: Passing a CryptoKey as `privateKey` is no longer supported.
52155243
- version:
52165244
- v21.6.2
52175245
- v20.11.1
@@ -5238,7 +5266,7 @@ changes:
52385266

52395267
<!--lint disable maximum-line-length remark-lint-->
52405268

5241-
* `privateKey` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject|CryptoKey}
5269+
* `privateKey` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject}
52425270
* `oaepHash` {string} The hash function to use for OAEP padding and MGF1.
52435271
**Default:** `'sha1'`
52445272
* `oaepLabel` {string|ArrayBuffer|Buffer|TypedArray|DataView} The label to
@@ -5270,6 +5298,9 @@ attempting to use `RSA_PKCS1_PADDING` will fail.
52705298
<!-- YAML
52715299
added: v1.1.0
52725300
changes:
5301+
- version: REPLACEME
5302+
pr-url: https://github.com/nodejs/node/pull/63188
5303+
description: Passing a CryptoKey as `privateKey` is no longer supported.
52735304
- version: v15.0.0
52745305
pr-url: https://github.com/nodejs/node/pull/35093
52755306
description: Added string, ArrayBuffer, and CryptoKey as allowable key
@@ -5283,8 +5314,8 @@ changes:
52835314

52845315
<!--lint disable maximum-line-length remark-lint-->
52855316

5286-
* `privateKey` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject|CryptoKey}
5287-
* `key` {string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject|CryptoKey}
5317+
* `privateKey` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject}
5318+
* `key` {string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject}
52885319
A PEM encoded private key.
52895320
* `passphrase` {string|ArrayBuffer|Buffer|TypedArray|DataView} An optional
52905321
passphrase for the private key.
@@ -5311,6 +5342,9 @@ object, the `padding` property can be passed. Otherwise, this function uses
53115342
<!-- YAML
53125343
added: v1.1.0
53135344
changes:
5345+
- version: REPLACEME
5346+
pr-url: https://github.com/nodejs/node/pull/63188
5347+
description: Passing a CryptoKey as `key` is no longer supported.
53145348
- version: v15.0.0
53155349
pr-url: https://github.com/nodejs/node/pull/35093
53165350
description: Added string, ArrayBuffer, and CryptoKey as allowable key
@@ -5324,7 +5358,7 @@ changes:
53245358

53255359
<!--lint disable maximum-line-length remark-lint-->
53265360

5327-
* `key` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject|CryptoKey}
5361+
* `key` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject}
53285362
* `passphrase` {string|ArrayBuffer|Buffer|TypedArray|DataView} An optional
53295363
passphrase for the private key.
53305364
* `padding` {crypto.constants} An optional padding value defined in
@@ -5353,6 +5387,9 @@ be passed instead of a public key.
53535387
<!-- YAML
53545388
added: v0.11.14
53555389
changes:
5390+
- version: REPLACEME
5391+
pr-url: https://github.com/nodejs/node/pull/63188
5392+
description: Passing a CryptoKey as `key` is no longer supported.
53565393
- version: v15.0.0
53575394
pr-url: https://github.com/nodejs/node/pull/35093
53585395
description: Added string, ArrayBuffer, and CryptoKey as allowable key
@@ -5372,9 +5409,9 @@ changes:
53725409

53735410
<!--lint disable maximum-line-length remark-lint-->
53745411

5375-
* `key` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject|CryptoKey}
5376-
* `key` {string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject|CryptoKey}
5377-
A PEM encoded public or private key, {KeyObject}, or {CryptoKey}.
5412+
* `key` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject}
5413+
* `key` {string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject}
5414+
A PEM encoded public or private key, or {KeyObject}.
53785415
* `oaepHash` {string} The hash function to use for OAEP padding and MGF1.
53795416
**Default:** `'sha1'`
53805417
* `oaepLabel` {string|ArrayBuffer|Buffer|TypedArray|DataView} The label to
@@ -6096,6 +6133,9 @@ Throws an error if FIPS mode is not available.
60966133
<!-- YAML
60976134
added: v12.0.0
60986135
changes:
6136+
- version: REPLACEME
6137+
pr-url: https://github.com/nodejs/node/pull/63188
6138+
description: Passing a CryptoKey as `key` is no longer supported.
60996139
- version:
61006140
- v26.1.0
61016141
- v24.16.0
@@ -6129,7 +6169,7 @@ changes:
61296169

61306170
* `algorithm` {string | null | undefined}
61316171
* `data` {ArrayBuffer|Buffer|SharedArrayBuffer|TypedArray|DataView|string}
6132-
* `key` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject|CryptoKey}
6172+
* `key` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject}
61336173
* `callback` {Function}
61346174
* `err` {Error}
61356175
* `signature` {Buffer}
@@ -6227,6 +6267,9 @@ not introduce timing vulnerabilities.
62276267
<!-- YAML
62286268
added: v12.0.0
62296269
changes:
6270+
- version: REPLACEME
6271+
pr-url: https://github.com/nodejs/node/pull/63188
6272+
description: Passing a CryptoKey as `key` is no longer supported.
62306273
- version:
62316274
- v26.1.0
62326275
- v24.16.0
@@ -6263,7 +6306,7 @@ changes:
62636306

62646307
* `algorithm` {string|null|undefined}
62656308
* `data` {ArrayBuffer|Buffer|SharedArrayBuffer|TypedArray|DataView|string}
6266-
* `key` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject|CryptoKey}
6309+
* `key` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject}
62676310
* `signature` {ArrayBuffer|Buffer|SharedArrayBuffer|TypedArray|DataView}
62686311
* `callback` {Function}
62696312
* `err` {Error}

doc/api/deprecations.md

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4489,6 +4489,9 @@ const server = http2.createSecureServer({
44894489
44904490
<!-- YAML
44914491
changes:
4492+
- version: REPLACEME
4493+
pr-url: https://github.com/nodejs/node/pull/63188
4494+
description: End-of-Life.
44924495
- version: v26.0.0
44934496
pr-url: https://github.com/nodejs/node/pull/62453
44944497
description: Runtime deprecation.
@@ -4499,23 +4502,17 @@ changes:
44994502
description: Documentation-only deprecation.
45004503
-->
45014504
4502-
Type: Runtime
4505+
Type: End-of-Life
45034506
4504-
Passing a [`CryptoKey`][] to `node:crypto` functions is deprecated and
4505-
will throw an error in a future version. This includes
4506-
[`crypto.createPublicKey()`][], [`crypto.createPrivateKey()`][],
4507-
[`crypto.sign()`][], [`crypto.verify()`][],
4508-
[`crypto.publicEncrypt()`][], [`crypto.publicDecrypt()`][],
4509-
[`crypto.privateEncrypt()`][], [`crypto.privateDecrypt()`][],
4510-
[`Sign.prototype.sign()`][], [`Verify.prototype.verify()`][],
4511-
[`crypto.createHmac()`][], [`crypto.createCipheriv()`][],
4512-
[`crypto.createDecipheriv()`][], [`crypto.encapsulate()`][], and
4513-
[`crypto.decapsulate()`][].
4507+
Passing a [`CryptoKey`][] to `node:crypto` functions is no longer supported.
45144508
45154509
### DEP0204: `KeyObject.from()` with non-extractable `CryptoKey`
45164510
45174511
<!-- YAML
45184512
changes:
4513+
- version: REPLACEME
4514+
pr-url: https://github.com/nodejs/node/pull/63188
4515+
description: End-of-Life.
45194516
- version: v26.0.0
45204517
pr-url: https://github.com/nodejs/node/pull/62453
45214518
description: Runtime deprecation.
@@ -4526,10 +4523,10 @@ changes:
45264523
description: Documentation-only deprecation.
45274524
-->
45284525
4529-
Type: Runtime
4526+
Type: End-of-Life
45304527
45314528
Passing a non-extractable [`CryptoKey`][] to [`KeyObject.from()`][] is
4532-
deprecated and will throw an error in a future version.
4529+
no longer supported.
45334530
45344531
### DEP0205: `module.register()`
45354532
@@ -4658,9 +4655,7 @@ successfully before the response closed.
46584655
[`ReadStream.open()`]: fs.md#class-fsreadstream
46594656
[`Server.getConnections()`]: net.md#servergetconnectionscallback
46604657
[`Server.listen({fd: <number>})`]: net.md#serverlistenhandle-backlog-callback
4661-
[`Sign.prototype.sign()`]: crypto.md#signsignprivatekey-outputencoding
46624658
[`String.prototype.toWellFormed`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toWellFormed
4663-
[`Verify.prototype.verify()`]: crypto.md#verifyverifyobject-signature-signatureencoding
46644659
[`WriteStream.open()`]: fs.md#class-fswritestream
46654660
[`assert`]: assert.md
46664661
[`asyncResource.runInAsyncScope()`]: async_context.md#asyncresourceruninasyncscopefn-thisarg-args
@@ -4678,21 +4673,11 @@ successfully before the response closed.
46784673
[`crypto.createDecipheriv()`]: crypto.md#cryptocreatedecipherivalgorithm-key-iv-options
46794674
[`crypto.createHash()`]: crypto.md#cryptocreatehashalgorithm-options
46804675
[`crypto.createHmac()`]: crypto.md#cryptocreatehmacalgorithm-key-options
4681-
[`crypto.createPrivateKey()`]: crypto.md#cryptocreateprivatekeykey
4682-
[`crypto.createPublicKey()`]: crypto.md#cryptocreatepublickeykey
4683-
[`crypto.decapsulate()`]: crypto.md#cryptodecapsulatekey-ciphertext-callback
4684-
[`crypto.encapsulate()`]: crypto.md#cryptoencapsulatekey-callback
46854676
[`crypto.fips`]: crypto.md#cryptofips
46864677
[`crypto.pbkdf2()`]: crypto.md#cryptopbkdf2password-salt-iterations-keylen-digest-callback
4687-
[`crypto.privateDecrypt()`]: crypto.md#cryptoprivatedecryptprivatekey-buffer
4688-
[`crypto.privateEncrypt()`]: crypto.md#cryptoprivateencryptprivatekey-buffer
4689-
[`crypto.publicDecrypt()`]: crypto.md#cryptopublicdecryptkey-buffer
4690-
[`crypto.publicEncrypt()`]: crypto.md#cryptopublicencryptkey-buffer
46914678
[`crypto.randomBytes()`]: crypto.md#cryptorandombytessize-callback
46924679
[`crypto.scrypt()`]: crypto.md#cryptoscryptpassword-salt-keylen-options-callback
46934680
[`crypto.setEngine()`]: crypto.md#cryptosetengineengine-flags
4694-
[`crypto.sign()`]: crypto.md#cryptosignalgorithm-data-key-callback
4695-
[`crypto.verify()`]: crypto.md#cryptoverifyalgorithm-data-key-signature-callback
46964681
[`decipher.final()`]: crypto.md#decipherfinaloutputencoding
46974682
[`decipher.setAuthTag()`]: crypto.md#deciphersetauthtagbuffer-encoding
46984683
[`dirent.parentPath`]: fs.md#direntparentpath

0 commit comments

Comments
 (0)