#[non_exhaustive]pub enum Error {
Show 20 variants
Open(Error),
ReadFile(Error),
Read(Error),
Key(Error),
Empty,
EmptyRoots(PathBuf),
NoRoots,
Fingerprint(FromHexError),
FingerprintLength(usize),
FingerprintWithRoots,
AddRoot(Error),
ClientAuth(Error),
IncompleteClientAuth,
CertKeyCountMismatch,
NoCertSource,
KeyMismatch {
key: PathBuf,
cert: PathBuf,
source: Error,
},
Rustls(Error),
ClientVerifier(VerifierBuilderError),
Rcgen(Error),
NoCryptoProvider,
}Expand description
Errors loading or generating TLS certificates and keys.
Shared by the client TLS config and the quinn/noq servers so each backend’s
error type can compose it via #[from].
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Open(Error)
A certificate file couldn’t be opened, usually a bad path or permissions.
ReadFile(Error)
A certificate or key file was opened but couldn’t be read to the end.
Read(Error)
A file’s contents aren’t valid PEM certificates.
Key(Error)
A file’s contents aren’t a valid PEM private key.
Empty
A PEM file parsed cleanly but held no certificates.
EmptyRoots(PathBuf)
A root PEM file parsed cleanly but held no certificates, so it would trust nothing.
NoRoots
Nothing is configured that could ever verify a server certificate.
Fingerprint(FromHexError)
A configured fingerprint isn’t valid hex.
FingerprintLength(usize)
A configured fingerprint is valid hex but the wrong size for a SHA-256 digest.
FingerprintWithRoots
Fingerprint pinning was combined with CA roots. Pinning bypasses the chain, so one of the two would be silently ignored.
AddRoot(Error)
A root certificate parsed as PEM but rustls rejected it as a trust anchor.
ClientAuth(Error)
rustls rejected the mTLS client certificate and key, e.g. they don’t match.
IncompleteClientAuth
Only one half of the mTLS client identity was given; it needs both a cert and a key.
CertKeyCountMismatch
The server was given a different number of certificates than keys. They pair by index.
NoCertSource
The server has no certificate to serve: no cert/key pair and no hostnames to generate one for.
KeyMismatch
A server cert/key pair was paired up by index but the key isn’t the certificate’s.
Fields
Rustls(Error)
A rustls error with no more specific context, e.g. building a config.
ClientVerifier(VerifierBuilderError)
The mTLS client-certificate verifier couldn’t be built from the configured roots.
Rcgen(Error)
Generating a self-signed certificate failed.
NoCryptoProvider
The crate was built without a crypto provider, so no TLS is possible.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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()