blitz_traits/
tls_policy.rs1#[non_exhaustive]
5#[derive(Clone, Copy, Debug, Eq, PartialEq)]
6pub enum TlsPolicyError {
7 RsaCertificateChain,
9 CertificateKey,
11 CertificateSignature,
13 HandshakeSignature,
15 CipherSuite,
17 PeerRejectedAlgorithms { alert: u8 },
21}
22
23impl std::fmt::Display for TlsPolicyError {
24 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
25 match self {
26 Self::RsaCertificateChain => f.write_str(
27 "RSA certificate chain forbidden; ECDSA/Ed25519 keys required throughout the chain (alert 43 unsupported_certificate)",
28 ),
29 Self::CertificateKey => f.write_str(
30 "certificate key forbidden; only ECDSA/Ed25519 keys allowed (alert 43 unsupported_certificate)",
31 ),
32 Self::CertificateSignature => f.write_str(
33 "certificate signature forbidden; ECDSA/Ed25519/RSA signature verification required",
34 ),
35 Self::HandshakeSignature => f.write_str(
36 "TLS handshake signature forbidden; only advertised ECDSA/Ed25519/RSA verification schemes allowed",
37 ),
38 Self::CipherSuite => f.write_str(
39 "tls-chacha-required: peer selected an unoffered cipher suite; ChaCha20-Poly1305 required",
40 ),
41 Self::PeerRejectedAlgorithms { alert } => write!(
42 f,
43 "tls-chacha-required: peer rejected the ChaCha20-Poly1305 offer (TLS alert {alert}); no fallback",
44 ),
45 }
46 }
47}
48
49impl std::error::Error for TlsPolicyError {}