Skip to main content

X509Certificate

Struct X509Certificate 

Source
pub struct X509Certificate<'a> {
Show 17 fields pub raw_der: &'a [u8], pub tbs_raw: &'a [u8], pub version: u8, pub serial_number: &'a [u8], pub sig_alg_oid: &'a [u8], pub issuer_raw: &'a [u8], pub issuer_cn: Option<&'a str>, pub not_before: &'a str, pub not_after: &'a str, pub subject_raw: &'a [u8], pub subject_cn: Option<&'a str>, pub spki_alg_oid: &'a [u8], pub spki_params: Option<&'a [u8]>, pub public_key: &'a [u8], pub dns_names: Vec<&'a str>, pub signature_alg_oid: &'a [u8], pub signature_value: &'a [u8],
}
Expand description

X.509 証明書構造体。

Fields§

§raw_der: &'a [u8]§tbs_raw: &'a [u8]§version: u8§serial_number: &'a [u8]§sig_alg_oid: &'a [u8]§issuer_raw: &'a [u8]§issuer_cn: Option<&'a str>§not_before: &'a str§not_after: &'a str§subject_raw: &'a [u8]§subject_cn: Option<&'a str>§spki_alg_oid: &'a [u8]§spki_params: Option<&'a [u8]>§public_key: &'a [u8]§dns_names: Vec<&'a str>§signature_alg_oid: &'a [u8]§signature_value: &'a [u8]

Implementations§

Source§

impl<'a> X509Certificate<'a>

Source

pub fn from_der(der: &'a [u8]) -> Result<Self, X509Error>

DER バイナリから X.509 証明書を解析する。

Source

pub fn matches_hostname(&self, hostname: &str) -> bool

ホスト名(例: “example.com” や “sub.domain.org”)と証明書が一致するか検証する(RFC 6125 準拠)。

Source

pub fn verify_signature( &self, signed_data: &[u8], signature_bytes: &[u8], ) -> Result<(), X509Error>

ECDSA-p256-SHA256 または RSA PKCS#1 v1.5 (SHA-256 / SHA-384 / SHA-512) 署名を本証明書の公開鍵で検証する。

Source

pub fn verify_signature_with_alg( &self, sig_alg_oid: &[u8], signed_data: &[u8], signature_bytes: &[u8], ) -> Result<(), X509Error>

署名アルゴリズム OID を明示指定して本証明書の公開鍵で署名を検証する。

Source

pub fn verify_validity_at(&self, unix_secs: u64) -> Result<(), X509Error>

指定した UNIX タイムスタンプ(秒)において本証明書が有効期間内(not_before <= unix_secs <= not_after)にあるか検証する。

Trait Implementations§

Source§

impl<'a> Clone for X509Certificate<'a>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for X509Certificate<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for X509Certificate<'a>

§

impl<'a> RefUnwindSafe for X509Certificate<'a>

§

impl<'a> Send for X509Certificate<'a>

§

impl<'a> Sync for X509Certificate<'a>

§

impl<'a> Unpin for X509Certificate<'a>

§

impl<'a> UnsafeUnpin for X509Certificate<'a>

§

impl<'a> UnwindSafe for X509Certificate<'a>

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> Same for T

Source§

type Output = T

Should always be Self
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.