nodejs / node

Node.js JavaScript runtime ✨🐢🚀✨
https://nodejs.org
Other
106.56k stars 29.05k forks source link

generateKeyPair('ec') should not support NODE-ED* and NODE-X* #37055

Closed tniessen closed 3 years ago

tniessen commented 3 years ago

The following "curves" were added to the 'ec' key type in https://github.com/nodejs/node/pull/36879:

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 https://github.com/nodejs/node/pull/26554, https://github.com/nodejs/node/pull/26774, and https://github.com/nodejs/node/pull/31178):

With https://github.com/nodejs/node/pull/36879, we now also have this:

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.

https://github.com/nodejs/node/pull/36879 technically also landed without full approval.

panva commented 3 years ago

likely culrpit cc @jasnell