From c9b6129b97311f70936814896cbf0305459c2e48 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Wed, 20 Mar 2024 17:20:19 +0100 Subject: [PATCH] Allow taking owned pki-types out of wrappers --- rcgen/src/certificate.rs | 6 ++++++ rcgen/src/crl.rs | 6 ++++++ rcgen/src/csr.rs | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/rcgen/src/certificate.rs b/rcgen/src/certificate.rs index 908209a5..1c70120d 100644 --- a/rcgen/src/certificate.rs +++ b/rcgen/src/certificate.rs @@ -54,6 +54,12 @@ impl Certificate { } } +impl From for CertificateDer<'static> { + fn from(cert: Certificate) -> Self { + cert.der + } +} + /// Parameters used for certificate generation #[allow(missing_docs)] #[non_exhaustive] diff --git a/rcgen/src/crl.rs b/rcgen/src/crl.rs index 69c7b0ca..c4512f84 100644 --- a/rcgen/src/crl.rs +++ b/rcgen/src/crl.rs @@ -89,6 +89,12 @@ impl CertificateRevocationList { } } +impl From for CertificateRevocationListDer<'static> { + fn from(crl: CertificateRevocationList) -> Self { + crl.der + } +} + /// A certificate revocation list (CRL) distribution point, to be included in a certificate's /// [distribution points extension](https://www.rfc-editor.org/rfc/rfc5280#section-4.2.1.13) or /// a CRL's [issuing distribution point extension](https://datatracker.ietf.org/doc/html/rfc5280#section-5.2.5) diff --git a/rcgen/src/csr.rs b/rcgen/src/csr.rs index 61f1e223..1d5cb7e9 100644 --- a/rcgen/src/csr.rs +++ b/rcgen/src/csr.rs @@ -48,6 +48,12 @@ impl CertificateSigningRequest { } } +impl From for CertificateSigningRequestDer<'static> { + fn from(csr: CertificateSigningRequest) -> Self { + csr.der + } +} + /// Parameters for a certificate signing request pub struct CertificateSigningRequestParams { /// Parameters for the certificate to be signed.