pub struct Certificate { /* private fields */ }Expand description
A parsed X.509 v3 certificate.
Implementations§
Source§impl Certificate
impl Certificate
Sourcepub fn from_der(der_bytes: &[u8]) -> Result<Self, CertError>
pub fn from_der(der_bytes: &[u8]) -> Result<Self, CertError>
Parse a certificate from DER bytes.
Sourcepub fn from_pem(pem: &str) -> Result<Self, CertError>
pub fn from_pem(pem: &str) -> Result<Self, CertError>
Parse a certificate from PEM (RFC 7468) text.
Sourcepub fn fingerprint_sha256(&self) -> String
pub fn fingerprint_sha256(&self) -> String
Compute the SHA-256 fingerprint of this certificate.
Sourcepub fn serial_bytes(&self) -> &[u8] ⓘ
pub fn serial_bytes(&self) -> &[u8] ⓘ
The serial number as a byte slice.
Sourcepub fn not_before(&self) -> DateTime
pub fn not_before(&self) -> DateTime
Not-before validity bound (raw der::DateTime).
Sourcepub fn not_before_chrono(&self) -> DateTime<Utc>
pub fn not_before_chrono(&self) -> DateTime<Utc>
Not-before as a chrono DateTime<Utc>.
Sourcepub fn not_after_chrono(&self) -> DateTime<Utc>
pub fn not_after_chrono(&self) -> DateTime<Utc>
Not-after as a chrono DateTime<Utc>.
Sourcepub fn is_within_validity(&self, now: DateTime<Utc>) -> bool
pub fn is_within_validity(&self, now: DateTime<Utc>) -> bool
Whether the certificate is within its validity window at the given instant.
Sourcepub fn public_key_bytes(&self) -> &[u8] ⓘ
pub fn public_key_bytes(&self) -> &[u8] ⓘ
Raw subject public key bytes from the SPKI, if available.
Trait Implementations§
Source§impl Clone for Certificate
impl Clone for Certificate
Source§fn clone(&self) -> Certificate
fn clone(&self) -> Certificate
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for Certificate
impl RefUnwindSafe for Certificate
impl Send for Certificate
impl Sync for Certificate
impl Unpin for Certificate
impl UnsafeUnpin for Certificate
impl UnwindSafe for Certificate
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more