X509

Struct X509 

Source
pub struct X509 { /* private fields */ }
Expand description

This implements the common core fields for x509 certificates. This information is likely logged with TLS sessions, digital signatures found in executable binaries, S/MIME information in email bodies, or analysis of files on disk.

When the certificate relates to a file, use the fields at file.x509. When hashes of the DER-encoded certificate are available, the hash data set should be populated as well (e.g. file.hash.sha256).

Events that contain certificate information about network connections, should use the x509 fields under the relevant TLS fields: tls.server.x509 and/or tls.client.x509.

Implementations§

Source§

impl X509

Source

pub fn get_version_number(&self) -> Option<&String>

Version of x509 format.

Source

pub fn set_version_number(&mut self, version_number_arg: String)

Version of x509 format.

§Example

3

Source

pub fn get_serial_number(&self) -> Option<&String>

Unique serial number issued by the certificate authority. For consistency, if this value is alphanumeric, it should be formatted without colons and uppercase characters.

Source

pub fn set_serial_number(&mut self, serial_number_arg: String)

Unique serial number issued by the certificate authority. For consistency, if this value is alphanumeric, it should be formatted without colons and uppercase characters.

§Example

55FBB9C7DEBF09809D12CCAA

Source

pub fn get_issuer_distinguished_name(&self) -> Option<&String>

Distinguished name (DN) of issuing certificate authority.

Source

pub fn set_issuer_distinguished_name( &mut self, issuer_distinguished_name_arg: String, )

Distinguished name (DN) of issuing certificate authority.

§Example

C=US, O=Example Inc, OU=www.example.com, CN=Example SHA2 High Assurance Server CA

Source

pub fn get_issuer_common_name(&self) -> &Vec<String>

List of common name (CN) of issuing certificate authority.

Source

pub fn add_issuer_common_name(&mut self, issuer_common_name_arg: String)

List of common name (CN) of issuing certificate authority.

§Example

Example SHA2 High Assurance Server CA

Source

pub fn get_issuer_organizational_unit(&self) -> &Vec<String>

List of organizational units (OU) of issuing certificate authority.

Source

pub fn add_issuer_organizational_unit( &mut self, issuer_organizational_unit_arg: String, )

List of organizational units (OU) of issuing certificate authority.

§Example

www.example.com

Source

pub fn get_issuer_organization(&self) -> &Vec<String>

List of organizations (O) of issuing certificate authority.

Source

pub fn add_issuer_organization(&mut self, issuer_organization_arg: String)

List of organizations (O) of issuing certificate authority.

§Example

Example Inc

Source

pub fn get_issuer_locality(&self) -> &Vec<String>

List of locality names (L)

Source

pub fn add_issuer_locality(&mut self, issuer_locality_arg: String)

List of locality names (L)

§Example

Mountain View

Source

pub fn get_issuer_state_or_province(&self) -> &Vec<String>

List of state or province names (ST, S, or P)

Source

pub fn add_issuer_state_or_province( &mut self, issuer_state_or_province_arg: String, )

List of state or province names (ST, S, or P)

§Example

California

Source

pub fn get_issuer_country(&self) -> &Vec<String>

List of country (C) codes

Source

pub fn add_issuer_country(&mut self, issuer_country_arg: String)

List of country (C) codes

§Example

US

Source

pub fn get_signature_algorithm(&self) -> Option<&String>

Identifier for certificate signature algorithm. We recommend using names found in Go Lang Crypto library. See https://github.com/golang/go/blob/go1.14/src/crypto/x509/x509.go#L337-L353.

Source

pub fn set_signature_algorithm(&mut self, signature_algorithm_arg: String)

Identifier for certificate signature algorithm. We recommend using names found in Go Lang Crypto library. See https://github.com/golang/go/blob/go1.14/src/crypto/x509/x509.go#L337-L353.

§Example

SHA256-RSA

Source

pub fn get_not_before(&self) -> Option<&Timestamp>

Time at which the certificate is first considered valid.

Source

pub fn set_not_before(&mut self, not_before_arg: Timestamp)

Time at which the certificate is first considered valid.

§Example

2019-08-16T01:40:25Z

Source

pub fn get_not_after(&self) -> Option<&Timestamp>

Time at which the certificate is no longer considered valid.

Source

pub fn set_not_after(&mut self, not_after_arg: Timestamp)

Time at which the certificate is no longer considered valid.

§Example

2020-07-16T03:15:39Z

Source

pub fn get_subject_distinguished_name(&self) -> Option<&String>

Distinguished name (DN) of the certificate subject entity.

Source

pub fn set_subject_distinguished_name( &mut self, subject_distinguished_name_arg: String, )

Distinguished name (DN) of the certificate subject entity.

§Example

C=US, ST=California, L=San Francisco, O=Example, Inc., CN=shared.global.example.net

Source

pub fn get_subject_common_name(&self) -> &Vec<String>

List of common names (CN) of subject.

Source

pub fn add_subject_common_name(&mut self, subject_common_name_arg: String)

List of common names (CN) of subject.

§Example

shared.global.example.net

Source

pub fn get_subject_organizational_unit(&self) -> &Vec<String>

List of organizational units (OU) of subject.

Source

pub fn add_subject_organizational_unit( &mut self, subject_organizational_unit_arg: String, )

List of organizational units (OU) of subject.

Source

pub fn get_subject_organization(&self) -> &Vec<String>

List of organizations (O) of subject.

Source

pub fn add_subject_organization(&mut self, subject_organization_arg: String)

List of organizations (O) of subject.

§Example

Example, Inc.

Source

pub fn get_subject_locality(&self) -> &Vec<String>

List of locality names (L)

Source

pub fn add_subject_locality(&mut self, subject_locality_arg: String)

List of locality names (L)

§Example

San Francisco

Source

pub fn get_subject_state_or_province(&self) -> &Vec<String>

List of state or province names (ST, S, or P)

Source

pub fn add_subject_state_or_province( &mut self, subject_state_or_province_arg: String, )

List of state or province names (ST, S, or P)

§Example

California

Source

pub fn get_subject_country(&self) -> &Vec<String>

List of country (C) code

Source

pub fn add_subject_country(&mut self, subject_country_arg: String)

List of country (C) code

§Example

US

Source

pub fn get_public_key_algorithm(&self) -> Option<&String>

Algorithm used to generate the public key.

Source

pub fn set_public_key_algorithm(&mut self, public_key_algorithm_arg: String)

Algorithm used to generate the public key.

§Example

RSA

Source

pub fn get_public_key_size(&self) -> Option<&u64>

The size of the public key space in bits.

Source

pub fn set_public_key_size(&mut self, public_key_size_arg: u64)

The size of the public key space in bits.

§Example

2048

Source

pub fn get_public_key_exponent(&self) -> Option<&u64>

Exponent used to derive the public key. This is algorithm specific.

Source

pub fn set_public_key_exponent(&mut self, public_key_exponent_arg: u64)

Exponent used to derive the public key. This is algorithm specific.

§Example

65537

Source

pub fn get_public_key_curve(&self) -> Option<&String>

The curve used by the elliptic curve public key algorithm. This is algorithm specific.

Source

pub fn set_public_key_curve(&mut self, public_key_curve_arg: String)

The curve used by the elliptic curve public key algorithm. This is algorithm specific.

§Example

nistp521

Source

pub fn get_alternative_names(&self) -> &Vec<String>

List of subject alternative names (SAN). Name types vary by certificate authority and certificate type but commonly contain IP addresses, DNS names (and wildcards), and email addresses.

Source

pub fn add_alternative_name(&mut self, alternative_name_arg: String)

List of subject alternative names (SAN). Name types vary by certificate authority and certificate type but commonly contain IP addresses, DNS names (and wildcards), and email addresses.

§Example

*.elastic.co

Trait Implementations§

Source§

impl Clone for X509

Source§

fn clone(&self) -> X509

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for X509

Source§

fn default() -> X509

Returns the “default value” for a type. Read more
Source§

impl Serialize for X509

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for X509

§

impl RefUnwindSafe for X509

§

impl Send for X509

§

impl Sync for X509

§

impl Unpin for X509

§

impl UnwindSafe for X509

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.