Skip to content

keyobject.asymmetricKeyType crashes on C++ assertion #26775

@panva

Description

@panva

A followup discussion to #26319

We're still crashing here on any unhandled key. e.g:

-----BEGIN PRIVATE KEY-----
MC4CAQAwBQYDK2VuBCIEILD/13Y5R/tmcCjZVSooIcpfGvZxf+qt6dMu5FYaOC1a
-----END PRIVATE KEY-----

This makes the API rather unstable since end-users can force key material that will crash the process. Developers have no way to detect this other than parsing the key material before sending it to create(private|public)Key, kinda killing the KeyObject point.

The sane thing here would be return "unsupported"/"unknown" or to not instantiate the KeyObject at all and throw in JS instead.

Returning unsupported is enough for libraries using KeyObjects to check if they want to accept the key.

/cc @tniessen @sam-github @bnoordhuis what do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions