#[non_exhaustive]pub struct CertificateFields {
pub subject: Name,
pub issuer: Name,
pub sans: Vec<San>,
pub serial: Vec<u8>,
pub fingerprint: PeerId,
pub not_before: i64,
pub not_after: i64,
}Expand description
The identifying fields of a certificate (feature fields).
Debug shows only the fingerprint.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.subject: NameThe subject.
issuer: NameThe issuer.
sans: Vec<San>The subject alternative names, in certificate order.
serial: Vec<u8>The serial number’s bytes as encoded.
fingerprint: PeerIdThe certificate’s SHA-256 id.
not_before: i64The start of the validity period, Unix seconds.
not_after: i64The end of the validity period, Unix seconds.
Implementations§
Source§impl CertificateFields
impl CertificateFields
Sourcepub fn parse(der: &[u8]) -> Result<Self, PeerError>
pub fn parse(der: &[u8]) -> Result<Self, PeerError>
Parses the DER encoding of one certificate. Nothing is verified: the fields are what the certificate says.
§Errors
PeerError::Certificate when der is not exactly one well-formed certificate, or
its subject alternative names cannot be read.
Sourcepub fn to_map(&self) -> BTreeMap<String, Vec<String>>
pub fn to_map(&self) -> BTreeMap<String, Vec<String>>
The fields as a map a consumer picks identities from, every value in certificate order:
subject,issuer: the names as text;subject.<attr>,issuer.<attr>: each attribute, by the short names ofName::attributes;san.dns,san.email,san.uri,san.upn: the names as written;san.ip: eachiPAddress, canonical (IPv6 compressed, IPv4-mapped as IPv4);san.dns.ip: eachdNSNamethat is an IP literal, canonical, for a consumer that treats such a name as an address;san.other.<oid>: the hex DER of each otherotherName;serial: lowercase hex, leading zero bytes dropped (0for zero);fingerprint:sha256:<hex>;not_before,not_after: Unix seconds.
Trait Implementations§
Source§impl Clone for CertificateFields
impl Clone for CertificateFields
Source§impl Debug for CertificateFields
impl Debug for CertificateFields
impl Eq for CertificateFields
Source§impl PartialEq for CertificateFields
impl PartialEq for CertificateFields
impl StructuralPartialEq for CertificateFields
Auto Trait Implementations§
impl Freeze for CertificateFields
impl RefUnwindSafe for CertificateFields
impl Send for CertificateFields
impl Sync for CertificateFields
impl Unpin for CertificateFields
impl UnsafeUnpin for CertificateFields
impl UnwindSafe for CertificateFields
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more