Skip to content

Commit 3eb5d08

Browse files
committed
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>
1 parent a9b98b2 commit 3eb5d08

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
@@ -2258,6 +2258,10 @@ be listed in the `transferList` argument.
22582258
<!-- YAML
22592259
added: v15.0.0
22602260
changes:
2261+
- version: REPLACEME
2262+
pr-url: https://github.com/nodejs/node/pull/63188
2263+
description: Passing a non-extractable CryptoKey as `key` is no longer
2264+
supported.
22612265
- version: v26.0.0
22622266
pr-url: https://github.com/nodejs/node/pull/62453
22632267
description: Passing a non-extractable CryptoKey as `key` is deprecated.
@@ -2266,11 +2270,11 @@ changes:
22662270
* `key` {CryptoKey}
22672271
* Returns: {KeyObject}
22682272

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

22752279
```mjs
22762280
const { KeyObject } = await import('node:crypto');
@@ -2624,6 +2628,9 @@ console.log(verify.verify(publicKey, signature));
26242628
<!-- YAML
26252629
added: v0.1.92
26262630
changes:
2631+
- version: REPLACEME
2632+
pr-url: https://github.com/nodejs/node/pull/63188
2633+
description: Passing a CryptoKey as `privateKey` is no longer supported.
26272634
- version: v15.0.0
26282635
pr-url: https://github.com/nodejs/node/pull/35093
26292636
description: The privateKey can also be an ArrayBuffer and CryptoKey.
@@ -2645,7 +2652,7 @@ changes:
26452652

26462653
<!--lint disable maximum-line-length remark-lint-->
26472654

2648-
* `privateKey` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject|CryptoKey}
2655+
* `privateKey` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject}
26492656
* `dsaEncoding` {string}
26502657
* `padding` {integer}
26512658
* `saltLength` {integer}
@@ -2754,6 +2761,9 @@ This can be called many times with new data as it is streamed.
27542761
<!-- YAML
27552762
added: v0.1.92
27562763
changes:
2764+
- version: REPLACEME
2765+
pr-url: https://github.com/nodejs/node/pull/63188
2766+
description: Passing a CryptoKey as `key` is no longer supported.
27572767
- version: v15.0.0
27582768
pr-url: https://github.com/nodejs/node/pull/35093
27592769
description: The key can also be an ArrayBuffer and CryptoKey.
@@ -2775,7 +2785,7 @@ changes:
27752785

27762786
<!--lint disable maximum-line-length remark-lint-->
27772787

2778-
* `key` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject|CryptoKey}
2788+
* `key` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject}
27792789
* `dsaEncoding` {string}
27802790
* `padding` {integer}
27812791
* `saltLength` {integer}
@@ -3536,6 +3546,9 @@ operations. The specific constants currently defined are described in
35363546
<!-- YAML
35373547
added: v0.1.94
35383548
changes:
3549+
- version: REPLACEME
3550+
pr-url: https://github.com/nodejs/node/pull/63188
3551+
description: Passing a CryptoKey as `key` is no longer supported.
35393552
- version: v26.0.0
35403553
pr-url: https://github.com/nodejs/node/pull/62453
35413554
description: Passing a CryptoKey as `key` is deprecated.
@@ -3572,7 +3585,7 @@ changes:
35723585
-->
35733586

35743587
* `algorithm` {string}
3575-
* `key` {string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject|CryptoKey}
3588+
* `key` {string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject}
35763589
* `iv` {string|ArrayBuffer|Buffer|TypedArray|DataView|null}
35773590
* `options` {Object} [`stream.transform` options][]
35783591
* Returns: {Cipheriv}
@@ -3613,6 +3626,9 @@ given IV will be.
36133626
<!-- YAML
36143627
added: v0.1.94
36153628
changes:
3629+
- version: REPLACEME
3630+
pr-url: https://github.com/nodejs/node/pull/63188
3631+
description: Passing a CryptoKey as `key` is no longer supported.
36163632
- version: v26.0.0
36173633
pr-url: https://github.com/nodejs/node/pull/62453
36183634
description: Passing a CryptoKey as `key` is deprecated.
@@ -3645,7 +3661,7 @@ changes:
36453661
-->
36463662

36473663
* `algorithm` {string}
3648-
* `key` {string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject|CryptoKey}
3664+
* `key` {string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject}
36493665
* `iv` {string|ArrayBuffer|Buffer|TypedArray|DataView|null}
36503666
* `options` {Object} [`stream.transform` options][]
36513667
* Returns: {Decipheriv}
@@ -3839,6 +3855,9 @@ input.on('readable', () => {
38393855
<!-- YAML
38403856
added: v0.1.94
38413857
changes:
3858+
- version: REPLACEME
3859+
pr-url: https://github.com/nodejs/node/pull/63188
3860+
description: Passing a CryptoKey as `key` is no longer supported.
38423861
- version: v26.0.0
38433862
pr-url: https://github.com/nodejs/node/pull/62453
38443863
description: Passing a CryptoKey as `key` is deprecated.
@@ -3853,7 +3872,7 @@ changes:
38533872
-->
38543873

38553874
* `algorithm` {string}
3856-
* `key` {string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject|CryptoKey}
3875+
* `key` {string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject}
38573876
* `options` {Object} [`stream.transform` options][]
38583877
* `encoding` {string} The string encoding to use when `key` is a string.
38593878
* Returns: {Hmac}
@@ -3932,6 +3951,9 @@ input.on('readable', () => {
39323951
<!-- YAML
39333952
added: v11.6.0
39343953
changes:
3954+
- version: REPLACEME
3955+
pr-url: https://github.com/nodejs/node/pull/63188
3956+
description: Passing a CryptoKey as `key` is no longer supported.
39353957
- version: v26.1.0
39363958
pr-url: https://github.com/nodejs/node/pull/62706
39373959
description: Added JWK format support for ML-KEM and SLH-DSA
@@ -3987,6 +4009,9 @@ of the passphrase is limited to 1024 bytes.
39874009
<!-- YAML
39884010
added: v11.6.0
39894011
changes:
4012+
- version: REPLACEME
4013+
pr-url: https://github.com/nodejs/node/pull/63188
4014+
description: Passing a CryptoKey as `key` is no longer supported.
39904015
- version: v26.1.0
39914016
pr-url: https://github.com/nodejs/node/pull/62706
39924017
description: Added JWK format support for ML-KEM and SLH-DSA
@@ -5222,6 +5247,9 @@ An array of supported digest functions can be retrieved using
52225247
<!-- YAML
52235248
added: v0.11.14
52245249
changes:
5250+
- version: REPLACEME
5251+
pr-url: https://github.com/nodejs/node/pull/63188
5252+
description: Passing a CryptoKey as `privateKey` is no longer supported.
52255253
- version:
52265254
- v21.6.2
52275255
- v20.11.1
@@ -5248,7 +5276,7 @@ changes:
52485276

52495277
<!--lint disable maximum-line-length remark-lint-->
52505278

5251-
* `privateKey` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject|CryptoKey}
5279+
* `privateKey` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject}
52525280
* `oaepHash` {string} The hash function to use for OAEP padding and MGF1.
52535281
**Default:** `'sha1'`
52545282
* `oaepLabel` {string|ArrayBuffer|Buffer|TypedArray|DataView} The label to
@@ -5280,6 +5308,9 @@ attempting to use `RSA_PKCS1_PADDING` will fail.
52805308
<!-- YAML
52815309
added: v1.1.0
52825310
changes:
5311+
- version: REPLACEME
5312+
pr-url: https://github.com/nodejs/node/pull/63188
5313+
description: Passing a CryptoKey as `privateKey` is no longer supported.
52835314
- version: v15.0.0
52845315
pr-url: https://github.com/nodejs/node/pull/35093
52855316
description: Added string, ArrayBuffer, and CryptoKey as allowable key
@@ -5293,8 +5324,8 @@ changes:
52935324

52945325
<!--lint disable maximum-line-length remark-lint-->
52955326

5296-
* `privateKey` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject|CryptoKey}
5297-
* `key` {string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject|CryptoKey}
5327+
* `privateKey` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject}
5328+
* `key` {string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject}
52985329
A PEM encoded private key.
52995330
* `passphrase` {string|ArrayBuffer|Buffer|TypedArray|DataView} An optional
53005331
passphrase for the private key.
@@ -5321,6 +5352,9 @@ object, the `padding` property can be passed. Otherwise, this function uses
53215352
<!-- YAML
53225353
added: v1.1.0
53235354
changes:
5355+
- version: REPLACEME
5356+
pr-url: https://github.com/nodejs/node/pull/63188
5357+
description: Passing a CryptoKey as `key` is no longer supported.
53245358
- version: v15.0.0
53255359
pr-url: https://github.com/nodejs/node/pull/35093
53265360
description: Added string, ArrayBuffer, and CryptoKey as allowable key
@@ -5334,7 +5368,7 @@ changes:
53345368

53355369
<!--lint disable maximum-line-length remark-lint-->
53365370

5337-
* `key` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject|CryptoKey}
5371+
* `key` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject}
53385372
* `passphrase` {string|ArrayBuffer|Buffer|TypedArray|DataView} An optional
53395373
passphrase for the private key.
53405374
* `padding` {crypto.constants} An optional padding value defined in
@@ -5363,6 +5397,9 @@ be passed instead of a public key.
53635397
<!-- YAML
53645398
added: v0.11.14
53655399
changes:
5400+
- version: REPLACEME
5401+
pr-url: https://github.com/nodejs/node/pull/63188
5402+
description: Passing a CryptoKey as `key` is no longer supported.
53665403
- version: v15.0.0
53675404
pr-url: https://github.com/nodejs/node/pull/35093
53685405
description: Added string, ArrayBuffer, and CryptoKey as allowable key
@@ -5382,9 +5419,9 @@ changes:
53825419

53835420
<!--lint disable maximum-line-length remark-lint-->
53845421

5385-
* `key` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject|CryptoKey}
5386-
* `key` {string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject|CryptoKey}
5387-
A PEM encoded public or private key, {KeyObject}, or {CryptoKey}.
5422+
* `key` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject}
5423+
* `key` {string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject}
5424+
A PEM encoded public or private key, or {KeyObject}.
53885425
* `oaepHash` {string} The hash function to use for OAEP padding and MGF1.
53895426
**Default:** `'sha1'`
53905427
* `oaepLabel` {string|ArrayBuffer|Buffer|TypedArray|DataView} The label to
@@ -6104,6 +6141,9 @@ Throws an error if FIPS mode is not available.
61046141
<!-- YAML
61056142
added: v12.0.0
61066143
changes:
6144+
- version: REPLACEME
6145+
pr-url: https://github.com/nodejs/node/pull/63188
6146+
description: Passing a CryptoKey as `key` is no longer supported.
61076147
- version: v26.0.0
61086148
pr-url: https://github.com/nodejs/node/pull/62474
61096149
description: Add support for Ed25519 context parameter.
@@ -6135,7 +6175,7 @@ changes:
61356175

61366176
* `algorithm` {string | null | undefined}
61376177
* `data` {ArrayBuffer|Buffer|TypedArray|DataView}
6138-
* `key` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject|CryptoKey}
6178+
* `key` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject}
61396179
* `callback` {Function}
61406180
* `err` {Error}
61416181
* `signature` {Buffer}
@@ -6233,6 +6273,9 @@ not introduce timing vulnerabilities.
62336273
<!-- YAML
62346274
added: v12.0.0
62356275
changes:
6276+
- version: REPLACEME
6277+
pr-url: https://github.com/nodejs/node/pull/63188
6278+
description: Passing a CryptoKey as `key` is no longer supported.
62366279
- version: v26.0.0
62376280
pr-url: https://github.com/nodejs/node/pull/62474
62386281
description: Add support for Ed25519 context parameter.
@@ -6267,7 +6310,7 @@ changes:
62676310

62686311
* `algorithm` {string|null|undefined}
62696312
* `data` {ArrayBuffer| Buffer|TypedArray|DataView}
6270-
* `key` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject|CryptoKey}
6313+
* `key` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject}
62716314
* `signature` {ArrayBuffer|Buffer|TypedArray|DataView}
62726315
* `callback` {Function}
62736316
* `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
@@ -4600,9 +4597,7 @@ will throw an error in a future version.
46004597
[`ReadStream.open()`]: fs.md#class-fsreadstream
46014598
[`Server.getConnections()`]: net.md#servergetconnectionscallback
46024599
[`Server.listen({fd: <number>})`]: net.md#serverlistenhandle-backlog-callback
4603-
[`Sign.prototype.sign()`]: crypto.md#signsignprivatekey-outputencoding
46044600
[`String.prototype.toWellFormed`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toWellFormed
4605-
[`Verify.prototype.verify()`]: crypto.md#verifyverifyobject-signature-signatureencoding
46064601
[`WriteStream.open()`]: fs.md#class-fswritestream
46074602
[`assert`]: assert.md
46084603
[`asyncResource.runInAsyncScope()`]: async_context.md#asyncresourceruninasyncscopefn-thisarg-args
@@ -4620,21 +4615,11 @@ will throw an error in a future version.
46204615
[`crypto.createDecipheriv()`]: crypto.md#cryptocreatedecipherivalgorithm-key-iv-options
46214616
[`crypto.createHash()`]: crypto.md#cryptocreatehashalgorithm-options
46224617
[`crypto.createHmac()`]: crypto.md#cryptocreatehmacalgorithm-key-options
4623-
[`crypto.createPrivateKey()`]: crypto.md#cryptocreateprivatekeykey
4624-
[`crypto.createPublicKey()`]: crypto.md#cryptocreatepublickeykey
4625-
[`crypto.decapsulate()`]: crypto.md#cryptodecapsulatekey-ciphertext-callback
4626-
[`crypto.encapsulate()`]: crypto.md#cryptoencapsulatekey-callback
46274618
[`crypto.fips`]: crypto.md#cryptofips
46284619
[`crypto.pbkdf2()`]: crypto.md#cryptopbkdf2password-salt-iterations-keylen-digest-callback
4629-
[`crypto.privateDecrypt()`]: crypto.md#cryptoprivatedecryptprivatekey-buffer
4630-
[`crypto.privateEncrypt()`]: crypto.md#cryptoprivateencryptprivatekey-buffer
4631-
[`crypto.publicDecrypt()`]: crypto.md#cryptopublicdecryptkey-buffer
4632-
[`crypto.publicEncrypt()`]: crypto.md#cryptopublicencryptkey-buffer
46334620
[`crypto.randomBytes()`]: crypto.md#cryptorandombytessize-callback
46344621
[`crypto.scrypt()`]: crypto.md#cryptoscryptpassword-salt-keylen-options-callback
46354622
[`crypto.setEngine()`]: crypto.md#cryptosetengineengine-flags
4636-
[`crypto.sign()`]: crypto.md#cryptosignalgorithm-data-key-callback
4637-
[`crypto.verify()`]: crypto.md#cryptoverifyalgorithm-data-key-signature-callback
46384623
[`decipher.final()`]: crypto.md#decipherfinaloutputencoding
46394624
[`decipher.setAuthTag()`]: crypto.md#deciphersetauthtagbuffer-encoding
46404625
[`dirent.parentPath`]: fs.md#direntparentpath

0 commit comments

Comments
 (0)