-
Notifications
You must be signed in to change notification settings - Fork 30.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
generateKeyPair('ec') should not support NODE-ED* and NODE-X* #37055
Labels
crypto
Issues and PRs related to the crypto subsystem.
Comments
This was referenced Jan 24, 2021
Merged
panva
added a commit
to panva/node
that referenced
this issue
Jan 25, 2021
panva
added a commit
to panva/node
that referenced
this issue
Jan 25, 2021
panva
added a commit
to panva/node
that referenced
this issue
Jan 25, 2021
panva
added a commit
to panva/node
that referenced
this issue
Jan 25, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The following "curves" were added to the
'ec'
key type in #36879:NODE-ED25519
NODE-ED448
NODE-X25519
NODE-X448
However, none of these are pure EC curves, for example, Curve25519 does not work with ECDSA, which is one of the reasons why
crypto.getCurves()
does not include Curve25519.Node.js already supported these special algorithms through their own key types (thanks to #26554, #26774, and #31178):
crypto.generateKeyPairSync('ed25519').publicKey.asymmetricKeyType === 'ed25519'
crypto.generateKeyPairSync('ed448').publicKey.asymmetricKeyType === 'ed448'
crypto.generateKeyPairSync('x25519').publicKey.asymmetricKeyType === 'x25519'
crypto.generateKeyPairSync('x448').publicKey.asymmetricKeyType === 'x448'
With #36879, we now also have this:
crypto.generateKeyPairSync('ec', { namedCurve: 'NODE-ED25519' }).publicKey.asymmetricKeyType === 'ed25519'
crypto.generateKeyPairSync('ec', { namedCurve: 'NODE-ED448' }).publicKey.asymmetricKeyType === 'ed448'
crypto.generateKeyPairSync('ec', { namedCurve: 'NODE-X25519' }).publicKey.asymmetricKeyType === 'x25519'
crypto.generateKeyPairSync('ec', { namedCurve: 'NODE-X448' }).publicKey.asymmetricKeyType === 'x448'
This also means that two keys, both generated through some call to
crypto.generateKeyPairSync('ec', { namedCurve })
result in different ASN.1 representations, which is also highly unusual and counter-intuitive.#36879 technically also landed without full approval.
The text was updated successfully, but these errors were encountered: