pub struct X509Ref(/* private fields */);
Expand description
A borrowed reference to a X509
.
Implementations§
Source§impl X509Ref
impl X509Ref
Sourcepub fn subject_name(&self) -> &X509NameRef
pub fn subject_name(&self) -> &X509NameRef
Returns this certificate’s subject name.
This corresponds to X509_get_subject_name
.
Sourcepub fn subject_name_hash(&self) -> u32
pub fn subject_name_hash(&self) -> u32
Returns the hash of the certificates subject
This corresponds to X509_subject_name_hash
.
Sourcepub fn subject_alt_names(&self) -> Option<Stack<GeneralName>>
pub fn subject_alt_names(&self) -> Option<Stack<GeneralName>>
Returns this certificate’s subject alternative name entries, if they exist.
This corresponds to X509_get_ext_d2i
.
Sourcepub fn issuer_name(&self) -> &X509NameRef
pub fn issuer_name(&self) -> &X509NameRef
Returns this certificate’s issuer name.
This corresponds to X509_get_issuer_name
.
Sourcepub fn issuer_alt_names(&self) -> Option<Stack<GeneralName>>
pub fn issuer_alt_names(&self) -> Option<Stack<GeneralName>>
Returns this certificate’s issuer alternative name entries, if they exist.
This corresponds to X509_get_ext_d2i
.
Sourcepub fn subject_key_id(&self) -> Option<&Asn1StringRef>
pub fn subject_key_id(&self) -> Option<&Asn1StringRef>
Returns this certificate’s subject key id, if it exists.
This corresponds to X509_get0_subject_key_id
.
Returns this certificate’s authority key id, if it exists.
This corresponds to X509_get0_authority_key_id
.
pub fn public_key(&self) -> Result<PKey<Public>, ErrorStack>
Sourcepub fn digest(
&self,
hash_type: MessageDigest,
) -> Result<DigestBytes, ErrorStack>
pub fn digest( &self, hash_type: MessageDigest, ) -> Result<DigestBytes, ErrorStack>
Returns a digest of the DER representation of the certificate.
This corresponds to X509_digest
.
pub fn fingerprint( &self, hash_type: MessageDigest, ) -> Result<Vec<u8>, ErrorStack>
Sourcepub fn not_after(&self) -> &Asn1TimeRef
pub fn not_after(&self) -> &Asn1TimeRef
Returns the certificate’s Not After validity period.
Sourcepub fn not_before(&self) -> &Asn1TimeRef
pub fn not_before(&self) -> &Asn1TimeRef
Returns the certificate’s Not Before validity period.
Sourcepub fn signature(&self) -> &Asn1BitStringRef
pub fn signature(&self) -> &Asn1BitStringRef
Returns the certificate’s signature
Sourcepub fn signature_algorithm(&self) -> &X509AlgorithmRef
pub fn signature_algorithm(&self) -> &X509AlgorithmRef
Returns the certificate’s signature algorithm.
Sourcepub fn ocsp_responders(&self) -> Result<Stack<OpensslString>, ErrorStack>
pub fn ocsp_responders(&self) -> Result<Stack<OpensslString>, ErrorStack>
Returns the list of OCSP responder URLs specified in the certificate’s Authority Information Access field.
Sourcepub fn issued(&self, subject: &X509Ref) -> Result<(), X509VerifyError>
pub fn issued(&self, subject: &X509Ref) -> Result<(), X509VerifyError>
Checks that this certificate issued subject
.
Sourcepub fn verify<T>(&self, key: &PKeyRef<T>) -> Result<bool, ErrorStack>where
T: HasPublic,
pub fn verify<T>(&self, key: &PKeyRef<T>) -> Result<bool, ErrorStack>where
T: HasPublic,
Check if the certificate is signed using the given public key.
Only the signature is checked: no other checks (such as certificate chain validity) are performed.
Returns true
if verification succeeds.
This corresponds to X509_verify
.
Sourcepub fn serial_number(&self) -> &Asn1IntegerRef
pub fn serial_number(&self) -> &Asn1IntegerRef
Returns this certificate’s serial number.
This corresponds to X509_get_serialNumber
.
pub fn check_host(&self, host: &str) -> Result<bool, ErrorStack>
Sourcepub fn to_pem(&self) -> Result<Vec<u8>, ErrorStack>
pub fn to_pem(&self) -> Result<Vec<u8>, ErrorStack>
Serializes the certificate into a PEM-encoded X509 structure.
The output will have a header of -----BEGIN CERTIFICATE-----
.
This corresponds to PEM_write_bio_X509
.