Skip to content

Commit

Permalink
x509-cert: use SubjectPublicKeyInfoOwned::from_key (RustCrypto#1271)
Browse files Browse the repository at this point in the history
  • Loading branch information
baloo authored and carl-wallace committed Dec 4, 2023
1 parent b5cb7e8 commit 2e9cd05
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion x509-cert/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ rust-version = "1.65"
[dependencies]
const-oid = { version = "0.9.3", features = ["db"] }
der = { version = "0.7.6", features = ["alloc", "derive", "flagset", "oid"] }
spki = { version = "0.7.2", features = ["alloc"] }
spki = { version = "0.7.3", features = ["alloc"] }

# optional dependencies
arbitrary = { version = "1.3", features = ["derive"], optional = true }
Expand Down
8 changes: 2 additions & 6 deletions x509-cert/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,7 @@ where
cert_signer: &'s S,
) -> Result<Self> {
let verifying_key = cert_signer.verifying_key();
let signer_pub = verifying_key
.to_public_key_der()?
.decode_msg::<SubjectPublicKeyInfoOwned>()?;
let signer_pub = SubjectPublicKeyInfoOwned::from_key(verifying_key)?;

let signature_alg = cert_signer.signature_algorithm_identifier()?;
let issuer = profile.get_issuer(&subject);
Expand Down Expand Up @@ -370,9 +368,7 @@ where
pub fn new(subject: Name, req_signer: &'s S) -> Result<Self> {
let version = Default::default();
let verifying_key = req_signer.verifying_key();
let public_key = verifying_key
.to_public_key_der()?
.decode_msg::<SubjectPublicKeyInfoOwned>()?;
let public_key = SubjectPublicKeyInfoOwned::from_key(verifying_key)?;
let attributes = Default::default();
let extension_req = Default::default();

Expand Down

0 comments on commit 2e9cd05

Please sign in to comment.