pub struct Certificate { /* private fields */ }Expand description
X.509 certificate
Implementations§
Source§impl Certificate
impl Certificate
Sourcepub fn load(data: &[u8]) -> Result<Certificate>
pub fn load(data: &[u8]) -> Result<Certificate>
Load a X.509 certificate from DER or PEM representation
Sourcepub fn from_file(fsname: &str) -> Result<Certificate>
pub fn from_file(fsname: &str) -> Result<Certificate>
Read an X.509 certificate from a file
Sourcepub fn serial_number(&self) -> Result<Vec<u8>>
pub fn serial_number(&self) -> Result<Vec<u8>>
Return the serial number of this certificate
Sourcepub fn fingerprint(&self, hash: &str) -> Result<Vec<u8>>
pub fn fingerprint(&self, hash: &str) -> Result<Vec<u8>>
Return the fingerprint of this certificate
Sourcepub fn duplicate(&self) -> Result<Certificate>
pub fn duplicate(&self) -> Result<Certificate>
Duplicate the certificate object
Since certificate objects are immutable, duplication just involves atomic incrementing a reference count, so is quite cheap
Return the authority key id, if set
Sourcepub fn subject_key_id(&self) -> Result<Vec<u8>>
pub fn subject_key_id(&self) -> Result<Vec<u8>>
Return the subject key id, if set
Sourcepub fn not_before_raw(&self) -> Result<u64>
pub fn not_before_raw(&self) -> Result<u64>
Return the certificate notBefore time in seconds since epoch
Sourcepub fn not_after_raw(&self) -> Result<u64>
pub fn not_after_raw(&self) -> Result<u64>
Return the certificate notAfter time in seconds since epoch
Sourcepub fn not_before(&self) -> Result<SystemTime>
pub fn not_before(&self) -> Result<SystemTime>
Return the certificate notBefore time as a SystemTime
Sourcepub fn not_after(&self) -> Result<SystemTime>
pub fn not_after(&self) -> Result<SystemTime>
Return the certificate notBefore time as a SystemTime
Sourcepub fn public_key_bits(&self) -> Result<Vec<u8>>
pub fn public_key_bits(&self) -> Result<Vec<u8>>
Return the byte representation of the public key
Sourcepub fn public_key(&self) -> Result<Pubkey>
pub fn public_key(&self) -> Result<Pubkey>
Return the public key included in this certificate
Sourcepub fn to_string(&self) -> Result<String>
pub fn to_string(&self) -> Result<String>
Return a free-form string representation of this certificate
Sourcepub fn allows_usage(&self, usage: CertUsage) -> Result<bool>
pub fn allows_usage(&self, usage: CertUsage) -> Result<bool>
Test if the certificate is allowed for a particular usage
Sourcepub fn verify(
&self,
intermediates: &[&Certificate],
trusted: &[&Certificate],
trusted_path: Option<&str>,
hostname: Option<&str>,
reference_time: Option<u64>,
) -> Result<CertValidationStatus>
pub fn verify( &self, intermediates: &[&Certificate], trusted: &[&Certificate], trusted_path: Option<&str>, hostname: Option<&str>, reference_time: Option<u64>, ) -> Result<CertValidationStatus>
Attempt to verify this certificate
Sourcepub fn matches_hostname(&self, hostname: &str) -> Result<bool>
pub fn matches_hostname(&self, hostname: &str) -> Result<bool>
Return true if the provided hostname is valid for this certificate
Trait Implementations§
Source§impl Clone for Certificate
impl Clone for Certificate
Source§fn clone(&self) -> Certificate
fn clone(&self) -> Certificate
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more