Skip to content

Commit

Permalink
pkcs1: fixups for DecodeRsaPublicKey blanket impl (#916)
Browse files Browse the repository at this point in the history
Changes the error type to `spki::Error`, which matches the error type
used in the `spki::DecodePublicKey` blanket impl:

https://docs.rs/spki/0.7.0/spki/trait.DecodePublicKey.html#impl-DecodePublicKey-for-T

Also removes the bounds on `DecodePublicKey` in the blanket impl of
`DecodeRsaPublicKey`, since they aren't actually used.

This is a breaking change but also a bugfix, as with the previous bounds
it's not possible to impl PKCS#1 support via these two blanket impls,
since the error types don't match. The plan is to merge this, publish
it, and yank the v0.7.0 release.
  • Loading branch information
tarcieri authored Mar 6, 2023
1 parent 2f04f22 commit 25f821a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkcs1/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,9 @@ where
}

#[cfg(feature = "pkcs8")]
impl<T: pkcs8::DecodePublicKey> DecodeRsaPublicKey for T
impl<T> DecodeRsaPublicKey for T
where
T: for<'a> TryFrom<pkcs8::SubjectPublicKeyInfoRef<'a>, Error = pkcs8::Error>,
T: for<'a> TryFrom<pkcs8::SubjectPublicKeyInfoRef<'a>, Error = pkcs8::spki::Error>,
{
fn from_pkcs1_der(public_key: &[u8]) -> Result<Self> {
Ok(Self::try_from(pkcs8::SubjectPublicKeyInfoRef {
Expand Down

0 comments on commit 25f821a

Please sign in to comment.