crypto: modernize DH/ECDH/ECDH-ES#31178
Conversation
e394dd5 to
6261781
Compare
sam-github
left a comment
There was a problem hiding this comment.
LGTM in principle, some comments on the WIP.
|
I can confirm the missing ECDH-ES JWA algorithm support for x25519 and x448 keys is solved with this (closes #26626). @tniessen would it be possible to split the change to
Reason I ask is i'd like to see 1) backported to lts/erbium and in order to do that It would likely be easier if the change was as simple as possible. |
|
@panva Since either the whole PR, or a subset, are semver-minor, there isn't anything blocking backporting to LTS. |
|
Great. |
bnoordhuis
left a comment
There was a problem hiding this comment.
Overall direction seems okay to me.
6261781 to
0dfa9c5
Compare
|
Thank you for the initial round of reviews, I'll try to finish up within the next few days.
I would happily accept alternative directions! This is the best I came up with so far :) |
27d73df to
78043cc
Compare
lundibundi
left a comment
There was a problem hiding this comment.
Few nits regarding error handling.
78043cc to
eb347a5
Compare
eb347a5 to
bc309fb
Compare
e98c950 to
4378c9d
Compare
|
@nodejs/crypto PTAL. |
4378c9d to
70dc715
Compare
62197f1 to
a962a3d
Compare
Refs: #31178 Refs: #31445 PR-URL: #31873 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
The new key type 'dh' corresponds to EVP_PKEY_DH. PR-URL: nodejs#31178 Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
PR-URL: nodejs#31178 Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
This allows using the generateKeyPair API for DH instead of the old stateful DH APIs. PR-URL: nodejs#31178 Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Currently, Node.js has separate (stateful) APIs for DH/ECDH, and no support for ECDH-ES. This commit adds a single stateless function to compute the DH/ECDH/ECDH-ES secret based on two KeyObjects. PR-URL: nodejs#31178 Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
test-crypto-keygen and test-crypto-dh-stateless are currently flaky on ARM CI systems due to their slow CPUs. PR-URL: nodejs#31178 Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
The new key type 'dh' corresponds to EVP_PKEY_DH. PR-URL: #31178 Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
PR-URL: #31178 Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
This allows using the generateKeyPair API for DH instead of the old stateful DH APIs. PR-URL: #31178 Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Currently, Node.js has separate (stateful) APIs for DH/ECDH, and no support for ECDH-ES. This commit adds a single stateless function to compute the DH/ECDH/ECDH-ES secret based on two KeyObjects. PR-URL: #31178 Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
test-crypto-keygen and test-crypto-dh-stateless are currently flaky on ARM CI systems due to their slow CPUs. PR-URL: #31178 Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
|
@tniessen I noticed some test excludes in the parallel tests: Since this PR is closed I'm wondering if they are still needed and/or there is an open issue that should be listed instead of this one as to why they are excluded? |
|
@mhdawson These tests were disabled because they kept timing out. I "temporarily disabled" them more than two years ago, see #31178 (comment) 😄 |
This adds support for DH/ECDH/ECDH-ES via the
KeyObjectAPI, and should fix #26626. I also added DH support togenerateKeyPair, which is a partial solution to #28404. There are still lots of things I need to figure out, but I would like to see if people are okay with this approach.(Note that the current API does not support "raw" DH keys, only SPKI/PKCS#8 keys are supported as of now. That will likely change via the previously discussed
.params/.fieldsAPIs.)cc @nodejs/crypto @nodejs/security
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes