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

ed25519: support PKCS#8 v1 (for OpenSSL interop)? #627

Open
tarcieri opened this issue Feb 13, 2024 · 2 comments
Open

ed25519: support PKCS#8 v1 (for OpenSSL interop)? #627

tarcieri opened this issue Feb 13, 2024 · 2 comments

Comments

@tarcieri
Copy link
Contributor

It seems even the most recent versions of OpenSSL don't support PKCS#8 v2 which includes the public key in the resulting document in addition to the private key. See: RustCrypto/formats#1349

From RFC8410 Section 7:

NOTE: There exist some private key import functions that have not
picked up the new ASN.1 structure OneAsymmetricKey that is defined in
[RFC7748]. This means that they will not accept a private key
structure that contains the public key field. This means a balancing
act needs to be done between being able to do a consistency check on
the key pair and widest ability to import the key.

Concretely this would involve changing the PKCS#8 serializer to not include the public key, which would permit interop with OpenSSL.

In many ways this makes sense as the public key is easily computed from the private key via scalar multiplication.

@randombit
Copy link
Contributor

If this was done it would be nice if the choice of v1 vs v2 was in some way configurable, since some highly opinionated software (notably ring) require v2 PKCS8 encoding.

@tarcieri
Copy link
Contributor Author

tarcieri commented Mar 7, 2024

@randombit the pkcs8::KeypairBytes type could still be used to serialize PKCS#8 v2 if desired, by leveraging the From<SigningKey> impl.

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