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

elliptic-curve: SEC1 private key support #762

Merged
merged 1 commit into from
Sep 15, 2021

Conversation

tarcieri
Copy link
Member

Adds the following methods to SecretKey:

  • from_sec1_der
  • from_sec1_pem (requires pem feature)
  • to_sec1_der
  • to_sec1_pem (requires pem feature)

These implement the SEC1 (RFC5915) ASN.1 DER encoding for elliptic curve private keys.

These methods are extracted from and now consumed by the PKCS#8 implementation, as PKCS#8 is just a wrapper for this format when used with elliptic curve keys.

It seems like it might be a good idea to eventually extract this into a sec1 crate as a followup, providing a similar role to the pkcs1 crate. This would allow a setup that works much more like the rsa crate does now, where impling sec1 traits provides a blanket impl of PKCS#8 support.

@tarcieri tarcieri force-pushed the elliptic-curve/sec1-private-keys branch from fe69962 to ed8eaa0 Compare September 15, 2021 20:29
Adds the following methods to `SecretKey`:

- `from_sec1_der`
- `from_sec1_pem` (requires `pem` feature)
- `to_sec1_der`
- `to_sec1_pem` (requires `pem` feature)

These implement the SEC1 (RFC5915) ASN.1 DER encoding for elliptic curve
private keys.

These methods are extracted from and now consumed by the PKCS#8
implementation, as PKCS#8 is just a wrapper for this format when used
with elliptic curve keys.

It seems like it might be a good idea to eventually extract this into a
`sec1` crate as a followup, providing a similar role to the `pkcs1`
crate. This would allow a setup that works much more like the `rsa`
crate does now, where impling `sec1` traits provides a blanket impl of
PKCS#8 support.
@tarcieri tarcieri force-pushed the elliptic-curve/sec1-private-keys branch from ed8eaa0 to 63d800d Compare September 15, 2021 20:50
@tarcieri tarcieri merged commit fb4c26c into master Sep 15, 2021
@tarcieri tarcieri deleted the elliptic-curve/sec1-private-keys branch September 15, 2021 21:19
tarcieri added a commit that referenced this pull request Sep 15, 2021
This was accidentally hidden during the refactoring in #762
tarcieri added a commit that referenced this pull request Sep 15, 2021
This was accidentally hidden during the refactoring in #762
@tarcieri tarcieri mentioned this pull request Nov 20, 2021
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

Successfully merging this pull request may close these issues.

1 participant