TLS alert message encoding and decoding functions. More...
Go to the source code of this file.
TLS alert message encoding and decoding functions.
This header declares helpers that convert between the compact two-byte TLS alert wire format and the internal alert description enumeration used by the TLS implementation.
| QSC_EXPORT_API qsc_tls_status qsc_tls_alert_decode | ( | const uint8_t * | input, |
| size_t | inlen, | ||
| qsc_tls_alert_description * | description ) |
Decode a TLS alert record payload.
Parses the standard two-byte TLS alert payload and extracts the alert description field.
| input | [const uint8_t*] The encoded alert payload. |
| inlen | [size_t] The length of the encoded input in bytes. |
| description | [enum*] Receives the decoded TLS alert description. |
| QSC_EXPORT_API qsc_tls_status qsc_tls_alert_encode | ( | uint8_t * | output, |
| size_t | outlen, | ||
| qsc_tls_alert_description | description ) |
Encode a TLS alert record payload.
Writes the standard two-byte TLS alert payload to the destination buffer. The severity level is implementation-defined by the encoder and the supplied description is written as the alert description field.
| output | [uint8_t*] The destination buffer receiving the encoded alert payload. |
| outlen | [size_t] The length of the destination buffer in bytes. |
| description | [enum] The TLS alert description to encode. |
| QSC_EXPORT_API qsc_tls_status qsc_tls_alert_encode_record | ( | uint8_t * | output, |
| size_t | outlen, | ||
| size_t * | written, | ||
| qsc_tls_alert_description | description ) |
Brief Encode a plaintext TLS alert record.
Builds the two-byte alert payload and wraps it in a TLSPlaintext record of content type alert. This is used for alert transmission before encrypted traffic keys are available.
| output | [uint8_t*] The destination buffer receiving the encoded record. |
| outlen | [size_t] The length of the destination buffer in bytes. |
| written | [size_t*] Receives the number of bytes written. |
| description | [enum] The TLS alert description to encode. |
| QSC_EXPORT_API qsc_tls_alert_description qsc_tls_alert_from_status | ( | qsc_tls_status | status | ) |
Brief Map an internal TLS status value to an RFC alert description.
Converts internal parser, state-machine, and authentication failures to the closest TLS alert description used on the wire. This helper is used when the wrapper layer needs to emit a protocol alert in response to a local failure.
| status | [enum] The internal TLS status value. |
| QSC_EXPORT_API bool qsc_tls_alert_is_close_notify | ( | qsc_tls_alert_description | description | ) |
Check if alert is close_notify.
| description | [enum] Alert description |
| QSC_EXPORT_API bool qsc_tls_alert_is_fatal_level | ( | uint8_t | level | ) |
Check if alert level is fatal.
| level | [uint8_t] Alert level |
| QSC_EXPORT_API bool qsc_tls_alert_is_valid | ( | qsc_tls_alert_description | description | ) |
Validate alert description.
| description | [enum] Alert description |
| QSC_EXPORT_API const char * qsc_tls_alert_to_string | ( | qsc_tls_alert_description | description | ) |
Convert alert description to string (debug only)
| description | [qsc_tls_alert_description] Alert description enumerator |