Struct x509_certificate::rfc5280::Certificate
source · pub struct Certificate {
pub tbs_certificate: TbsCertificate,
pub signature_algorithm: AlgorithmIdentifier,
pub signature: BitString,
}Expand description
An X.509 certificate.
This is the main data structure representing an X.509 certificate.
Certificate ::= SEQUENCE {
tbsCertificate TBSCertificate,
signatureAlgorithm AlgorithmIdentifier,
signature BIT STRING }
Fields§
§tbs_certificate: TbsCertificate§signature_algorithm: AlgorithmIdentifier§signature: BitStringImplementations§
source§impl Certificate
impl Certificate
sourcepub fn take_from<S: Source>(
cons: &mut Constructed<'_, S>
) -> Result<Self, DecodeError<S::Error>>
pub fn take_from<S: Source>(
cons: &mut Constructed<'_, S>
) -> Result<Self, DecodeError<S::Error>>
Examples found in repository?
src/certificate.rs (line 72)
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
pub fn from_der(data: impl AsRef<[u8]>) -> Result<Self, Error> {
let cert = Constructed::decode(data.as_ref(), Mode::Der, |cons| {
rfc5280::Certificate::take_from(cons)
})?;
Ok(Self(cert))
}
/// Construct an instance by parsing BER encoded ASN.1 data.
///
/// X.509 certificates are likely (and should be) using DER encoding.
/// However, some specifications do mandate the use of BER, so this
/// method is provided.
pub fn from_ber(data: impl AsRef<[u8]>) -> Result<Self, Error> {
let cert = Constructed::decode(data.as_ref(), Mode::Ber, |cons| {
rfc5280::Certificate::take_from(cons)
})?;
Ok(Self(cert))
}sourcepub fn from_sequence<S: Source>(
cons: &mut Constructed<'_, S>
) -> Result<Self, DecodeError<S::Error>>
pub fn from_sequence<S: Source>(
cons: &mut Constructed<'_, S>
) -> Result<Self, DecodeError<S::Error>>
sourcepub fn encode_ref(&self) -> impl Values + '_
pub fn encode_ref(&self) -> impl Values + '_
sourcepub fn iter_extensions(&self) -> impl Iterator<Item = &Extension>
pub fn iter_extensions(&self) -> impl Iterator<Item = &Extension>
Iterate over extensions defined on this certificate.
Trait Implementations§
source§impl AsMut<Certificate> for X509Certificate
impl AsMut<Certificate> for X509Certificate
source§fn as_mut(&mut self) -> &mut Certificate
fn as_mut(&mut self) -> &mut Certificate
Converts this type into a mutable reference of the (usually inferred) input type.
source§impl AsRef<Certificate> for CapturedX509Certificate
impl AsRef<Certificate> for CapturedX509Certificate
source§fn as_ref(&self) -> &Certificate
fn as_ref(&self) -> &Certificate
Converts this type into a shared reference of the (usually inferred) input type.
source§impl AsRef<Certificate> for X509Certificate
impl AsRef<Certificate> for X509Certificate
source§fn as_ref(&self) -> &Certificate
fn as_ref(&self) -> &Certificate
Converts this type into a shared reference of the (usually inferred) input type.
source§impl Clone for Certificate
impl Clone for Certificate
source§fn clone(&self) -> Certificate
fn clone(&self) -> Certificate
Returns a copy 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 Certificate
impl Debug for Certificate
source§impl From<CapturedX509Certificate> for Certificate
impl From<CapturedX509Certificate> for Certificate
source§fn from(cert: CapturedX509Certificate) -> Self
fn from(cert: CapturedX509Certificate) -> Self
Converts to this type from the input type.
source§impl From<Certificate> for X509Certificate
impl From<Certificate> for X509Certificate
source§fn from(v: Certificate) -> Self
fn from(v: Certificate) -> Self
Converts to this type from the input type.
source§impl From<X509Certificate> for Certificate
impl From<X509Certificate> for Certificate
source§fn from(v: X509Certificate) -> Self
fn from(v: X509Certificate) -> Self
Converts to this type from the input type.
source§impl PartialEq<Certificate> for Certificate
impl PartialEq<Certificate> for Certificate
source§fn eq(&self, other: &Certificate) -> bool
fn eq(&self, other: &Certificate) -> bool
This method tests for
self and other values to be equal, and is used
by ==.