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
)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
)