Skip to content

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.

2 participants