Skip to main content

AlertDescription

Enum AlertDescription 

Source
#[non_exhaustive]
pub enum AlertDescription {
Show 28 variants CloseNotify, UnexpectedMessage, BadRecordMac, RecordOverflow, HandshakeFailure, BadCertificate, UnsupportedCertificate, CertificateRevoked, CertificateExpired, CertificateUnknown, IllegalParameter, UnknownCa, AccessDenied, DecodeError, DecryptError, ProtocolVersion, InsufficientSecurity, InternalError, InappropriateFallback, UserCanceled, MissingExtension, UnsupportedExtension, UnrecognizedName, BadCertificateStatusResponse, UnknownPskIdentity, CertificateRequired, NoApplicationProtocol, Unknown(u8),
}
Expand description

A TLS alert description code (RFC 8446 §6).

The Unknown(u8) catch-all carries any code not listed in RFC 8446, allowing the type to remain forwards-compatible without breaking consumers.

§Examples

use oxitls_core::AlertDescription;

let d = AlertDescription::from(40u8);
assert_eq!(d, AlertDescription::HandshakeFailure);
assert_eq!(d.to_u8(), 40);

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

CloseNotify

close_notify (0) — orderly TLS shutdown.

§

UnexpectedMessage

unexpected_message (10) — inappropriate message received.

§

BadRecordMac

bad_record_mac (20) — record authentication failure.

§

RecordOverflow

record_overflow (22) — TLSCiphertext record too long.

§

HandshakeFailure

handshake_failure (40) — unable to negotiate acceptable security parameters.

§

BadCertificate

bad_certificate (42) — unacceptable certificate.

§

UnsupportedCertificate

unsupported_certificate (43) — certificate type not supported.

§

CertificateRevoked

certificate_revoked (44) — certificate has been revoked.

§

CertificateExpired

certificate_expired (45) — certificate has expired.

§

CertificateUnknown

certificate_unknown (46) — unspecified certificate problem.

§

IllegalParameter

illegal_parameter (47) — field in the handshake was out of range or inconsistent.

§

UnknownCa

unknown_ca (48) — certificate’s CA is not trusted.

§

AccessDenied

access_denied (49) — valid certificate, but access control denied.

§

DecodeError

decode_error (50) — unable to decode a message.

§

DecryptError

decrypt_error (51) — handshake cryptographic operation failed.

§

ProtocolVersion

protocol_version (70) — protocol version not supported.

§

InsufficientSecurity

insufficient_security (71) — server requires ciphers more secure than those supported by client.

§

InternalError

internal_error (80) — internal error unrelated to the peer or correctness of the protocol.

§

InappropriateFallback

inappropriate_fallback (86) — TLS_FALLBACK_SCSV in response to version downgrade.

§

UserCanceled

user_canceled (90) — handshake is being canceled for a reason unrelated to a protocol failure.

§

MissingExtension

missing_extension (109) — negotiated extension was missing from the ClientHello.

§

UnsupportedExtension

unsupported_extension (110) — extension not permitted for this message.

§

UnrecognizedName

unrecognized_name (112) — SNI name not recognized.

§

BadCertificateStatusResponse

bad_certificate_status_response (113) — OCSP response invalid.

§

UnknownPskIdentity

unknown_psk_identity (115) — no acceptable PSK identity was supplied.

§

CertificateRequired

certificate_required (116) — client certificate required.

§

NoApplicationProtocol

no_application_protocol (120) — no ALPN protocol overlap.

§

Unknown(u8)

An alert code not listed in RFC 8446.

The wrapped value is the raw numeric alert code.

Implementations§

Source§

impl AlertDescription

Source

pub fn to_u8(&self) -> u8

Return the raw RFC 8446 numeric alert code for this description.

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 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<u8> for AlertDescription

Source§

fn from(code: u8) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for AlertDescription

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for AlertDescription

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.

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.