#[non_exhaustive]pub enum Refusal {
NotPinned,
NotAccepted,
NotTrusted,
ChainWhenPinned,
NameMismatch,
AddressDenied {
rule: Option<usize>,
},
PeerDenied {
rule: Option<usize>,
},
AddressUnknown,
CertificateType,
}Expand description
Why this side refused a peer: its certificate, or its addresses under a policy’s access control list.
A verifier returns it inside
rustls::Error::InvalidCertificate(CertificateError::Other(OtherError(..))), so rustls
sends the certificate_unknown alert; Refusal::from_rustls and
PeerError::refusal take it back out. AddressDenied and an
AddressUnknown found at the ClientHello stop the handshake
before any certificate: rustls sends access_denied, and the accept helpers report the
refusal the same way. Expired and not-yet-valid certificates are rustls’s own
CertificateError::Expired and NotValidYet.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
NotPinned
The certificate matches no fixed pin.
NotAccepted
The certificate is not one the trust store accepted. A server with a store-backed pin set records it as waiting, within the store’s limits, once the peer proved its key.
NotTrusted
The certificate matches no pin, and the CA policy does not trust its chain or names,
or the Roots do not trust its chain (an unknown issuer, a bad
signature, a certificate not for server authentication).
ChainWhenPinned
A pinned peer presented a certificate chain, which the policy does not allow
(Policy::allow_chain_when_pinned).
NameMismatch
The server’s chain is trusted by the Roots, but the certificate is
not for the server name the client dialled.
AddressDenied
The policy’s access control list denies the connection’s addresses: the rule at index
rule, or its default when None. Decided from the ClientHello, before any
certificate.
PeerDenied
The policy’s access control list denies this client’s certificate from these
addresses: the rule at index rule, or its default when None. Decided before the
trust store is consulted, so nothing is recorded as waiting.
AddressUnknown
The policy has an access control list, and the connection’s source address, or the local address a rule with a destination or port needs, is unknown: the list is not decided, and the connection is refused.
CertificateType
The two sides authenticate with different certificate types: one with X.509
certificates, the other with raw public keys (RFC 7250). The side that finds out ends the
handshake with this refusal and the other sees the handshake_failure alert. A server
that serves both picks its configuration from the ClientHello
(offers_raw_public_key).
Implementations§
Trait Implementations§
impl Copy for Refusal
impl Eq for Refusal
Source§impl Error for Refusal
impl Error for Refusal
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()