pub struct CertificateRevocationList<'a> {
pub tbs_cert_list: TbsCertList<'a>,
pub signature_algorithm: AlgorithmIdentifier<'a>,
pub signature_value: BitString<'a>,
}
Expand description
An X.509 v2 Certificate Revocation List (CRL).
X.509 v2 CRLs are defined in RFC5280.
§Example
To parse a CRL and print information about revoked certificates:
use x509_parser::prelude::FromDer;
use x509_parser::revocation_list::CertificateRevocationList;
let res = CertificateRevocationList::from_der(DER);
match res {
Ok((_rem, crl)) => {
for revoked in crl.iter_revoked_certificates() {
println!("Revoked certificate serial: {}", revoked.raw_serial_as_string());
println!(" Reason: {}", revoked.reason_code().unwrap_or_default().1);
}
},
_ => panic!("CRL parsing failed: {:?}", res),
}
Fields§
§tbs_cert_list: TbsCertList<'a>
§signature_algorithm: AlgorithmIdentifier<'a>
§signature_value: BitString<'a>
Implementations§
Source§impl<'a> CertificateRevocationList<'a>
impl<'a> CertificateRevocationList<'a>
Sourcepub fn version(&self) -> Option<X509Version>
pub fn version(&self) -> Option<X509Version>
Get the version of the encoded certificate
Examples found in repository?
110fn print_crl_info(crl: &CertificateRevocationList) {
111 println!(" Version: {}", crl.version().unwrap_or(X509Version(0)));
112 // println!(" Subject: {}", crl.subject());
113 println!(" Signature Algorithm:");
114 print_x509_digest_algorithm(&crl.signature_algorithm, 4);
115 println!(" Issuer: {}", crl.issuer());
116 // println!(" Serial: {}", crl.tbs_certificate.raw_serial_as_string());
117 println!(" Last Update: {}", crl.last_update());
118 println!(
119 " Next Update: {}",
120 crl.next_update()
121 .map_or_else(|| "NONE".to_string(), |d| d.to_string())
122 );
123 println!("{:indent$}CRL Extensions:", "", indent = 2);
124 for ext in crl.extensions() {
125 print_x509_extension(&ext.oid, ext, 4);
126 }
127 println!(" Revoked certificates:");
128 for revoked in crl.iter_revoked_certificates() {
129 print_revoked_certificate(revoked, 4);
130 }
131 println!();
132}
Sourcepub fn issuer(&self) -> &X509Name<'_>
pub fn issuer(&self) -> &X509Name<'_>
Get the certificate issuer.
Examples found in repository?
110fn print_crl_info(crl: &CertificateRevocationList) {
111 println!(" Version: {}", crl.version().unwrap_or(X509Version(0)));
112 // println!(" Subject: {}", crl.subject());
113 println!(" Signature Algorithm:");
114 print_x509_digest_algorithm(&crl.signature_algorithm, 4);
115 println!(" Issuer: {}", crl.issuer());
116 // println!(" Serial: {}", crl.tbs_certificate.raw_serial_as_string());
117 println!(" Last Update: {}", crl.last_update());
118 println!(
119 " Next Update: {}",
120 crl.next_update()
121 .map_or_else(|| "NONE".to_string(), |d| d.to_string())
122 );
123 println!("{:indent$}CRL Extensions:", "", indent = 2);
124 for ext in crl.extensions() {
125 print_x509_extension(&ext.oid, ext, 4);
126 }
127 println!(" Revoked certificates:");
128 for revoked in crl.iter_revoked_certificates() {
129 print_revoked_certificate(revoked, 4);
130 }
131 println!();
132}
Sourcepub fn last_update(&self) -> ASN1Time
pub fn last_update(&self) -> ASN1Time
Get the date and time of the last (this) update.
Examples found in repository?
110fn print_crl_info(crl: &CertificateRevocationList) {
111 println!(" Version: {}", crl.version().unwrap_or(X509Version(0)));
112 // println!(" Subject: {}", crl.subject());
113 println!(" Signature Algorithm:");
114 print_x509_digest_algorithm(&crl.signature_algorithm, 4);
115 println!(" Issuer: {}", crl.issuer());
116 // println!(" Serial: {}", crl.tbs_certificate.raw_serial_as_string());
117 println!(" Last Update: {}", crl.last_update());
118 println!(
119 " Next Update: {}",
120 crl.next_update()
121 .map_or_else(|| "NONE".to_string(), |d| d.to_string())
122 );
123 println!("{:indent$}CRL Extensions:", "", indent = 2);
124 for ext in crl.extensions() {
125 print_x509_extension(&ext.oid, ext, 4);
126 }
127 println!(" Revoked certificates:");
128 for revoked in crl.iter_revoked_certificates() {
129 print_revoked_certificate(revoked, 4);
130 }
131 println!();
132}
Sourcepub fn next_update(&self) -> Option<ASN1Time>
pub fn next_update(&self) -> Option<ASN1Time>
Get the date and time of the next update, if present.
Examples found in repository?
110fn print_crl_info(crl: &CertificateRevocationList) {
111 println!(" Version: {}", crl.version().unwrap_or(X509Version(0)));
112 // println!(" Subject: {}", crl.subject());
113 println!(" Signature Algorithm:");
114 print_x509_digest_algorithm(&crl.signature_algorithm, 4);
115 println!(" Issuer: {}", crl.issuer());
116 // println!(" Serial: {}", crl.tbs_certificate.raw_serial_as_string());
117 println!(" Last Update: {}", crl.last_update());
118 println!(
119 " Next Update: {}",
120 crl.next_update()
121 .map_or_else(|| "NONE".to_string(), |d| d.to_string())
122 );
123 println!("{:indent$}CRL Extensions:", "", indent = 2);
124 for ext in crl.extensions() {
125 print_x509_extension(&ext.oid, ext, 4);
126 }
127 println!(" Revoked certificates:");
128 for revoked in crl.iter_revoked_certificates() {
129 print_revoked_certificate(revoked, 4);
130 }
131 println!();
132}
Sourcepub fn iter_revoked_certificates(
&self,
) -> impl Iterator<Item = &RevokedCertificate<'a>>
pub fn iter_revoked_certificates( &self, ) -> impl Iterator<Item = &RevokedCertificate<'a>>
Return an iterator over the RevokedCertificate
objects
Examples found in repository?
110fn print_crl_info(crl: &CertificateRevocationList) {
111 println!(" Version: {}", crl.version().unwrap_or(X509Version(0)));
112 // println!(" Subject: {}", crl.subject());
113 println!(" Signature Algorithm:");
114 print_x509_digest_algorithm(&crl.signature_algorithm, 4);
115 println!(" Issuer: {}", crl.issuer());
116 // println!(" Serial: {}", crl.tbs_certificate.raw_serial_as_string());
117 println!(" Last Update: {}", crl.last_update());
118 println!(
119 " Next Update: {}",
120 crl.next_update()
121 .map_or_else(|| "NONE".to_string(), |d| d.to_string())
122 );
123 println!("{:indent$}CRL Extensions:", "", indent = 2);
124 for ext in crl.extensions() {
125 print_x509_extension(&ext.oid, ext, 4);
126 }
127 println!(" Revoked certificates:");
128 for revoked in crl.iter_revoked_certificates() {
129 print_revoked_certificate(revoked, 4);
130 }
131 println!();
132}
Sourcepub fn extensions(&self) -> &[X509Extension<'_>]
pub fn extensions(&self) -> &[X509Extension<'_>]
Get the CRL extensions.
Examples found in repository?
110fn print_crl_info(crl: &CertificateRevocationList) {
111 println!(" Version: {}", crl.version().unwrap_or(X509Version(0)));
112 // println!(" Subject: {}", crl.subject());
113 println!(" Signature Algorithm:");
114 print_x509_digest_algorithm(&crl.signature_algorithm, 4);
115 println!(" Issuer: {}", crl.issuer());
116 // println!(" Serial: {}", crl.tbs_certificate.raw_serial_as_string());
117 println!(" Last Update: {}", crl.last_update());
118 println!(
119 " Next Update: {}",
120 crl.next_update()
121 .map_or_else(|| "NONE".to_string(), |d| d.to_string())
122 );
123 println!("{:indent$}CRL Extensions:", "", indent = 2);
124 for ext in crl.extensions() {
125 print_x509_extension(&ext.oid, ext, 4);
126 }
127 println!(" Revoked certificates:");
128 for revoked in crl.iter_revoked_certificates() {
129 print_revoked_certificate(revoked, 4);
130 }
131 println!();
132}
Sourcepub fn crl_number(&self) -> Option<&BigUint>
pub fn crl_number(&self) -> Option<&BigUint>
Get the CRL number, if present
Note that the returned value is a BigUint
, because of the following RFC specification:
Given the requirements above, CRL numbers can be expected to contain long integers. CRL verifiers MUST be able to handle CRLNumber values up to 20 octets. Conformant CRL issuers MUST NOT use CRLNumber values longer than 20 octets.
Sourcepub fn verify_signature(
&self,
public_key: &SubjectPublicKeyInfo<'_>,
) -> Result<(), X509Error>
Available on crate feature verify
only.
pub fn verify_signature( &self, public_key: &SubjectPublicKeyInfo<'_>, ) -> Result<(), X509Error>
verify
only.Verify the cryptographic signature of this certificate revocation list
public_key
is the public key of the signer.
Not all algorithms are supported, this function is limited to what ring
supports.
Source§impl CertificateRevocationList<'_>
impl CertificateRevocationList<'_>
Sourcepub fn walk<V: CertificateRevocationListVisitor>(&self, visitor: &mut V)
pub fn walk<V: CertificateRevocationListVisitor>(&self, visitor: &mut V)
Run the provided CertificateRevocationListVisitor
over the Certificate Revocation List (self
)
Trait Implementations§
Source§impl<'a> Clone for CertificateRevocationList<'a>
impl<'a> Clone for CertificateRevocationList<'a>
Source§fn clone(&self) -> CertificateRevocationList<'a>
fn clone(&self) -> CertificateRevocationList<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<'a> Debug for CertificateRevocationList<'a>
impl<'a> Debug for CertificateRevocationList<'a>
Source§impl<'a> FromDer<'a, X509Error> for CertificateRevocationList<'a>
CertificateList ::= SEQUENCE {
tbsCertList TBSCertList,
signatureAlgorithm AlgorithmIdentifier,
signatureValue BIT STRING }
impl<'a> FromDer<'a, X509Error> for CertificateRevocationList<'a>
CertificateList ::= SEQUENCE { tbsCertList TBSCertList, signatureAlgorithm AlgorithmIdentifier, signatureValue BIT STRING }