Struct schannel::cert_context::CertContext
source · pub struct CertContext(/* private fields */);
Expand description
Wrapper of a winapi certificate, or a PCCERT_CONTEXT
.
Implementations§
source§impl CertContext
impl CertContext
sourcepub fn new(data: &[u8]) -> Result<CertContext>
pub fn new(data: &[u8]) -> Result<CertContext>
Decodes a DER-formatted X509 certificate.
sourcepub fn subject_public_key_info_der(&self) -> Result<Vec<u8>>
pub fn subject_public_key_info_der(&self) -> Result<Vec<u8>>
Certificate subject public key info
sourcepub fn from_pem(pem: &str) -> Result<CertContext>
pub fn from_pem(pem: &str) -> Result<CertContext>
Decodes a PEM-formatted X509 certificate.
sourcepub fn fingerprint(&self, alg: HashAlgorithm) -> Result<Vec<u8>>
pub fn fingerprint(&self, alg: HashAlgorithm) -> Result<Vec<u8>>
Returns a hash of this certificate
sourcepub fn sha1(&self) -> Result<[u8; 20]>
👎Deprecated: please use fingerprint instead
pub fn sha1(&self) -> Result<[u8; 20]>
Returns the sha1 hash of this certificate
The sha1 is returned as a 20-byte array representing the bits of the sha1 hash.
sourcepub fn sign_hash_algorithms(&self) -> Result<String>
pub fn sign_hash_algorithms(&self) -> Result<String>
Returns the <SIGNATURE>/<HASH>
string representing the certificate
signature.
The <SIGNATURE>
value identifies the CNG public key
algorithm. The <HASH>
value identifies the CNG hash algorithm.
Common examples are:
RSA/SHA1
RSA/SHA256
ECDSA/SHA256
sourcepub fn signature_hash(&self) -> Result<Vec<u8>>
pub fn signature_hash(&self) -> Result<Vec<u8>>
Returns the signature hash.
sourcepub fn description(&self) -> Result<Vec<u8>>
pub fn description(&self) -> Result<Vec<u8>>
Returns the property displayed by the certificate UI. This property allows the user to describe the certificate’s use.
sourcepub fn friendly_name(&self) -> Result<String>
pub fn friendly_name(&self) -> Result<String>
Returns a string that contains the display name for the certificate.
sourcepub fn set_friendly_name(&self, name: &str) -> Result<()>
pub fn set_friendly_name(&self, name: &str) -> Result<()>
Configures the string that contains the display name for this certificate.
sourcepub fn is_time_valid(&self) -> Result<bool>
pub fn is_time_valid(&self) -> Result<bool>
Verifies the time validity of this certificate relative to the system’s current time.
sourcepub fn private_key(&self) -> AcquirePrivateKeyOptions<'_>
pub fn private_key(&self) -> AcquirePrivateKeyOptions<'_>
Returns a builder used to acquire the private key corresponding to this certificate.
sourcepub fn set_key_prov_info(&self) -> SetKeyProvInfo<'_>
pub fn set_key_prov_info(&self) -> SetKeyProvInfo<'_>
Returns a builder used to set the private key associated with this certificate.
sourcepub fn valid_uses(&self) -> Result<ValidUses>
pub fn valid_uses(&self) -> Result<ValidUses>
Returns the valid uses for this certificate
sourcepub fn cert_store(&self) -> Option<CertStore>
pub fn cert_store(&self) -> Option<CertStore>
For a remote certificate, returns a certificate store containing any intermediate certificates provided by the remote sender.
Trait Implementations§
source§impl Clone for CertContext
impl Clone for CertContext
source§fn clone(&self) -> CertContext
fn clone(&self) -> CertContext
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for CertContext
impl Debug for CertContext
source§impl Drop for CertContext
impl Drop for CertContext
source§impl PartialEq for CertContext
impl PartialEq for CertContext
source§fn eq(&self, other: &CertContext) -> bool
fn eq(&self, other: &CertContext) -> bool
self
and other
values to be equal, and is used
by ==
.