pub struct CertificateChain {
pub certificates: Vec<CertificateInfo>,
}Available on crate feature
signatures only.Expand description
A certificate chain for validation.
Fields§
§certificates: Vec<CertificateInfo>Certificates in the chain, from leaf to root.
Implementations§
Source§impl CertificateChain
impl CertificateChain
Sourcepub fn new(certificates: Vec<CertificateInfo>) -> Self
pub fn new(certificates: Vec<CertificateInfo>) -> Self
Create a new certificate chain.
Sourcepub fn leaf(&self) -> Option<&CertificateInfo>
pub fn leaf(&self) -> Option<&CertificateInfo>
Get the leaf (end-entity) certificate.
Sourcepub fn root(&self) -> Option<&CertificateInfo>
pub fn root(&self) -> Option<&CertificateInfo>
Get the root certificate.
Sourcepub fn push(&mut self, cert: CertificateInfo)
pub fn push(&mut self, cert: CertificateInfo)
Add a certificate to the chain.
Sourcepub fn validate_structure(&self) -> CertificateValidation
pub fn validate_structure(&self) -> CertificateValidation
Validate the certificate chain structure (offline).
This performs basic structural validation:
- Chain is not empty
- Each certificate is issued by the next one in the chain
- Root certificate is self-signed
- CA certificates have the CA flag set
Note: This does NOT validate:
- Cryptographic signatures (requires parsing actual X.509)
- Expiration dates (requires current time)
- Revocation status (requires network)
Sourcepub fn validate_trust(
&self,
trusted_roots: &[CertificateInfo],
) -> CertificateValidation
pub fn validate_trust( &self, trusted_roots: &[CertificateInfo], ) -> CertificateValidation
Validate that the chain is trusted by the given trust anchors.
The chain’s root must match one of the trusted roots by fingerprint.
Trait Implementations§
Source§impl Clone for CertificateChain
impl Clone for CertificateChain
Source§fn clone(&self) -> CertificateChain
fn clone(&self) -> CertificateChain
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for CertificateChain
impl RefUnwindSafe for CertificateChain
impl Send for CertificateChain
impl Sync for CertificateChain
impl Unpin for CertificateChain
impl UnsafeUnpin for CertificateChain
impl UnwindSafe for CertificateChain
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
Mutably borrows from an owned value. Read more