Skip to content

Commit 78bbb74

Browse files
authored
x509-cert: allow certificate to be serialized to pem (#763)
1 parent 86fee0c commit 78bbb74

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

x509-cert/src/certificate.rs

+9
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ use der::asn1::{BitStringRef, UIntRef};
99
use der::{Decode, Enumerated, Error, ErrorKind, Sequence};
1010
use spki::{AlgorithmIdentifier, SubjectPublicKeyInfo};
1111

12+
#[cfg(feature = "pem")]
13+
use der::pem::PemLabel;
14+
1215
/// Certificate `Version` as defined in [RFC 5280 Section 4.1].
1316
///
1417
/// ```text
@@ -143,6 +146,12 @@ pub struct Certificate<'a> {
143146
pub signature: BitStringRef<'a>,
144147
}
145148

149+
#[cfg(feature = "pem")]
150+
#[cfg_attr(docsrs, doc(cfg(feature = "pem")))]
151+
impl PemLabel for Certificate<'_> {
152+
const PEM_LABEL: &'static str = "CERTIFICATE";
153+
}
154+
146155
/// `PkiPath` as defined by X.509 and referenced by [RFC 6066].
147156
///
148157
/// This contains a series of certificates in validation order from the

0 commit comments

Comments
 (0)