pub struct RootCertStore {
pub roots: Vec<TrustAnchor<'static>>,
}
Expand description
A container for root certificates able to provide a root-of-trust for connection authentication.
Fields§
§roots: Vec<TrustAnchor<'static>>
The list of roots.
Implementations§
Source§impl RootCertStore
impl RootCertStore
Sourcepub fn add_parsable_certificates<'a>(
&mut self,
der_certs: impl IntoIterator<Item = CertificateDer<'a>>,
) -> (usize, usize)
pub fn add_parsable_certificates<'a>( &mut self, der_certs: impl IntoIterator<Item = CertificateDer<'a>>, ) -> (usize, usize)
Parse the given DER-encoded certificates and add all that can be parsed in a best-effort fashion.
This is because large collections of root certificates often include ancient or syntactically invalid certificates.
Returns the number of certificates added, and the number that were ignored.
Sourcepub fn add(&mut self, der: CertificateDer<'_>) -> Result<(), Error>
pub fn add(&mut self, der: CertificateDer<'_>) -> Result<(), Error>
Add a single DER-encoded certificate to the store.
This is suitable for a small set of root certificates that are expected to parse
successfully. For large collections of roots (for example from a system store) it
is expected that some of them might not be valid according to the rules rustls
implements. As long as a relatively limited number of certificates are affected,
this should not be a cause for concern. Use RootCertStore::add_parsable_certificates
in order to add as many valid roots as possible and to understand how many certificates
have been diagnosed as malformed.
Sourcepub fn subjects(&self) -> Vec<DistinguishedName>
pub fn subjects(&self) -> Vec<DistinguishedName>
Return the DER encoded DistinguishedName
of each trust anchor subject in the root
cert store.
Each DistinguishedName
will be a DER-encoded X.500 distinguished name, per
RFC 5280 A.1, including the outer SEQUENCE
.
Trait Implementations§
Source§impl Clone for RootCertStore
impl Clone for RootCertStore
Source§fn clone(&self) -> RootCertStore
fn clone(&self) -> RootCertStore
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for RootCertStore
impl Debug for RootCertStore
Source§impl Extend<TrustAnchor<'static>> for RootCertStore
impl Extend<TrustAnchor<'static>> for RootCertStore
Source§fn extend<T: IntoIterator<Item = TrustAnchor<'static>>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = TrustAnchor<'static>>>(&mut self, iter: T)
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)Source§impl FromIterator<TrustAnchor<'static>> for RootCertStore
impl FromIterator<TrustAnchor<'static>> for RootCertStore
Source§fn from_iter<T: IntoIterator<Item = TrustAnchor<'static>>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = TrustAnchor<'static>>>(iter: T) -> Self
Auto Trait Implementations§
impl Freeze for RootCertStore
impl RefUnwindSafe for RootCertStore
impl Send for RootCertStore
impl Sync for RootCertStore
impl Unpin for RootCertStore
impl UnwindSafe for RootCertStore
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 24 bytes