Skip to content
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

Add raw-private (and possibly raw-public and raw-secret) key formats? #393

Open
twiss opened this issue Dec 31, 2024 · 1 comment
Open

Comments

@twiss
Copy link
Member

twiss commented Dec 31, 2024

Currently, it's not possible to import or export a raw private X25519, Ed25519, ECDH or ECDSA key.

The spec says raw is "An unformatted sequence of bytes. Intended for secret keys." However, in the mentioned asymmetric algorithms it's actually used to import and export public keys. And unlike with pkcs8, spki and jwk, there's no natural way to tell from the format name and/or data whether it's a private or a public key.

So, we could introduce a raw-private key format for importing and exporting raw private keys.

Conversely, we could introduce raw-public for importing and exporting raw public keys, and deprecate the usage of raw for that purpose.

To complete the trio, we could introduce raw-secret for importing and exporting raw secret keys, and deprecate raw entirely.

(In the future, when we add ML-KEM, we may also want raw-seed to import/export the private key seed.)

@steveluscher
Copy link

Yes please! We ship a series of helper methods to make importing the raw bytes of an Ed25519 private key more ergonomic for developers. All it does is to increase the attack surface of our library (which I've proposed to remove in anza-xyz/solana-web3.js#47 at the expense of developer experience) where a platform API to import raw private key bytes would do just fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants