Skip to content

pkcs5: initial crate #272

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

Merged
merged 1 commit into from
Feb 18, 2021
Merged

pkcs5: initial crate #272

merged 1 commit into from
Feb 18, 2021

Conversation

tarcieri
Copy link
Member

@tarcieri tarcieri commented Feb 17, 2021

Adds an initial implementation of Public-Key Cryptography Standards (PKCS) 5: Password-Based Cryptography Specification Version 2.1 as described in RFC 8018.

This implementation includes basic support for parsing AlgorithmIdentifiers representing supported PKCS#5 algorithms into a structured representation.

The larger goal is being able to decrypt/encrypt PKCS#8's EncryptedPrivateKeyInfo (see #263).

This PR doesn't actually include any encryption support yet: instead it implements the basic crate structure with the goal of adding encryption support in follow-up PRs.

It also includes some changes to the spki crate to simplify parsing which should probably be separated out into their own PR (merged separately in #274)

@tarcieri tarcieri requested a review from newpavlov February 17, 2021 18:36
@tarcieri tarcieri force-pushed the pkcs5 branch 2 times, most recently from 6237d05 to 094765c Compare February 17, 2021 18:50
tarcieri added a commit that referenced this pull request Feb 18, 2021
Adds an error variant for propagating OIDs as discussed in #272.

It's a little awkward for a few reasons:

- There's already a unit `ErrorKind::Oid` variant. Since that's a little
  ambiguous, there's also a TODO to rename that variant to the more
  specific `ErrorKind::OidMalformed` in the next breaking release
- Since `const-oid` is an optional dependency, the presence of this
  variant is conditional upon that feature being enabled. Fortunately
  the whole enum is marked `#[non_exhaustive]` (which is what even
  allows adding new variants in a non-breaking way), so hopefully the
  conditional presence of this variant won't be too problematic for
  downstream users

The other problem is the `ObjectIdentifier` type is somewhat large. On a
64-bit machine, this increases the size of the overall `Error` type
(which wraps `ErrorKind` with additional context) from 32-bytes to
64-bytes.

That's not great, but probably worth it for the additional context being
able to propagate an OID as an error provides.
tarcieri added a commit that referenced this pull request Feb 18, 2021
Adds an error variant for propagating OIDs as discussed in #272.

It's a little awkward for a few reasons:

- There's already a unit `ErrorKind::Oid` variant. Since that's a little
  ambiguous, there's also a TODO to rename that variant to the more
  specific `ErrorKind::OidMalformed` in the next breaking release
- Since `const-oid` is an optional dependency, the presence of this
  variant is conditional upon that feature being enabled. Fortunately
  the whole enum is marked `#[non_exhaustive]` (which is what even
  allows adding new variants in a non-breaking way), so hopefully the
  conditional presence of this variant won't be too problematic for
  downstream users

The other problem is the `ObjectIdentifier` type is somewhat large. On a
64-bit machine, this increases the size of the overall `Error` type
(which wraps `ErrorKind` with additional context) from 32-bytes to
64-bytes.

That's not great, but probably worth it for the additional context being
able to propagate an OID as an error provides.
Adds an initial implementation of Public-Key Cryptography Standards
(PKCS) #5: Password-Based Cryptography Specification Version 2.1
as described in RFC 8018.

This implementation includes basic support for parsing
`AlgorithmIdentifier`s representing supported PKCS#5 algorithms into a
structured representation.

The larger goal is being able to decrypt/encrypt PKCS#8's
`EncryptedPrivateKeyInfo` (see #263)

This PR doesn't actually include any encryption support yet: instead it
implements the basic crate structure with the goal of adding encryption
support in follow-up PRs.

It also includes some changes to the `spki` crate to simplify parsing
which should probably be separated out into their own PR.
@tarcieri tarcieri merged commit bd26d68 into master Feb 18, 2021
@tarcieri tarcieri deleted the pkcs5 branch February 18, 2021 18:22
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