From fb105013adf6adad1b27364bbb7beae95cb0f484 Mon Sep 17 00:00:00 2001 From: kwantam Date: Tue, 24 Sep 2024 12:21:37 +0200 Subject: [PATCH] Enable signing with PublicKeyData --- rcgen/src/certificate.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rcgen/src/certificate.rs b/rcgen/src/certificate.rs index 8d4646ac..dd62a362 100644 --- a/rcgen/src/certificate.rs +++ b/rcgen/src/certificate.rs @@ -149,7 +149,7 @@ impl CertificateParams { /// [`Certificate::pem`]. pub fn signed_by( self, - key_pair: &KeyPair, + public_key: &impl PublicKeyData, issuer: &Certificate, issuer_key: &KeyPair, ) -> Result { @@ -160,8 +160,9 @@ impl CertificateParams { key_pair: issuer_key, }; - let subject_public_key_info = key_pair.public_key_der(); - let der = self.serialize_der_with_signer(key_pair, issuer)?; + let subject_public_key_info = + yasna::construct_der(|writer| serialize_public_key_der(public_key, writer)); + let der = self.serialize_der_with_signer(public_key, issuer)?; Ok(Certificate { params: self, subject_public_key_info,