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 SubjectPublicKeyInfo DER newtype #47

Merged
merged 2 commits into from
May 6, 2024
Merged

Conversation

lvkv
Copy link
Contributor

@lvkv lvkv commented May 5, 2024

This PR adds a new pub struct SubjectPublicKeyInfo<'a>(Der<'a>); type that represents an X.509 certificate's SubjectPublicKeyInfo (also known as an SPKI) as specified in RFC 5280.

I've also added a few impls that mirror what exists for other Der newtypes, like CertificateDer:

  • AsRef<[u8]>
  • Deref
  • From<&'a [u8]>
  • From<Vec<u8>>
  • pub fn into_owned(self)

The motivation behind this is to make it possible to verify consistency for public and private keys (rustls/rustls#1918) —which can be accomplished by comparing SPKI values. CC @cpu btw.

Copy link
Member

@cpu cpu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. Thanks!

Would you like to also add a second commit that updates Cargo.toml's version from 1.5.0 to 1.6.0?

@lvkv
Copy link
Contributor Author

lvkv commented May 6, 2024

Would you like to also add a second commit that updates Cargo.toml's version from 1.5.0 to 1.6.0?

Done!

@djc djc added this pull request to the merge queue May 6, 2024
@djc
Copy link
Member

djc commented May 6, 2024

Great, thanks!

Merged via the queue into rustls:main with commit e5c3e1c May 6, 2024
13 checks passed
@djc
Copy link
Member

djc commented May 7, 2024

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.

3 participants