pub struct CertificateRevocationList { /* private fields */ }
Expand description

A certificate revocation list (CRL)

Example

extern crate rcgen;
use rcgen::*;

// Generate a CRL issuer.
let mut issuer_params = CertificateParams::new(vec!["crl.issuer.example.com".to_string()]);
issuer_params.is_ca = IsCa::Ca(BasicConstraints::Unconstrained);
issuer_params.key_usages = vec![KeyUsagePurpose::KeyCertSign, KeyUsagePurpose::DigitalSignature, KeyUsagePurpose::CrlSign];
let issuer = Certificate::from_params(issuer_params).unwrap();
// Describe a revoked certificate.
let revoked_cert = RevokedCertParams{
  serial_number: SerialNumber::from(9999),
  revocation_time: date_time_ymd(2024, 06, 17),
  reason_code: Some(RevocationReason::KeyCompromise),
  invalidity_date: None,
};
// Create a CRL signed by the issuer, revoking revoked_cert.
let crl = CertificateRevocationListParams{
  this_update: date_time_ymd(2023, 06, 17),
  next_update: date_time_ymd(2024, 06, 17),
  crl_number: SerialNumber::from(1234),
  issuing_distribution_point: None,
  revoked_certs: vec![revoked_cert],
  alg: &PKCS_ECDSA_P256_SHA256,
  key_identifier_method: KeyIdMethod::Sha256,
};
let crl = CertificateRevocationList::from_params(crl).unwrap();
println!("{}", crl.serialize_pem_with_signer(&issuer).unwrap());

Implementations§

source§

impl CertificateRevocationList

source

pub fn from_params( params: CertificateRevocationListParams ) -> Result<Self, RcgenError>

Generates a new certificate revocation list (CRL) from the given parameters.

source

pub fn get_params(&self) -> &CertificateRevocationListParams

Returns the certificate revocation list (CRL) parameters.

source

pub fn serialize_der_with_signer( &self, ca: &Certificate ) -> Result<Vec<u8>, RcgenError>

Serializes the certificate revocation list (CRL) in binary DER format, signed with the issuing certificate authority’s key.

source

pub fn serialize_pem_with_signer( &self, ca: &Certificate ) -> Result<String, RcgenError>

Serializes the certificate revocation list (CRL) in ASCII PEM format, signed with the issuing certificate authority’s key.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32 ) -> TaggedParser<'a, Implicit, Self, E>

source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.