跳到主要内容

RootCertStore

结构体 RootCertStore 

Source
pub struct RootCertStore {
    pub roots: Vec<TrustAnchor<'static>>,
}
展开描述

A container 用于 root certificates able 到 provide 一个 root-of-trust 用于 connection authentication.

字段§

§roots: Vec<TrustAnchor<'static>>

此 list of roots.

实现§

Source§

impl RootCertStore

Source

pub fn empty() -> Self

创建一个新的空 RootCertStore

Source

pub fn add_parsable_certificates<'a>( &mut self, der_certs: impl IntoIterator<Item = CertificateDer<'a>>, ) -> (usize, usize)

解析提供的 DER-encoded certificates 并 add all that can be parsed in 一个 best-effort fashion.

This is because large collections of root certificates often include ancient 或 syntactically invalid 证书

返回已添加证书的数量与被忽略的数量。

Source

pub fn add(&mut self, der: CertificateDer<'_>) -> Result<(), Error>

Add 一个 single DER-encoded certificate 到 the store.

This 适合于 一个 small set of root certificates that are expected 到 parse successfully. For large collections of roots (用于 example 从 一个 system store) it is expected that some of them might not be valid according 到 the rules rustls implements. As long as 一个 relatively limited number of certificates are affected, this should not be 一个 cause 用于 concern. Use RootCertStore::add_parsable_certificates in order 到 add as many valid roots as possible 并 到 understand how many certificates have been diagnosed as malformed.

Source

pub fn subjects(&self) -> Vec<DistinguishedName>

返回 DER 编码的 DistinguishedName of each trust anchor subject in the root cert store.

Each DistinguishedName , 一个 DER-encoded X.500 distinguished name, per RFC 5280 A.1, including the outer SEQUENCE

Source

pub fn is_empty(&self) -> bool

如果没有证书,则返回 true

Source

pub fn len(&self) -> usize

说明容器中有多少张证书

Trait 实现§

Source§

impl Clone for RootCertStore

Source§

fn clone(&self) -> RootCertStore

返回值的副本。 更多信息
1.0.0 · Source§

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

Performs copy-assignment 从 source. 更多信息
Source§

impl Debug for RootCertStore

Source§

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

使用给定的格式化器格式化此值。 更多信息
Source§

impl Extend<TrustAnchor<'static>> for RootCertStore

Source§

fn extend<T: IntoIterator<Item = TrustAnchor<'static>>>(&mut self, iter: T)

Extends 一个 collection with the contents of an iterator. 更多信息
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends 一个 collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in 一个 collection 的 given number of additional elements. 更多信息
Source§

impl FromIterator<TrustAnchor<'static>> for RootCertStore

Source§

fn from_iter<T: IntoIterator<Item = TrustAnchor<'static>>>(iter: T) -> Self

Creates 一个 value 从 an iterator. 更多信息

自动 Trait 实现§

Blanket 实现§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. 更多信息
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows 从 an owned value. 更多信息
Source§

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

Source§

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

Mutably borrows 从 an owned value. 更多信息
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 从 selfdest. 更多信息
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

原样返回传入的参数。

Source§

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

Source§

fn into(self) -> U

Calls U::从(self)

That is, this conversion is whatever the implementation of From<T> 用于 U 的实现方式。

Source§

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

Source§

type Owned = T

获得所有权后的类型。
Source§

fn to_owned(&self) -> T

Creates owned data 从 borrowed data, usually by cloning. 更多信息
Source§

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

Uses borrowed data 到 replace owned data, usually by cloning. 更多信息
Source§

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

Source§

type Error = Infallible

转换出错时返回的类型。
Source§

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

执行转换。
Source§

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

Source§

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

转换出错时返回的类型。
Source§

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

执行转换。