pub struct CertificateInfo {
pub subject: String,
pub issuer: String,
pub serial_number: String,
pub not_before: String,
pub not_after: String,
pub is_ca: bool,
pub key_usage: Vec<KeyUsage>,
pub extended_key_usage: Vec<String>,
pub subject_alt_names: Vec<String>,
pub fingerprint_sha256: String,
}Available on crate feature
signatures only.Expand description
Information extracted from a certificate.
Fields§
§subject: StringSubject distinguished name.
issuer: StringIssuer distinguished name.
serial_number: StringSerial number (hex encoded).
not_before: StringNot valid before (ISO 8601).
not_after: StringNot valid after (ISO 8601).
is_ca: boolWhether this is a CA certificate.
key_usage: Vec<KeyUsage>Key usage flags.
extended_key_usage: Vec<String>Extended key usage OIDs.
subject_alt_names: Vec<String>Subject alternative names.
fingerprint_sha256: StringSHA-256 fingerprint of the certificate (hex encoded).
Implementations§
Source§impl CertificateInfo
impl CertificateInfo
Sourcepub fn new(
subject: impl Into<String>,
issuer: impl Into<String>,
serial_number: impl Into<String>,
) -> Self
pub fn new( subject: impl Into<String>, issuer: impl Into<String>, serial_number: impl Into<String>, ) -> Self
Create certificate info with minimal required fields.
Sourcepub fn is_self_signed(&self) -> bool
pub fn is_self_signed(&self) -> bool
Check if the certificate is self-signed.
Sourcepub fn with_validity(
self,
not_before: impl Into<String>,
not_after: impl Into<String>,
) -> Self
pub fn with_validity( self, not_before: impl Into<String>, not_after: impl Into<String>, ) -> Self
Set the validity period.
Sourcepub fn with_fingerprint(self, fingerprint: impl Into<String>) -> Self
pub fn with_fingerprint(self, fingerprint: impl Into<String>) -> Self
Set the fingerprint.
Sourcepub fn with_key_usage(self, usage: KeyUsage) -> Self
pub fn with_key_usage(self, usage: KeyUsage) -> Self
Add a key usage.
Sourcepub fn with_extended_key_usage(self, oid: impl Into<String>) -> Self
pub fn with_extended_key_usage(self, oid: impl Into<String>) -> Self
Add an extended key usage OID.
Trait Implementations§
Source§impl Clone for CertificateInfo
impl Clone for CertificateInfo
Source§fn clone(&self) -> CertificateInfo
fn clone(&self) -> CertificateInfo
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CertificateInfo
impl Debug for CertificateInfo
Source§impl<'de> Deserialize<'de> for CertificateInfo
impl<'de> Deserialize<'de> for CertificateInfo
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for CertificateInfo
impl PartialEq for CertificateInfo
Source§impl Serialize for CertificateInfo
impl Serialize for CertificateInfo
impl Eq for CertificateInfo
impl StructuralPartialEq for CertificateInfo
Auto Trait Implementations§
impl Freeze for CertificateInfo
impl RefUnwindSafe for CertificateInfo
impl Send for CertificateInfo
impl Sync for CertificateInfo
impl Unpin for CertificateInfo
impl UnsafeUnpin for CertificateInfo
impl UnwindSafe for CertificateInfo
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.