Struct trust_dns_proto::openssl::tls_server::X509
source · [−]pub struct X509(_);
dns-over-openssl
only.Expand description
An X509
public key certificate.
Implementations
sourceimpl X509
impl X509
sourcepub fn builder() -> Result<X509Builder, ErrorStack>
pub fn builder() -> Result<X509Builder, ErrorStack>
Returns a new builder.
sourcepub fn from_pem(pem: &[u8]) -> Result<X509, ErrorStack>
pub fn from_pem(pem: &[u8]) -> Result<X509, ErrorStack>
Deserializes a PEM-encoded X509 structure.
The input should have a header of -----BEGIN CERTIFICATE-----
.
This corresponds to PEM_read_bio_X509
.
sourcepub fn from_der(der: &[u8]) -> Result<X509, ErrorStack>
pub fn from_der(der: &[u8]) -> Result<X509, ErrorStack>
Deserializes a DER-encoded X509 structure.
This corresponds to d2i_X509
.
sourcepub fn stack_from_pem(pem: &[u8]) -> Result<Vec<X509, Global>, ErrorStack>
pub fn stack_from_pem(pem: &[u8]) -> Result<Vec<X509, Global>, ErrorStack>
Deserializes a list of PEM-formatted certificates.
This corresponds to PEM_read_bio_X509
.
Methods from Deref<Target = 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 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_name_hash(&self) -> u32
pub fn issuer_name_hash(&self) -> u32
Returns the hash of the certificates issuer
This corresponds to X509_issuer_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_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
.
Returns this certificate’s authority information access
entries, if they exist.
This corresponds to X509_get_ext_d2i
.
sourcepub fn public_key(&self) -> Result<PKey<Public>, ErrorStack>
pub fn public_key(&self) -> Result<PKey<Public>, ErrorStack>
This corresponds to X509_get_pubkey
.
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, Global>, ErrorStack>
renamed to digest
sourcepub fn not_after(&self) -> &Asn1TimeRef
pub fn not_after(&self) -> &Asn1TimeRef
Returns the certificate’s Not After validity period.
This corresponds to X509_getm_notAfter
.
sourcepub fn not_before(&self) -> &Asn1TimeRef
pub fn not_before(&self) -> &Asn1TimeRef
Returns the certificate’s Not Before validity period.
This corresponds to X509_getm_notBefore
.
sourcepub fn signature(&self) -> &Asn1BitStringRef
pub fn signature(&self) -> &Asn1BitStringRef
Returns the certificate’s signature
This corresponds to X509_get0_signature
.
sourcepub fn signature_algorithm(&self) -> &X509AlgorithmRef
pub fn signature_algorithm(&self) -> &X509AlgorithmRef
Returns the certificate’s signature algorithm.
This corresponds to X509_get0_signature
.
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.
This corresponds to X509_get1_ocsp
.
sourcepub fn issued(&self, subject: &X509Ref) -> X509VerifyResult
pub fn issued(&self, subject: &X509Ref) -> X509VerifyResult
Checks that this certificate issued subject
.
This corresponds to X509_check_issued
.
sourcepub fn version(&self) -> i32
pub fn version(&self) -> i32
Returns certificate version. If this certificate has no explicit version set, it defaults to version 1.
Note that 0
return value stands for version 1, 1
for version 2 and so on.
This corresponds to X509_get_version
.
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
.
sourcepub fn to_pem(&self) -> Result<Vec<u8, Global>, ErrorStack>
pub fn to_pem(&self) -> Result<Vec<u8, Global>, 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
.
sourcepub fn to_der(&self) -> Result<Vec<u8, Global>, ErrorStack>
pub fn to_der(&self) -> Result<Vec<u8, Global>, ErrorStack>
Serializes the certificate into a DER-encoded X509 structure.
This corresponds to i2d_X509
.
sourcepub fn to_text(&self) -> Result<Vec<u8, Global>, ErrorStack>
pub fn to_text(&self) -> Result<Vec<u8, Global>, ErrorStack>
Converts the certificate to human readable text.
This corresponds to X509_print
.
Trait Implementations
sourceimpl ForeignType for X509
impl ForeignType for X509
sourceimpl Ord for X509
impl Ord for X509
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl PartialEq<X509> for X509
impl PartialEq<X509> for X509
sourceimpl PartialEq<X509> for X509Ref
impl PartialEq<X509> for X509Ref
sourceimpl PartialEq<X509Ref> for X509
impl PartialEq<X509Ref> for X509
sourceimpl PartialOrd<X509> for X509
impl PartialOrd<X509> for X509
sourcefn partial_cmp(&self, other: &X509) -> Option<Ordering>
fn partial_cmp(&self, other: &X509) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl PartialOrd<X509> for X509Ref
impl PartialOrd<X509> for X509Ref
sourcefn partial_cmp(&self, other: &X509) -> Option<Ordering>
fn partial_cmp(&self, other: &X509) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl PartialOrd<X509Ref> for X509
impl PartialOrd<X509Ref> for X509
sourcefn partial_cmp(&self, other: &X509Ref) -> Option<Ordering>
fn partial_cmp(&self, other: &X509Ref) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl Stackable for X509
impl Stackable for X509
type StackType = stack_st_X509
type StackType = stack_st_X509
The C stack type for this element. Read more
impl Eq for X509
impl Send for X509
impl Sync for X509
Auto Trait Implementations
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more