Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Copy link
Copy link
@tniessen

Description

@tniessen
Issue body actions

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.

bricss

Metadata

Metadata

Assignees

No one assigned

    Labels

    cryptoIssues and PRs related to the crypto subsystem.Issues and PRs related to the crypto subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.