From 0094017a14ba6a5b85fea776824f9b40158e8d41 Mon Sep 17 00:00:00 2001 From: Arthur Gautier Date: Mon, 27 Nov 2023 23:09:30 -0800 Subject: [PATCH] x509-cert: use `SubjectPublicKeyInfoOwned::from_key` --- x509-cert/Cargo.toml | 2 +- x509-cert/src/builder.rs | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/x509-cert/Cargo.toml b/x509-cert/Cargo.toml index b90401750..033f48b3a 100644 --- a/x509-cert/Cargo.toml +++ b/x509-cert/Cargo.toml @@ -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 } diff --git a/x509-cert/src/builder.rs b/x509-cert/src/builder.rs index ec51a7e35..c778f1e2f 100644 --- a/x509-cert/src/builder.rs +++ b/x509-cert/src/builder.rs @@ -276,9 +276,7 @@ where cert_signer: &'s S, ) -> Result { let verifying_key = cert_signer.verifying_key(); - let signer_pub = verifying_key - .to_public_key_der()? - .decode_msg::()?; + let signer_pub = SubjectPublicKeyInfoOwned::from_key(verifying_key)?; let signature_alg = cert_signer.signature_algorithm_identifier()?; let issuer = profile.get_issuer(&subject); @@ -370,9 +368,7 @@ where pub fn new(subject: Name, req_signer: &'s S) -> Result { let version = Default::default(); let verifying_key = req_signer.verifying_key(); - let public_key = verifying_key - .to_public_key_der()? - .decode_msg::()?; + let public_key = SubjectPublicKeyInfoOwned::from_key(verifying_key)?; let attributes = Default::default(); let extension_req = Default::default();