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; only ECDSA/Ed25519 verification allowed, RSA signatures forbidden",
34 ),
35 Self::HandshakeSignature => f.write_str(
36 "TLS handshake signature forbidden; only ECDSA/Ed25519 schemes allowed, RSA signatures forbidden",
37 ),
38 Self::CipherSuite => f.write_str(
39 "peer selected a forbidden cipher suite; only ChaCha20-Poly1305 allowed, AES forbidden",
40 ),
41 Self::PeerRejectedAlgorithms { alert } => write!(
42 f,
43 "peer rejected ECDSA/Ed25519 with ChaCha20-Poly1305 (TLS alert {alert}); RSA and AES forbidden; no fallback",
44 ),
45 }
46 }
47}
48
49impl std::error::Error for TlsPolicyError {}