pub struct AlertDescription(pub u8);Expand description
The AlertDescription TLS protocol enum. Values in this enum are taken
from the various RFCs covering TLS, and are listed by IANA.
The list of alerts is available at https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-6.
Protocol enumerations in rustls are represented with a struct, which contains the numeric value used on the wire (in this case, u8). Each known value has a named const item on this type – this can be used in a match arm or to access the numeric value.
If a known value does not exist for a value you need, you can simply create it locally:
pub const MyValue: AlertDescription = AlertDescription(123);The Debug impl for this type also looks up and pretty-prints
known named items. Unknown values are formatted in hexadecimal.
Tuple Fields§
§0: u8Implementations§
Source§impl AlertDescription
impl AlertDescription
Sourcepub const CloseNotify: Self
pub const CloseNotify: Self
Notifies the recipient that the sender will not send any more messages on this connection.
Sourcepub const UnexpectedMessage: Self
pub const UnexpectedMessage: Self
An inappropriate message was received.
E.g., the wrong handshake message, premature Application Data, etc. This alert should never be observed in communication between proper implementations.
Sourcepub const BadRecordMac: Self
pub const BadRecordMac: Self
This alert is returned if a record is received which cannot be deprotected.
Because AEAD algorithms combine decryption and verification, and also to avoid side-channel attacks, this alert is used for all deprotection failures. This alert should never be observed in communication between proper implementations, except when messages were corrupted in the network.
Sourcepub const DecryptionFailed: Self
pub const DecryptionFailed: Self
Reserved. Used in TLS versions prior to 1.3.
According to TLS 1.2 specification at https://www.rfc-editor.org/info/rfc5246/ “This alert was used in some earlier versions of TLS, and may have permitted certain attacks against the CBC mode. It MUST NOT be sent by compliant implementations.”
Sourcepub const RecordOverflow: Self
pub const RecordOverflow: Self
TLS record larger than the limit was received.
A TLSCiphertext record was received that had a length more than 214 + 256 bytes, or a record decrypted to a TLSPlaintext record with more than 214 bytes (or some other negotiated limit). This alert should never be observed in communication between proper implementations, except when messages were corrupted in the network.
Sourcepub const DecompressionFailure: Self
pub const DecompressionFailure: Self
Reserved. Used in TLS versions prior to 1.3.
The decompression function received improper input (e.g., data that would expand to excessive length). This message is always fatal and should never be observed in communication between proper implementations.
Sourcepub const HandshakeFailure: Self
pub const HandshakeFailure: Self
The sender was unable to negotiate an acceptable set of security parameters.
Sourcepub const NoCertificate: Self
pub const NoCertificate: Self
Reserved. Used in SSLv3 but not in TLS.
Sourcepub const BadCertificate: Self
pub const BadCertificate: Self
A certificate was corrupt, contained signatures that did not verify correctly, etc.
Sourcepub const UnsupportedCertificate: Self
pub const UnsupportedCertificate: Self
A certificate was of an unsupported type.
Sourcepub const CertificateRevoked: Self
pub const CertificateRevoked: Self
A certificate was revoked by its signer.
Sourcepub const CertificateExpired: Self
pub const CertificateExpired: Self
A certificate has expired or is not currently valid.
Sourcepub const CertificateUnknown: Self
pub const CertificateUnknown: Self
Unspecified issue arose in processing the certificate, rendering it unacceptable.
Sourcepub const IllegalParameter: Self
pub const IllegalParameter: Self
A field in the handshake was incorrect or inconsistent with other fields.
This alert is used for errors which conform to the formal protocol syntax but are otherwise incorrect.
Sourcepub const UnknownCa: Self
pub const UnknownCa: Self
The CA certificate could not be located or could not be matched with a known trust anchor.
Sourcepub const AccessDenied: Self
pub const AccessDenied: Self
A valid certificate or PSK was received, but did not pass access control.
Sourcepub const DecodeError: Self
pub const DecodeError: Self
A message could not be decoded.
Some field was out of the specified range or the length of the message was incorrect. This alert is used for errors where the message does not conform to the formal protocol syntax. This alert should never be observed in communication between proper implementations, except when messages were corrupted in the network.
Sourcepub const DecryptError: Self
pub const DecryptError: Self
A handshake (not record layer) cryptographic operation failed.
Sourcepub const ExportRestriction: Self
pub const ExportRestriction: Self
Reserved. Used in TLS 1.0 but not TLS 1.1 or later.
Sourcepub const ProtocolVersion: Self
pub const ProtocolVersion: Self
Peer has attempted to negotiate a recognized but not supported protocol version.
Sourcepub const InsufficientSecurity: Self
pub const InsufficientSecurity: Self
The server requires parameters more secure than those supported by the client.
Sourcepub const InternalError: Self
pub const InternalError: Self
An internal error unrelated to the peer or the correctness of the protocol.
Sourcepub const InappropriateFallback: Self
pub const InappropriateFallback: Self
Sent by a server in response to an invalid connection retry attempt from a client.
Sourcepub const UserCanceled: Self
pub const UserCanceled: Self
The sender is canceling the handshake for some reason unrelated to a protocol failure.
Sourcepub const NoRenegotiation: Self
pub const NoRenegotiation: Self
Reserved. Used in TLS versions prior to 1.3.
See TLS 1.2 specification at https://www.rfc-editor.org/info/rfc5246/ for the description.
Sourcepub const MissingExtension: Self
pub const MissingExtension: Self
A handshake message does not contain an extension that is mandatory to send.
Sourcepub const UnsupportedExtension: Self
pub const UnsupportedExtension: Self
Received an extension not offered in ClientHello or CertificateRequest.
Sourcepub const CertificateUnobtainable: Self
pub const CertificateUnobtainable: Self
The server is unable to obtain certificate sent as an URL by the client.
Sourcepub const UnrecognizedName: Self
pub const UnrecognizedName: Self
The server does not recognize SNI sent by the client.
Sourcepub const BadCertificateHashValue: Self
pub const BadCertificateHashValue: Self
Reserved. Used in TLS versions prior to 1.3.
Sourcepub const UnknownPskIdentity: Self
pub const UnknownPskIdentity: Self
The server does not recognize PSK identity.
Sourcepub const CertificateRequired: Self
pub const CertificateRequired: Self
A client certificate is desired but none was provided by the client.
https://datatracker.ietf.org/doc/html/rfc9846#section-6.2-4.48.1
Sourcepub const GeneralError: Self
pub const GeneralError: Self
An error condition in cases when either no more specific error is available or the sender wishes to conceal the specific error code.
https://datatracker.ietf.org/doc/html/rfc9846#section-6.2-4.49
Sourcepub const NoApplicationProtocol: Self
pub const NoApplicationProtocol: Self
A client ALPN extension advertises only protocols that the server does not support.
https://datatracker.ietf.org/doc/html/rfc9846#section-6.2-4.52.1
Sourcepub const EncryptedClientHelloRequired: Self
pub const EncryptedClientHelloRequired: Self
Use of Encrypted Client Hello is required.
Trait Implementations§
Source§impl Clone for AlertDescription
impl Clone for AlertDescription
Source§fn clone(&self) -> AlertDescription
fn clone(&self) -> AlertDescription
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for AlertDescription
Source§impl Debug for AlertDescription
impl Debug for AlertDescription
Source§impl Display for AlertDescription
impl Display for AlertDescription
impl Eq for AlertDescription
Source§impl From<&CertificateError> for AlertDescription
impl From<&CertificateError> for AlertDescription
Source§fn from(e: &CertificateError) -> Self
fn from(e: &CertificateError) -> Self
Source§impl From<AlertDescription> for u8
impl From<AlertDescription> for u8
Source§fn from(x: AlertDescription) -> Self
fn from(x: AlertDescription) -> Self
Source§impl From<InvalidMessage> for AlertDescription
impl From<InvalidMessage> for AlertDescription
Source§fn from(e: InvalidMessage) -> Self
fn from(e: InvalidMessage) -> Self
Source§impl From<PeerIncompatible> for AlertDescription
impl From<PeerIncompatible> for AlertDescription
Source§fn from(e: PeerIncompatible) -> Self
fn from(e: PeerIncompatible) -> Self
Source§impl From<PeerMisbehaved> for AlertDescription
impl From<PeerMisbehaved> for AlertDescription
Source§fn from(e: PeerMisbehaved) -> Self
fn from(e: PeerMisbehaved) -> Self
Source§impl From<u8> for AlertDescription
impl From<u8> for AlertDescription
Source§impl Hash for AlertDescription
impl Hash for AlertDescription
Source§impl PartialEq for AlertDescription
impl PartialEq for AlertDescription
impl StructuralPartialEq for AlertDescription
Source§impl TryFrom<&Error> for AlertDescription
Determine which alert should be sent for a given error.
impl TryFrom<&Error> for AlertDescription
Determine which alert should be sent for a given error.
If this mapping fails, no alert is sent.