pub struct PinnedServerCertVerifier { /* private fields */ }Expand description
Verifies server certificates against an optional pinned SHA-256 fingerprint.
LocalSend peers use self-signed certificates without PKI CAs. Peer identity is defined by the uppercase-hex SHA-256 fingerprint of the DER certificate.
When expected_fingerprint is Some, any certificate whose fingerprint differs is
immediately rejected with a descriptive error.
When expected_fingerprint is None, any cryptographically valid self-signed / peer
certificate is accepted (Trust On First Use, for discovery probes).
Implementations§
Source§impl PinnedServerCertVerifier
impl PinnedServerCertVerifier
Sourcepub fn new(
own_cert_pem: &str,
expected_fingerprint: Option<String>,
) -> Result<Self>
pub fn new( own_cert_pem: &str, expected_fingerprint: Option<String>, ) -> Result<Self>
Creates a new pinned server certificate verifier.
own_cert_pem is added to a local dummy root store so that the underlying signature
validator initializes properly without an empty-root error. It is never used as a trust CA.
Sourcepub fn expected_fingerprint(&self) -> Option<&str>
pub fn expected_fingerprint(&self) -> Option<&str>
Access the pinned fingerprint filter (if any).
Trait Implementations§
Source§impl Debug for PinnedServerCertVerifier
impl Debug for PinnedServerCertVerifier
Source§impl ServerCertVerifier for PinnedServerCertVerifier
impl ServerCertVerifier for PinnedServerCertVerifier
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>
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>
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>
Source§fn supported_verify_schemes(&self) -> Vec<SignatureScheme>
fn supported_verify_schemes(&self) -> Vec<SignatureScheme>
verify_tls12_signature and verify_tls13_signature calls. Read moreSource§fn requires_raw_public_keys(&self) -> bool
fn requires_raw_public_keys(&self) -> bool
Source§fn root_hint_subjects(&self) -> Option<&[DistinguishedName]>
fn root_hint_subjects(&self) -> Option<&[DistinguishedName]>
DistinguishedNames of certificate authorities that this verifier trusts. Read more