Skip to content

Does forge support ec256 keys? #1093

Open
@sbweeden

Description

@sbweeden

More of a question than an issue I guess - but tried this:

PEM file of EC256 key:

-----BEGIN EC PRIVATE KEY-----
MHcCAQEEIFB2teeHGu5T7bh597NtvJJJ/WumONRAkfOzYCP1nKEFoAoGCCqGSM49
AwEHoUQDQgAEaYys5soGb5m0vg1sgNRTw+/2WthcZO3FI1ALhu62jszNvcyipL7s
/4Vx/bP11KhwnwhX9ucDyq+HtV1dmgXmig==
-----END EC PRIVATE KEY-----

JS code:

let pkiPrivateKey = pki.privateKeyFromPem( <string of PEM above> );

Got error:

Error: Cannot read public key. Unknown OID.
    at pki.publicKeyFromAsn1 (.../node_modules/node-forge/lib/rsa.js:1474:19)
    at pki.publicKeyFromPem(.../node_modules/node-forge/lib/x509.js:865:14)
...

Looks like it assumes RSA keys. No support at all for EC256?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions