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 empty() -> RootCertStore
pub fn empty() -> RootCertStore
Make a new, empty 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>(&mut self, iter: T)where
T: IntoIterator<Item = TrustAnchor<'static>>,
fn extend<T>(&mut self, iter: T)where
T: IntoIterator<Item = TrustAnchor<'static>>,
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>(iter: T) -> RootCertStorewhere
T: IntoIterator<Item = TrustAnchor<'static>>,
fn from_iter<T>(iter: T) -> RootCertStorewhere
T: IntoIterator<Item = TrustAnchor<'static>>,
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,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)