pub struct ServerHashVerification { /* private fields */ }Expand description
A custom ServerCertVerifier implementation.
Configures the client to skip some server certificates validation.
This verifier is configured to accept server certificates whose digests match the specified SHA-256 hashes and fulfill some additional constraints (see notes below).
This is useful for scenarios where clients need to accept known self-signed certificates or certificates from non-standard authorities.
§Notes
- The current time MUST be within the validity period of the certificate.
- The total length of the validity period MUST NOT exceed two weeks.
- Only certificates for which the public key algorithm is ECDSA with the secp256r1 are accepted.
Implementations§
Source§impl ServerHashVerification
impl ServerHashVerification
Sourcepub fn new<H>(hashes: H) -> Selfwhere
H: IntoIterator<Item = Sha256Digest>,
pub fn new<H>(hashes: H) -> Selfwhere
H: IntoIterator<Item = Sha256Digest>,
Creates a new instance of ServerHashVerification.
§Arguments
hashes: An iterator yieldingSha256Digestinstances representing the accepted certificate hashes.
Sourcepub fn add(&mut self, digest: Sha256Digest)
pub fn add(&mut self, digest: Sha256Digest)
Adds a digest to the list of accepted certificates.
Trait Implementations§
Source§impl Debug for ServerHashVerification
impl Debug for ServerHashVerification
Source§impl FromIterator<Sha256Digest> for ServerHashVerification
impl FromIterator<Sha256Digest> for ServerHashVerification
Source§fn from_iter<T: IntoIterator<Item = Sha256Digest>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = Sha256Digest>>(iter: T) -> Self
Creates a value from an iterator. Read more
Source§impl ServerCertVerifier for ServerHashVerification
impl ServerCertVerifier for ServerHashVerification
Source§fn verify_server_cert(
&self,
end_entity: &CertificateDer<'_>,
_intermediates: &[CertificateDer<'_>],
_server_name: &ServerName<'_>,
_ocsp_response: &[u8],
now: UnixTime,
) -> Result<ServerCertVerified, Error>
fn verify_server_cert( &self, end_entity: &CertificateDer<'_>, _intermediates: &[CertificateDer<'_>], _server_name: &ServerName<'_>, _ocsp_response: &[u8], now: UnixTime, ) -> Result<ServerCertVerified, Error>
Verify the end-entity certificate
end_entity is valid for the
hostname dns_name and chains to at least one trust anchor. Read moreSource§fn verify_tls12_signature(
&self,
message: &[u8],
cert: &CertificateDer<'_>,
dss: &DigitallySignedStruct,
) -> Result<HandshakeSignatureValid, Error>
fn verify_tls12_signature( &self, message: &[u8], cert: &CertificateDer<'_>, dss: &DigitallySignedStruct, ) -> Result<HandshakeSignatureValid, Error>
Verify a signature allegedly by the given server certificate. Read more
Source§fn verify_tls13_signature(
&self,
message: &[u8],
cert: &CertificateDer<'_>,
dss: &DigitallySignedStruct,
) -> Result<HandshakeSignatureValid, Error>
fn verify_tls13_signature( &self, message: &[u8], cert: &CertificateDer<'_>, dss: &DigitallySignedStruct, ) -> Result<HandshakeSignatureValid, Error>
Verify a signature allegedly by the given server certificate. Read more
Source§fn supported_verify_schemes(&self) -> Vec<SignatureScheme>
fn supported_verify_schemes(&self) -> Vec<SignatureScheme>
Return the list of SignatureSchemes that this verifier will handle,
in
verify_tls12_signature and verify_tls13_signature calls. Read moreSource§fn requires_raw_public_keys(&self) -> bool
fn requires_raw_public_keys(&self) -> bool
Returns whether this verifier requires raw public keys as defined
in RFC 7250.
Source§fn root_hint_subjects(&self) -> Option<&[DistinguishedName]>
fn root_hint_subjects(&self) -> Option<&[DistinguishedName]>
Return the
DistinguishedNames of certificate authorities that this verifier trusts. Read moreAuto Trait Implementations§
impl Freeze for ServerHashVerification
impl !RefUnwindSafe for ServerHashVerification
impl Send for ServerHashVerification
impl Sync for ServerHashVerification
impl Unpin for ServerHashVerification
impl !UnwindSafe for ServerHashVerification
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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