Skip to main content

AlertDescription

Struct AlertDescription 

Source
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: u8

Implementations§

Source§

impl AlertDescription

Source

pub const CloseNotify: Self

Notifies the recipient that the sender will not send any more messages on this connection.

https://www.rfc-editor.org/info/rfc9846/#section-6.1-2.2.1

Source

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.

https://www.rfc-editor.org/info/rfc9846/#section-6.2-4.2.1

Source

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.

https://www.rfc-editor.org/info/rfc9846/#section-6.2-4.4.1

Source

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.”

Source

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.

https://www.rfc-editor.org/info/rfc9846/#section-6.2-4.6.1

Source

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.

https://www.rfc-editor.org/info/rfc5246/

Source

pub const HandshakeFailure: Self

The sender was unable to negotiate an acceptable set of security parameters.

https://www.rfc-editor.org/info/rfc9846/#section-6.2-4.8.1

Source

pub const NoCertificate: Self

Reserved. Used in SSLv3 but not in TLS.

Source

pub const BadCertificate: Self

A certificate was corrupt, contained signatures that did not verify correctly, etc.

https://www.rfc-editor.org/info/rfc9846/#section-6.2-4.10.1

Source

pub const UnsupportedCertificate: Self

A certificate was of an unsupported type.

https://www.rfc-editor.org/info/rfc9846/#section-6.2-4.12.1

Source

pub const CertificateRevoked: Self

A certificate was revoked by its signer.

https://www.rfc-editor.org/info/rfc9846/#section-6.2-4.14.1

Source

pub const CertificateExpired: Self

A certificate has expired or is not currently valid.

https://www.rfc-editor.org/info/rfc9846/#section-6.2-4.16.1

Source

pub const CertificateUnknown: Self

Unspecified issue arose in processing the certificate, rendering it unacceptable.

https://www.rfc-editor.org/info/rfc9846/#section-6.2-4.18.1

Source

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.

https://www.rfc-editor.org/info/rfc9846/#section-6.2-4.20.1

Source

pub const UnknownCa: Self

The CA certificate could not be located or could not be matched with a known trust anchor.

https://www.rfc-editor.org/info/rfc9846/#section-6.2-4.22.1

Source

pub const AccessDenied: Self

A valid certificate or PSK was received, but did not pass access control.

https://www.rfc-editor.org/info/rfc9846/#section-6.2-4.24.1

Source

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.

https://www.rfc-editor.org/info/rfc9846/#section-6.2-4.26.1

Source

pub const DecryptError: Self

A handshake (not record layer) cryptographic operation failed.

https://www.rfc-editor.org/info/rfc9846/#section-6.2-4.28.1

Source

pub const ExportRestriction: Self

Reserved. Used in TLS 1.0 but not TLS 1.1 or later.

Source

pub const ProtocolVersion: Self

Peer has attempted to negotiate a recognized but not supported protocol version.

https://www.rfc-editor.org/info/rfc9846/#section-6.2-4.30.1

Source

pub const InsufficientSecurity: Self

The server requires parameters more secure than those supported by the client.

https://www.rfc-editor.org/info/rfc9846/#section-6.2-4.32.1

Source

pub const InternalError: Self

An internal error unrelated to the peer or the correctness of the protocol.

https://www.rfc-editor.org/info/rfc9846/#section-6.2-4.34.1

Source

pub const InappropriateFallback: Self

Sent by a server in response to an invalid connection retry attempt from a client.

https://www.rfc-editor.org/info/rfc9846/#section-6.2-4.36.1

Source

pub const UserCanceled: Self

The sender is canceling the handshake for some reason unrelated to a protocol failure.

https://www.rfc-editor.org/info/rfc9846/#section-6.1-2.4.1

Source

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.

Source

pub const MissingExtension: Self

A handshake message does not contain an extension that is mandatory to send.

https://www.rfc-editor.org/info/rfc9846/#section-6.2-4.38.1

Source

pub const UnsupportedExtension: Self

Received an extension not offered in ClientHello or CertificateRequest.

https://www.rfc-editor.org/info/rfc9846/#section-6.2-4.38.1

Source

pub const CertificateUnobtainable: Self

The server is unable to obtain certificate sent as an URL by the client.

https://datatracker.ietf.org/doc/html/rfc6066

Source

pub const UnrecognizedName: Self

The server does not recognize SNI sent by the client.

https://datatracker.ietf.org/doc/html/rfc6066

Source

pub const BadCertificateStatusResponse: Self

Source

pub const BadCertificateHashValue: Self

Reserved. Used in TLS versions prior to 1.3.

https://datatracker.ietf.org/doc/html/rfc6066

Source

pub const UnknownPskIdentity: Self

The server does not recognize PSK identity.

https://datatracker.ietf.org/doc/html/rfc4279

Source

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

Source

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

Source

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

Source

pub const EncryptedClientHelloRequired: Self

Use of Encrypted Client Hello is required.

https://datatracker.ietf.org/doc/html/rfc9849#section-11.2

Source

pub fn to_array(self) -> [u8; 1]

Encode the value as a big-endian byte array.

Trait Implementations§

Source§

impl Clone for AlertDescription

Source§

fn clone(&self) -> AlertDescription

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for AlertDescription

Source§

impl Debug for AlertDescription

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for AlertDescription

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for AlertDescription

Source§

impl From<&CertificateError> for AlertDescription

Source§

fn from(e: &CertificateError) -> Self

Converts to this type from the input type.
Source§

impl From<AlertDescription> for u8

Source§

fn from(x: AlertDescription) -> Self

Converts to this type from the input type.
Source§

impl From<InvalidMessage> for AlertDescription

Source§

fn from(e: InvalidMessage) -> Self

Converts to this type from the input type.
Source§

impl From<PeerIncompatible> for AlertDescription

Source§

fn from(e: PeerIncompatible) -> Self

Converts to this type from the input type.
Source§

impl From<PeerMisbehaved> for AlertDescription

Source§

fn from(e: PeerMisbehaved) -> Self

Converts to this type from the input type.
Source§

impl From<u8> for AlertDescription

Source§

fn from(x: u8) -> Self

Converts to this type from the input type.
Source§

impl Hash for AlertDescription

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for AlertDescription

Source§

fn eq(&self, other: &AlertDescription) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for AlertDescription

Source§

impl TryFrom<&Error> for AlertDescription

Determine which alert should be sent for a given error.

If this mapping fails, no alert is sent.

Source§

type Error = ()

The type returned in the event of a conversion error.
Source§

fn try_from(error: &Error) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more