SSL - Secure Sockets Layer¶
pcapkit.protocols.application.ssl.protocol contains
SSL,
which is the umbrella base class for the Secure Sockets Layer protocol
family [*] – the SSL versions, Transport Layer Security and Datagram TLS:
SSLv2– SSL 2.0, whose record layer shares no wire format with the others;TLS– SSLv3 and TLS 1.0 through TLS 1.3, withSSLv3as its thin subclass for explicit construction;DTLS– DTLS 1.0, 1.2 and 1.3.
SSL.id lists the direct
concrete subclasses, so a lookup keyed on SSL matches any of them.
The TLS record header (RFC 9846 Section 5.1) is a
ContentType, a legacy record version
and a length. The DTLS DTLSPlaintext header (RFC 9147 Section 4) has
the same fields plus an epoch and a 48-bit sequence number between the
version and the length, and DTLS adds a fragment header to each handshake
message. Each record header is declared in its subclass’s own schema, and
DTLS reads the epoch and sequence
number. This base class carries the logic TLS and DTLS share – content-type
dispatch, handshake-message decoding (including the DTLS fragment header), the
extension registry and the header schema of each extension’s extension_data
(pcapkit.protocols.application.ssl.schema), and the record-level validation that keeps dispatch from
accepting bytes that cannot be a genuine record.
Added in version 1.6.0.
Removed in version 1.7.0: pcapkit.protocols.application.ssl.protocol.TLS13_VERSION and
pcapkit.protocols.application.ssl.protocol.DTLS13_VERSION, now
pcapkit.protocols.application.ssl.const.TLS13_VERSION and
pcapkit.protocols.application.ssl.const.DTLS13_VERSION (#2896).
- class pcapkit.protocols.application.ssl.protocol.SSL[_PT: Data, _ST: Schema](file, length=None, /, *, layer=None, protocol=None, context=None)[source]¶
Bases:
Application[_PT,_ST],Generic[_PT,_ST]Umbrella base class for the SSL protocol family: the SSL versions, TLS and DTLS.
SSL 2.0 (
SSLv2) [draft-hickman-netscape-ssl-00]Transport Layer Security, SSLv3 through TLS 1.3 (
TLS) [RFC 6101, RFC 5246, RFC 9846]Datagram TLS, DTLS 1.0 through DTLS 1.3 (
DTLS) [RFC 4347, RFC 6347, RFC 9147]
These extensions decode, each only in the handshake messages its RFC defines it in, and
connection_idonly in a DTLS record (RFC 9146 Section 10.2):Extension Type
Extension Parser
Extension Constructor
GREASE values (RFC 8701) are
Reservedextension types with no decoder, so their bodies stay raw octets.Each type’s layout is the schema
Extensionregisters for it: a parser is handed theextension_dataunpacked by that schema, and a constructor returns one.Changed in version 1.7.0: Each extension decodes and builds through a schema of its own, in
pcapkit.protocols.application.ssl.schema(#2833).Defaults
- __extension__: DefaultDict[ExtensionType | int, str | tuple[Callable[[ExtensionType, Extension, HandshakeType], ExtensionData | bytes], Callable[[ExtensionType, ExtensionData | None, HandshakeType, Any], Extension]]]¶
Extension type to method mapping, see
_read_tls_extensions()and_make_tls_extensions(). Astrvalue names the methods_read_ext_${name}and_make_ext_${name}, falling back to_read_ext_unknown()and_make_ext_unknown()when the class has no such method, as an unregistered type does; any other value is a(parser, constructor)pair of callables. Each type’sextension_datalayout is in theExtensionregistry, so a parser is handed theextension_dataunpacked by that schema and a constructor returns one.Changed in version 1.7.0: A parser takes, and a constructor returns, the
extension_dataschema rather than its octets (#2833).
- _dtls: bool = False¶
Whether the records are DTLS’s, which alone carry a DTLS-only extension (RFC 9146 Section 10.2);
DTLSsets it.
Methods
- classmethod register_extension(code, meth)[source]¶
Register an extension parser.
- Parameters:
code (
ExtensionType) – TLS/DTLS extension type.meth (
str|tuple[Callable[[ExtensionType,Extension,HandshakeType],ExtensionData|bytes],Callable[[ExtensionType,ExtensionData|None,HandshakeType,Any],Extension]]) – Name of the_read_ext_${name}and_make_ext_${name}methods, or a(parser, constructor)pair of callables; see__extension__. The parser is handed theextension_dataunpacked by the schema theExtensionregistry holds forcode, and the constructor returns such a schema.
- Warns:
RegistryWarning– If a different entry is already registered forcode; it is overwritten. Handing back the entry already stored, or one equal to it, is a silent no-op. The entrycodeshipped with is accepted like any other, so an override can be undone (#1362, #1363).
Changed in version 1.7.0: The parser takes, and the constructor returns, the
extension_dataschema rather than its octets (#2833).
Utilities
- _read_ext_unknown(ext_type, schema, *, msg_type)[source]¶
Read an extension with no decoder registered: its raw octets.
- Parameters:
ext_type (
ExtensionType) – Extension type.schema (
Extension) – Parsedextension_dataschema.msg_type (
HandshakeType) – Handshake message carrying the extension.
- Return type:
- Returns:
The
extension_dataoctets unchanged.
- _read_ext_server_name(ext_type, schema, *, msg_type)[source]¶
Read a
server_nameextension.Structure of
ServerNameList[RFC 6066 Section 3]:struct { NameType name_type; select (name_type) { case host_name: HostName; } name; } ServerName; enum { host_name(0), (255) } NameType; opaque HostName<1..2^16-1>; struct { ServerName server_name_list<1..2^16-1> } ServerNameList;A
ServerHelloorEncryptedExtensionscarries the extension empty.- Parameters:
ext_type (
ExtensionType) – Extension type.schema (
ServerNameExtension) – Parsedextension_dataschema.msg_type (
HandshakeType) – Handshake message carrying the extension.
- Return type:
ServerNameList|Empty|bytes- Returns:
The decoded list for a
ClientHello, an empty structure for aServerHelloorEncryptedExtensions, or the octets for a message the structure does not cover.- Raises:
ProtocolError – If a name is of a type other than
host_name, whosenamehas no defined structure.
- _read_ext_status_request(ext_type, schema, *, msg_type)[source]¶
Read a
status_requestextension.Structure of
CertificateStatusRequest[RFC 6066 Section 8]:struct { CertificateStatusType status_type; select (status_type) { case ocsp: OCSPStatusRequest; } request; } CertificateStatusRequest; enum { ocsp(1), (255) } CertificateStatusType; struct { ResponderID responder_id_list<0..2^16-1>; Extensions request_extensions; } OCSPStatusRequest; opaque ResponderID<1..2^16-1>; opaque Extensions<0..2^16-1>;A
ServerHellocarries the extension empty.- Parameters:
ext_type (
ExtensionType) – Extension type.schema (
StatusRequestExtension) – Parsedextension_dataschema.msg_type (
HandshakeType) – Handshake message carrying the extension.
- Return type:
- Returns:
The decoded request for a
ClientHello, an empty structure for aServerHello, or the octets for a message the structure does not cover.- Raises:
ProtocolError – If the status type is other than
ocsp, whoserequesthas no defined structure.
- _read_ext_supported_groups(ext_type, schema, *, msg_type)[source]¶
Read a
supported_groupsextension.Structure of
NamedGroupList[RFC 9846 Section 4.3.7]:struct { NamedGroup named_group_list<2..2^16-1>; } NamedGroupList;- Parameters:
ext_type (
ExtensionType) – Extension type.schema (
SupportedGroupsExtension) – Parsedextension_dataschema.msg_type (
HandshakeType) – Handshake message carrying the extension.
- Return type:
- Returns:
The decoded list in a
ClientHelloorEncryptedExtensions, where the extension is defined; or the octets in any other message.
- _read_ext_ec_point_formats(ext_type, schema, *, msg_type)[source]¶
Read an
ec_point_formatsextension.Structure of
ECPointFormatList[RFC 8422 Section 5.1.2]:enum { uncompressed (0), deprecated (1..2), reserved (248..255) } ECPointFormat; struct { ECPointFormat ec_point_format_list<1..2^8-1> } ECPointFormatList;- Parameters:
ext_type (
ExtensionType) – Extension type.schema (
ECPointFormatsExtension) – Parsedextension_dataschema.msg_type (
HandshakeType) – Handshake message carrying the extension.
- Return type:
- Returns:
The decoded list in a
ClientHelloorServerHello, where the extension is defined; or the octets in any other message.
- _read_ext_signature_algorithms(ext_type, schema, *, msg_type)[source]¶
Read a
signature_algorithmsextension.Structure of
SignatureSchemeList[RFC 9846 Section 4.3.3]:struct { SignatureScheme supported_signature_algorithms<2..2^16-2>; } SignatureSchemeList;- Parameters:
ext_type (
ExtensionType) – Extension type.schema (
SignatureAlgorithmsExtension) – Parsedextension_dataschema.msg_type (
HandshakeType) – Handshake message carrying the extension.
- Return type:
- Returns:
The decoded list in a
ClientHelloorCertificateRequest, where the extension is defined; or the octets in any other message.
- _read_ext_alpn(ext_type, schema, *, msg_type)[source]¶
Read an
application_layer_protocol_negotiationextension.Structure of
ProtocolNameList[RFC 7301 Section 3.1]:opaque ProtocolName<1..2^8-1>; struct { ProtocolName protocol_name_list<2..2^16-1> } ProtocolNameList;A server sends it in a
ServerHello, or in TLS 1.3 anEncryptedExtensions(RFC 9846 Section 4.3), naming one protocol.- Parameters:
ext_type (
ExtensionType) – Extension type.schema (
ALPNExtension) – Parsedextension_dataschema.msg_type (
HandshakeType) – Handshake message carrying the extension.
- Return type:
- Returns:
The decoded list in a
ClientHello,ServerHelloorEncryptedExtensions, where the extension is defined; or the octets in any other message.
- _read_ext_signed_certificate_timestamp(ext_type, schema, *, msg_type)[source]¶
Read a
signed_certificate_timestampextension.Structure of
SignedCertificateTimestampList[RFC 6962 Section 3.3]:opaque SerializedSCT<1..2^16-1>; struct { SerializedSCT sct_list <1..2^16-1>; } SignedCertificateTimestampList;A
ClientHellocarries the extension empty, and aServerHellothe list (RFC 6962 Section 3.3.1).- Parameters:
ext_type (
ExtensionType) – Extension type.schema (
SignedCertificateTimestampExtension) – Parsedextension_dataschema.msg_type (
HandshakeType) – Handshake message carrying the extension.
- Return type:
- Returns:
An empty structure for a
ClientHello, the decoded list for aServerHello, or the octets for a message the structure does not cover.
- _read_ext_padding(ext_type, schema, *, msg_type)[source]¶
Read a
paddingextension.Its
extension_datais any number of zero octets [RFC 7685 Section 3], kept as captured.- Parameters:
ext_type (
ExtensionType) – Extension type.schema (
PaddingExtension) – Parsedextension_dataschema.msg_type (
HandshakeType) – Handshake message carrying the extension.
- Return type:
- Returns:
The padding in a
ClientHello, where the extension is defined; or the octets in any other message.
- _read_ext_extended_main_secret(ext_type, schema, *, msg_type)[source]¶
Read an
extended_main_secretextension, whoseextension_datais empty [RFC 7627 Section 5.1].- Parameters:
ext_type (
ExtensionType) – Extension type.schema (
ExtendedMainSecretExtension) – Parsedextension_dataschema.msg_type (
HandshakeType) – Handshake message carrying the extension.
- Return type:
- Returns:
An empty structure in a
ClientHelloorServerHello, where the extension is defined; or the octets in any other message.
- _read_ext_compress_certificate(ext_type, schema, *, msg_type)[source]¶
Read a
compress_certificateextension.Structure of
CertificateCompressionAlgorithms[RFC 8879 Section 3]:enum { zlib(1), brotli(2), zstd(3), (65535) } CertificateCompressionAlgorithm; struct { CertificateCompressionAlgorithm algorithms<2..2^8-2>; } CertificateCompressionAlgorithms;- Parameters:
ext_type (
ExtensionType) – Extension type.schema (
CompressCertificateExtension) – Parsedextension_dataschema.msg_type (
HandshakeType) – Handshake message carrying the extension.
- Return type:
- Returns:
The decoded list in a
ClientHello, where the extension is defined; or the octets in any other message.
- _read_ext_record_size_limit(ext_type, schema, *, msg_type)[source]¶
Read a
record_size_limitextension.Structure of
RecordSizeLimit[RFC 8449 Section 4]:uint16 RecordSizeLimit;
The extension is valid in every TLS version (RFC 8449 Section 1), so a server answers in its
ServerHellobefore TLS 1.3 and inEncryptedExtensionsfrom it.- Parameters:
ext_type (
ExtensionType) – Extension type.schema (
RecordSizeLimitExtension) – Parsedextension_dataschema.msg_type (
HandshakeType) – Handshake message carrying the extension.
- Return type:
- Returns:
The decoded limit in a
ClientHello,ServerHelloorEncryptedExtensions, where the extension is defined; or the octets in any other message.
- _read_ext_session_ticket(ext_type, schema, *, msg_type)[source]¶
Read a
session_ticketextension, whoseextension_datais the ticket itself, with no length of its own [RFC 5077 Section 3.2].- Parameters:
ext_type (
ExtensionType) – Extension type.schema (
SessionTicketExtension) – Parsedextension_dataschema.msg_type (
HandshakeType) – Handshake message carrying the extension.
- Return type:
- Returns:
The ticket in a
ClientHelloorServerHello, where the extension is defined; or the octets in any other message.
Read a
pre_shared_keyextension.Structure of
PreSharedKeyExtension[RFC 9846 Section 4.3.11]:struct { opaque identity<1..2^16-1>; uint32 obfuscated_ticket_age; } PskIdentity; opaque PskBinderEntry<32..255>; struct { PskIdentity identities<7..2^16-1>; PskBinderEntry binders<33..2^16-1>; } OfferedPsks; struct { select (Handshake.msg_type) { case client_hello: OfferedPsks; case server_hello: uint16 selected_identity; }; } PreSharedKeyExtension;- Parameters:
ext_type (
ExtensionType) – Extension type.schema (
PreSharedKeyExtension) – Parsedextension_dataschema.msg_type (
HandshakeType) – Handshake message carrying the extension.
- Return type:
- Returns:
The decoded structure for
msg_type; or the octets for a message the structure does not cover.
- _read_ext_early_data(ext_type, schema, *, msg_type)[source]¶
Read an
early_dataextension.Structure of
EarlyDataIndication[RFC 9846 Section 4.3.10]:struct {} Empty; struct { select (Handshake.msg_type) { case new_session_ticket: uint32 max_early_data_size; case client_hello: Empty; case encrypted_extensions: Empty; }; } EarlyDataIndication;- Parameters:
ext_type (
ExtensionType) – Extension type.schema (
EarlyDataExtension) – Parsedextension_dataschema.msg_type (
HandshakeType) – Handshake message carrying the extension.
- Return type:
- Returns:
An empty structure for a
ClientHelloorEncryptedExtensions, or the octets for a message the structure does not cover.
- _read_ext_supported_versions(ext_type, schema, *, msg_type)[source]¶
Read a
supported_versionsextension.Structure of
SupportedVersions[RFC 9846 Section 4.3.1]:struct { select (Handshake.msg_type) { case client_hello: ProtocolVersion versions<2..254>; case server_hello: /* and HelloRetryRequest */ ProtocolVersion selected_version; }; } SupportedVersions;- Parameters:
ext_type (
ExtensionType) – Extension type.schema (
SupportedVersionsExtension) – Parsedextension_dataschema.msg_type (
HandshakeType) – Handshake message carrying the extension.
- Return type:
SupportedVersionsClientHello|SupportedVersionsServerHello|bytes- Returns:
The decoded versions for
msg_type; or the octets for a message the structure does not cover.
- _read_ext_cookie(ext_type, schema, *, msg_type)[source]¶
Read a
cookieextension.Structure of
Cookie[RFC 9846 Section 4.3.2]:struct { opaque cookie<1..2^16-1>; } Cookie;- Parameters:
ext_type (
ExtensionType) – Extension type.schema (
CookieExtension) – Parsedextension_dataschema.msg_type (
HandshakeType) – Handshake message carrying the extension.
- Return type:
- Returns:
The decoded cookie in a
ClientHelloorHelloRetryRequest, where the extension is defined; or the octets in any other message.
- _read_ext_psk_key_exchange_modes(ext_type, schema, *, msg_type)[source]¶
Read a
psk_key_exchange_modesextension.Structure of
PskKeyExchangeModes[RFC 9846 Section 4.3.9]:enum { psk_ke(0), psk_dhe_ke(1), (255) } PskKeyExchangeMode; struct { PskKeyExchangeMode ke_modes<1..255>; } PskKeyExchangeModes;- Parameters:
ext_type (
ExtensionType) – Extension type.schema (
PskKeyExchangeModesExtension) – Parsedextension_dataschema.msg_type (
HandshakeType) – Handshake message carrying the extension.
- Return type:
- Returns:
The decoded modes in a
ClientHello, where the extension is defined; or the octets in any other message.
- _read_ext_post_handshake_auth(ext_type, schema, *, msg_type)[source]¶
Read a
post_handshake_authextension, whoseextension_datais empty [RFC 9846 Section 4.3.6].- Parameters:
ext_type (
ExtensionType) – Extension type.schema (
PostHandshakeAuthExtension) – Parsedextension_dataschema.msg_type (
HandshakeType) – Handshake message carrying the extension.
- Return type:
- Returns:
An empty structure in a
ClientHello, where the extension is defined; or the octets in any other message.
Read a
key_shareextension.Structure of
key_share[RFC 9846 Section 4.3.8]:struct { NamedGroup group; opaque key_exchange<1..2^16-1>; } KeyShareEntry; struct { KeyShareEntry client_shares<0..2^16-1>; } KeyShareClientHello; struct { NamedGroup selected_group; } KeyShareHelloRetryRequest; struct { KeyShareEntry server_share; } KeyShareServerHello;- Parameters:
ext_type (
ExtensionType) – Extension type.schema (
KeyShareExtension) – Parsedextension_dataschema.msg_type (
HandshakeType) – Handshake message carrying the extension.
- Return type:
KeyShareClientHello|KeyShareHelloRetryRequest|KeyShareServerHello|bytes- Returns:
The decoded structure for
msg_type; or the octets for a message the structure does not cover.
- _read_ext_connection_id(ext_type, schema, *, msg_type)[source]¶
Read a
connection_idextension.Structure of
ConnectionId[RFC 9146 Section 3]:struct { opaque cid<0..2^8-1>; } ConnectionId;The extension is DTLS-only, in a
ClientHelloorServerHello(RFC 9146 Section 3, RFC 9146 Section 10.2), and DTLS 1.3 keeps it in those two messages (RFC 9147 Section 9.1).- Parameters:
ext_type (
ExtensionType) – Extension type.schema (
ConnectionIdExtension) – Parsedextension_dataschema.msg_type (
HandshakeType) – Handshake message carrying the extension.
- Return type:
- Returns:
The decoded connection ID in a DTLS
ClientHelloorServerHello, where the extension is defined; or the octets in any other message, and in a TLS record.
- _read_ext_ech(ext_type, schema, *, msg_type)[source]¶
Read an
encrypted_client_helloextension.Structure of
encrypted_client_hello[RFC 9849 Section 5]:enum { outer(0), inner(1) } ECHClientHelloType; struct { ECHClientHelloType type; select (ECHClientHello.type) { case outer: HpkeSymmetricCipherSuite cipher_suite; uint8 config_id; opaque enc<0..2^16-1>; opaque payload<1..2^16-1>; case inner: Empty; }; } ECHClientHello; struct { ECHConfigList retry_configs; } ECHEncryptedExtensions; struct { opaque confirmation[8]; } ECHHelloRetryRequest;ECHConfigListisECHConfig ECHConfigList<4..2^16-1>, eachECHConfigread by_read_ech_config().- Parameters:
ext_type (
ExtensionType) – Extension type.schema (
ECHExtension) – Parsedextension_dataschema.msg_type (
HandshakeType) – Handshake message carrying the extension.
- Returns:
an
ECHClientHelloof either type, anECHHelloRetryRequestor anECHEncryptedExtensions; or the octets for a message the structure does not cover.- Return type:
ECHClientHelloOuter|ECHClientHelloInner|ECHHelloRetryRequest|ECHEncryptedExtensions|bytes- Raises:
ProtocolError – If a
ClientHello’s names a type other thanouterandinner.
- _read_ext_renegotiation_info(ext_type, schema, *, msg_type)[source]¶
Read a
renegotiation_infoextension.Structure of
RenegotiationInfo[RFC 5746 Section 3.2]:struct { opaque renegotiated_connection<0..255>; } RenegotiationInfo;- Parameters:
ext_type (
ExtensionType) – Extension type.schema (
RenegotiationInfoExtension) – Parsedextension_dataschema.msg_type (
HandshakeType) – Handshake message carrying the extension.
- Return type:
- Returns:
The decoded structure in a
ClientHelloorServerHello, where the extension is defined; or the octets in any other message.
- _make_ext_unknown(ext_type, data=None, *, msg_type, **kwargs)[source]¶
Make an extension with no constructor registered.
- Parameters:
ext_type (
ExtensionType) – Extension type.data (
ExtensionData|None) – Decodedextension_data, which this type has no structure to write.msg_type (
HandshakeType) – Handshake message carrying the extension.**kwargs (
Any) – Arbitrary keyword arguments.
- Return type:
- Returns:
Empty
extension_datawhendataisNone.- Raises:
ProtocolError – If
datais given.
- _make_ext_server_name(ext_type, data=None, *, msg_type, server_name_list=(), **kwargs)[source]¶
Make a
server_nameextension.datadecides the structure when given,msg_typeotherwise.- Parameters:
ext_type (
ExtensionType) – Extension type.data (
ServerNameList|Empty|None) – Decodedextension_data.msg_type (
HandshakeType) – Handshake message carrying the extension.server_name_list (
Iterable[ServerName]) – Server names for aClientHello, ifdatais not given.**kwargs (
Any) – Arbitrary keyword arguments.
- Return type:
- Returns:
Constructed
extension_dataschema.- Raises:
ProtocolError – If neither
datanormsg_typenames a structure.
- _make_ext_status_request(ext_type, data=None, *, msg_type, status_type=CertificateStatusType.ocsp, responder_id_list=(), request_extensions=b'', **kwargs)[source]¶
Make a
status_requestextension.datadecides the structure when given,msg_typeotherwise.- Parameters:
ext_type (
ExtensionType) – Extension type.data (
CertificateStatusRequest|Empty|None) – Decodedextension_data.msg_type (
HandshakeType) – Handshake message carrying the extension.status_type (
CertificateStatusType|int) – Status type for aClientHello, ifdatais not given.responder_id_list (
Iterable[bytes]) –ResponderIDvalues for aClientHello, ifdatais not given.request_extensions (
bytes) – OCSP requestExtensionsfor aClientHello, ifdatais not given.**kwargs (
Any) – Arbitrary keyword arguments.
- Return type:
- Returns:
Constructed
extension_dataschema.- Raises:
ProtocolError – If neither
datanormsg_typenames a structure, or the status type is notocsp.
- _make_ext_supported_groups(ext_type, data=None, *, msg_type, named_group_list=(), **kwargs)[source]¶
Make a
supported_groupsextension.- Parameters:
ext_type (
ExtensionType) – Extension type.data (
NamedGroupList|None) – Decodedextension_data.msg_type (
HandshakeType) – Handshake message carrying the extension.named_group_list (
Iterable[int]) –NamedGroupvalues, ifdatais not given.**kwargs (
Any) – Arbitrary keyword arguments.
- Return type:
- Returns:
Constructed
extension_dataschema.- Raises:
ProtocolError – If
datais not given for a message other than aClientHelloorEncryptedExtensions.
- _make_ext_ec_point_formats(ext_type, data=None, *, msg_type, ec_point_format_list=(), **kwargs)[source]¶
Make an
ec_point_formatsextension.- Parameters:
ext_type (
ExtensionType) – Extension type.data (
ECPointFormatList|None) – Decodedextension_data.msg_type (
HandshakeType) – Handshake message carrying the extension.ec_point_format_list (
Iterable[ECPointFormat|int]) – Point formats, members or codes, ifdatais not given.**kwargs (
Any) – Arbitrary keyword arguments.
- Return type:
- Returns:
Constructed
extension_dataschema.- Raises:
ProtocolError – If
datais not given for a message other than aClientHelloorServerHello, or if a point format is not anintthat fits in one octet.
- _make_ext_signature_algorithms(ext_type, data=None, *, msg_type, supported_signature_algorithms=(), **kwargs)[source]¶
Make a
signature_algorithmsextension.- Parameters:
ext_type (
ExtensionType) – Extension type.data (
SignatureSchemeList|None) – Decodedextension_data.msg_type (
HandshakeType) – Handshake message carrying the extension.supported_signature_algorithms (
Iterable[int]) –SignatureSchemevalues, ifdatais not given.**kwargs (
Any) – Arbitrary keyword arguments.
- Return type:
- Returns:
Constructed
extension_dataschema.- Raises:
ProtocolError – If
datais not given for a message other than aClientHelloorCertificateRequest.
- _make_ext_alpn(ext_type, data=None, *, msg_type, protocol_name_list=(), **kwargs)[source]¶
Make an
application_layer_protocol_negotiationextension.- Parameters:
ext_type (
ExtensionType) – Extension type.data (
ProtocolNameList|None) – Decodedextension_data.msg_type (
HandshakeType) – Handshake message carrying the extension.protocol_name_list (
Iterable[bytes]) –ProtocolNameoctet strings, ifdatais not given.**kwargs (
Any) – Arbitrary keyword arguments.
- Return type:
- Returns:
Constructed
extension_dataschema.- Raises:
ProtocolError – If
datais not given for a message other than aClientHello,ServerHelloorEncryptedExtensions.
- _make_ext_signed_certificate_timestamp(ext_type, data=None, *, msg_type, sct_list=(), **kwargs)[source]¶
Make a
signed_certificate_timestampextension.datadecides the structure when given,msg_typeotherwise.- Parameters:
ext_type (
ExtensionType) – Extension type.data (
SignedCertificateTimestampList|Empty|None) – Decodedextension_data.msg_type (
HandshakeType) – Handshake message carrying the extension.sct_list (
Iterable[bytes]) –SerializedSCToctet strings for aServerHello, ifdatais not given.**kwargs (
Any) – Arbitrary keyword arguments.
- Return type:
- Returns:
Constructed
extension_dataschema.- Raises:
ProtocolError – If neither
datanormsg_typenames a structure.
- _make_ext_padding(ext_type, data=None, *, msg_type, padding=b'', **kwargs)[source]¶
Make a
paddingextension.- Parameters:
ext_type (
ExtensionType) – Extension type.msg_type (
HandshakeType) – Handshake message carrying the extension.padding (
bytes) – Padding octets, ifdatais not given.**kwargs (
Any) – Arbitrary keyword arguments.
- Return type:
- Returns:
Constructed
extension_dataschema.- Raises:
ProtocolError – If
datais not given for a message other than aClientHello.
- _make_ext_extended_main_secret(ext_type, data=None, *, msg_type, **kwargs)[source]¶
Make an
extended_main_secretextension.- Parameters:
ext_type (
ExtensionType) – Extension type.msg_type (
HandshakeType) – Handshake message carrying the extension.**kwargs (
Any) – Arbitrary keyword arguments.
- Return type:
- Returns:
Constructed
extension_dataschema, which is empty.- Raises:
ProtocolError – If
datais not given for a message other than aClientHelloorServerHello, or ifdatais a structure other than an empty one.
- _make_ext_compress_certificate(ext_type, data=None, *, msg_type, algorithms=(), **kwargs)[source]¶
Make a
compress_certificateextension.- Parameters:
ext_type (
ExtensionType) – Extension type.data (
CertificateCompressionAlgorithms|None) – Decodedextension_data.msg_type (
HandshakeType) – Handshake message carrying the extension.algorithms (
Iterable[CertificateCompressionAlgorithm|int]) – Compression algorithms, members or codes, ifdatais not given.**kwargs (
Any) – Arbitrary keyword arguments.
- Return type:
- Returns:
Constructed
extension_dataschema.- Raises:
ProtocolError – If
datais not given for a message other than aClientHello, or if an algorithm is not anintthat fits in two octets.
- _make_ext_record_size_limit(ext_type, data=None, *, msg_type, record_size_limit=None, **kwargs)[source]¶
Make a
record_size_limitextension.- Parameters:
ext_type (
ExtensionType) – Extension type.data (
RecordSizeLimit|None) – Decodedextension_data.msg_type (
HandshakeType) – Handshake message carrying the extension.record_size_limit (
int|None) – Largest record, in octets, ifdatais not given.**kwargs (
Any) – Arbitrary keyword arguments.
- Return type:
- Returns:
Constructed
extension_dataschema.- Raises:
ProtocolError – If
datais not given for a message other than aClientHello,ServerHelloorEncryptedExtensions, or if neitherdatanorrecord_size_limitis given.
- _make_ext_session_ticket(ext_type, data=None, *, msg_type, ticket=b'', **kwargs)[source]¶
Make a
session_ticketextension.- Parameters:
ext_type (
ExtensionType) – Extension type.data (
SessionTicket|None) – Decodedextension_data.msg_type (
HandshakeType) – Handshake message carrying the extension.ticket (
bytes) – The ticket, ifdatais not given.**kwargs (
Any) – Arbitrary keyword arguments.
- Return type:
- Returns:
Constructed
extension_dataschema.- Raises:
ProtocolError – If
datais not given for a message other than aClientHelloorServerHello.
Make a
pre_shared_keyextension.datadecides the structure when given,msg_typeotherwise.- Parameters:
ext_type (
ExtensionType) – Extension type.data (
OfferedPsks|PreSharedKeyServerHello|None) – Decodedextension_data.msg_type (
HandshakeType) – Handshake message carrying the extension.identities (
Iterable[PskIdentity]) – Identities for aClientHello, ifdatais not given.binders (
Iterable[bytes]) –PskBinderEntryvalues for aClientHello, ifdatais not given.selected_identity (
int|None) – Index of the identity aServerHelloselects, ifdatais not given.**kwargs (
Any) – Arbitrary keyword arguments.
- Return type:
- Returns:
Constructed
extension_dataschema.- Raises:
ProtocolError – If neither
datanormsg_typenames a structure, orselected_identityis missing.
- _make_ext_early_data(ext_type, data=None, *, msg_type, **kwargs)[source]¶
Make an
early_dataextension.- Parameters:
ext_type (
ExtensionType) – Extension type.msg_type (
HandshakeType) – Handshake message carrying the extension.**kwargs (
Any) – Arbitrary keyword arguments.
- Return type:
- Returns:
Constructed
extension_dataschema, which is empty.- Raises:
ProtocolError – If
datais a structure other than an empty one, or is not given for a message whose structure is not empty.
- _make_ext_supported_versions(ext_type, data=None, *, msg_type, versions=(), selected_version=None, **kwargs)[source]¶
Make a
supported_versionsextension.datadecides the structure when given,msg_typeotherwise.- Parameters:
ext_type (
ExtensionType) – Extension type.data (
SupportedVersionsClientHello|SupportedVersionsServerHello|None) – Decodedextension_data.msg_type (
HandshakeType) – Handshake message carrying the extension.versions (
Iterable[int]) –ProtocolVersionvalues for aClientHello, ifdatais not given.selected_version (
int|None) –ProtocolVersionselected by aServerHelloorHelloRetryRequest, ifdatais not given.**kwargs (
Any) – Arbitrary keyword arguments.
- Return type:
- Returns:
Constructed
extension_dataschema.- Raises:
ProtocolError – If neither
datanormsg_typenames a structure, orselected_versionis missing.
- _make_ext_cookie(ext_type, data=None, *, msg_type, cookie=b'', **kwargs)[source]¶
Make a
cookieextension.- Parameters:
ext_type (
ExtensionType) – Extension type.msg_type (
HandshakeType) – Handshake message carrying the extension.cookie (
bytes) – The cookie, ifdatais not given.**kwargs (
Any) – Arbitrary keyword arguments.
- Return type:
- Returns:
Constructed
extension_dataschema.- Raises:
ProtocolError – If
datais not given for a message other than aClientHelloorHelloRetryRequest.
- _make_ext_psk_key_exchange_modes(ext_type, data=None, *, msg_type, ke_modes=(), **kwargs)[source]¶
Make a
psk_key_exchange_modesextension.- Parameters:
ext_type (
ExtensionType) – Extension type.data (
PskKeyExchangeModes|None) – Decodedextension_data.msg_type (
HandshakeType) – Handshake message carrying the extension.ke_modes (
Iterable[PskKeyExchangeMode|int]) – Key exchange modes, members or codes, ifdatais not given.**kwargs (
Any) – Arbitrary keyword arguments.
- Return type:
- Returns:
Constructed
extension_dataschema.- Raises:
ProtocolError – If
datais not given for a message other than aClientHello, or if a mode is not anintthat fits in one octet.
- _make_ext_post_handshake_auth(ext_type, data=None, *, msg_type, **kwargs)[source]¶
Make a
post_handshake_authextension.- Parameters:
ext_type (
ExtensionType) – Extension type.msg_type (
HandshakeType) – Handshake message carrying the extension.**kwargs (
Any) – Arbitrary keyword arguments.
- Return type:
- Returns:
Constructed
extension_dataschema, which is empty.- Raises:
ProtocolError – If
datais not given for a message other than aClientHello, or ifdatais a structure other than an empty one.
Make a
key_shareextension.datadecides the structure when given,msg_typeotherwise.- Parameters:
ext_type (
ExtensionType) – Extension type.data (
KeyShareClientHello|KeyShareHelloRetryRequest|KeyShareServerHello|None) – Decodedextension_data.msg_type (
HandshakeType) – Handshake message carrying the extension.client_shares (
Iterable[KeyShareEntry]) – Key shares for aClientHello, ifdatais not given.selected_group (
int|None) –NamedGroupfor aHelloRetryRequest, ifdatais not given.server_share (
KeyShareEntry|None) – Key share for aServerHello, ifdatais not given.**kwargs (
Any) – Arbitrary keyword arguments.
- Return type:
- Returns:
Constructed
extension_dataschema.- Raises:
ProtocolError – If neither
datanormsg_typenames a structure, or the argument it needs is missing.
- _make_ext_connection_id(ext_type, data=None, *, msg_type, cid=b'', **kwargs)[source]¶
Make a
connection_idextension.- Parameters:
ext_type (
ExtensionType) – Extension type.data (
ConnectionId|None) – Decodedextension_data.msg_type (
HandshakeType) – Handshake message carrying the extension.cid (
bytes) – Connection ID, ifdatais not given.**kwargs (
Any) – Arbitrary keyword arguments.
- Return type:
- Returns:
Constructed
extension_dataschema.- Raises:
ProtocolError – If
datais not given for a TLS record, or for a message other than aClientHelloorServerHello.
- _make_ext_ech(ext_type, data=None, *, msg_type, inner=False, cipher_suite=None, config_id=0, enc=b'', payload=b'', confirmation=None, retry_configs=(), **kwargs)[source]¶
Make an
encrypted_client_helloextension.datadecides the structure when given,msg_typeotherwise.- Parameters:
ext_type (
ExtensionType) – Extension type.data (
ECHClientHelloOuter|ECHClientHelloInner|ECHHelloRetryRequest|ECHEncryptedExtensions|None) – Decodedextension_data.msg_type (
HandshakeType) – Handshake message carrying the extension.inner (
bool) – Whether aClientHellocarries the inner variant, ifdatais not given.cipher_suite (
HpkeSymmetricCipherSuite|None) – Cipher suite of the outer variant, ifdatais not given.config_id (
int) –config_idof the outer variant, ifdatais not given.enc (
bytes) – Encapsulated key of the outer variant, ifdatais not given.payload (
bytes) – Encrypted payload of the outer variant, ifdatais not given.confirmation (
bytes|None) – Confirmation for aHelloRetryRequest, ifdatais not given.retry_configs (
Iterable[ECHConfig]) – Retry configurations forEncryptedExtensions, ifdatais not given.**kwargs (
Any) – Arbitrary keyword arguments.
- Return type:
- Returns:
Constructed
extension_dataschema.- Raises:
ProtocolError – If neither
datanormsg_typenames a structure, the argument it needs is missing, a confirmation is not 8 octets, or an HPKE identifier, a member or anintcode, does not fit in two octets.
- _make_ext_renegotiation_info(ext_type, data=None, *, msg_type, renegotiated_connection=b'', **kwargs)[source]¶
Make a
renegotiation_infoextension.- Parameters:
ext_type (
ExtensionType) – Extension type.data (
RenegotiationInfo|None) – Decodedextension_data.msg_type (
HandshakeType) – Handshake message carrying the extension.renegotiated_connection (
bytes) –verify_dataof the previous handshake, ifdatais not given.**kwargs (
Any) – Arbitrary keyword arguments.
- Return type:
- Returns:
Constructed
extension_dataschema.- Raises:
ProtocolError – If
datais not given for a message other than aClientHelloorServerHello.
- _validate_tls_record(schema, *, available, dtls)[source]¶
Reject octets that cannot be a genuine TLS/DTLS record.
Dispatch hands this class every payload on its port, most of them mid-stream continuations with no record header. Without this check any octets decode as a record: the content-type registry mints a member for unknown values, and a
lengthpast the buffer is zero-padded byFieldBase.unpack.- Parameters:
- Raises:
ProtocolError – If
schemacannot be a genuine record, so thatbeholder()degrades dispatch toRawinstead of accepting a fabricated one.- Return type:
Note
A record split across TCP segments is rejected too: this layer holds only a fragment of it, and reassembly is
TCP’s job.
- _tls_negotiates(schema, target, *, dtls)[source]¶
Whether this record’s first handshake message negotiates
target.A best-effort peek ahead of the real parse: any decoding failure here is reported as “no”, leaving the real parse to raise.
- Parameters:
schema (
Any) – The just-parsed record header.target (
int) – The negotiated-version value to look for (TLS13_VERSIONorDTLS13_VERSION).dtls (
bool) – Whether this is a DTLS record.
- Return type:
- Returns:
Whether the record’s fragment decodes as cleartext handshake messages whose first one carries a
supported_versionsextension listingtarget.
- _tls_content_is_cleartext(content_type, fragment, *, dtls, epoch)[source]¶
Whether a record’s fragment is cleartext to decode structurally.
handshake,alertandchange_cipher_speccarry ciphertext once keys are derived, and the record header does not say so. Decoding ciphertext would fabricate content, or fail and lose the cleartext header toRaw.DTLS: epoch 0 is cleartext, any later epoch encrypted (RFC 9147 Section 4.2).
TLS:
handshakemust tile (_tls_handshake_tiles());alertmust be exactly 2 octets andchange_cipher_specexactly 1, which encryption overhead never yields.
Any other content type is reported as not cleartext.
- Parameters:
content_type (
ContentType) – Record content type.fragment (
bytes) – Record fragment, undecoded.dtls (
bool) – Whether this is a DTLS record.epoch (
int) – The DTLS record’s epoch; unused whendtlsis false.
- Return type:
- Returns:
Whether to decode
fragmentstructurally for its content type.
- _read_tls_content(content_type, fragment, *, dtls, epoch=0)[source]¶
Decode a record fragment by its content type.
- Parameters:
content_type (
ContentType) – Record content type.fragment (
bytes) – Record fragment, undecoded.dtls (
bool) – Whether this is a DTLS record, i.e. whether a handshake message carries DTLS’s fragment header.epoch (
int) – The DTLS record’s epoch, which says whether its fragment is encrypted; ignored whendtlsis false, since a TLS record header carries no equivalent.
- Return type:
- Returns:
A
tupleof handshake messages forhandshake, anAlertforalert, aChangeCipherSpecforchange_cipher_spec, orfragmentunchanged for every other content type – application data, heartbeat, ACK, and any content type this version does not name.- Raises:
ProtocolError – If
fragmentis malformed forcontent_type.
Notes
handshake,alertandchange_cipher_specare kept asbyteswhen_tls_content_is_cleartext()says they are encrypted.
- _read_tls_handshake_messages(fragment, *, dtls)[source]¶
Decode a
handshakerecord fragment into its handshake messages.A record may coalesce several handshake messages.
- Parameters:
fragment (
bytes) – Record fragment, i.e. one or more concatenated handshake messages.dtls (
bool) – Whether each message carries DTLS’s fragment header (message_seq,fragment_offset,fragment_length; RFC 6347 Section 4.2.2) after the 4-octetmsg_type/lengthheader shared with TLS.
- Return type:
- Returns:
The decoded handshake messages, in order.
- Raises:
ProtocolError – If a message’s header or body runs past the end of
fragment.
Notes
Only an unfragmented
ClientHello,ServerHelloorEncryptedExtensionsbody is decoded; other bodies stay undecoded (#2437). A fragmented DTLS message is decoded once reassembled, bydtls_handshake()(#2440).
- _make_tls_handshake_messages(messages, *, dtls)[source]¶
Encode handshake messages back into a record fragment – the inverse of
_read_tls_handshake_messages().- Parameters:
messages (
tuple[Any,...]) – Handshake messages, as returned by_read_tls_handshake_messages(), or already-encodedbytesper message. A fragmented DTLS message’s body is its fragment’s octets, or the whole message, of which only the fragment’s range is written.dtls (
bool) – Whether to write DTLS’s fragment header after each message’smsg_type/lengthheader.
- Return type:
- Returns:
Encoded record fragment.
- Raises:
ProtocolError – If a fragmented DTLS message’s body does not yield exactly
fragment_lengthoctets, which a fragment carries (RFC 6347 Section 4.2.3).
- _read_tls_client_hello(body, *, dtls)[source]¶
Decode a
ClientHellohandshake message body.Structure of TLS’s
ClientHello[RFC 9846 Section 4.2.2]:uint16 ProtocolVersion; opaque Random[32]; uint8 CipherSuite[2]; /* Cryptographic suite selector */ struct { ProtocolVersion legacy_version = 0x0303; /* TLS v1.2 */ Random random; opaque legacy_session_id<0..32>; CipherSuite cipher_suites<2..2^16-2>; opaque legacy_compression_methods<1..2^8-1>; Extension extensions<7..2^16-1>; } ClientHello;DTLS inserts a
cookieafterlegacy_session_id[RFC 6347 Section 4.2.1, RFC 9147 Section 5.3]:struct { ProtocolVersion legacy_version = { 254,253 }; // DTLSv1.2 Random random; opaque legacy_session_id<0..32>; opaque legacy_cookie<0..2^8-1>; // DTLS CipherSuite cipher_suites<2..2^16-2>; opaque legacy_compression_methods<1..2^8-1>; Extension extensions<8..2^16-1>; } ClientHello;- Parameters:
- Return type:
- Returns:
Decoded
ClientHello.- Raises:
ProtocolError – If
bodyis malformed.
- _read_tls_server_hello(body)[source]¶
Decode a
ServerHellohandshake message body, or aHelloRetryRequest’s, whoserandomis_HRR_RANDOM.Structure of
ServerHello[RFC 9846 Section 4.2.3]:struct { ProtocolVersion legacy_version = 0x0303; /* TLS v1.2 */ Random random; opaque legacy_session_id_echo<0..32>; CipherSuite cipher_suite; uint8 legacy_compression_method = 0; Extension extensions<6..2^16-1>; } ServerHello;- Parameters:
body (
bytes) – Message body.- Return type:
- Returns:
Decoded
ServerHello.- Raises:
ProtocolError – If
bodyis malformed.
- _read_tls_encrypted_extensions(body)[source]¶
Decode an
EncryptedExtensionshandshake message body.Structure of
EncryptedExtensions[RFC 9846 Section 4.4.1]:struct { Extension extensions<0..2^16-1>; } EncryptedExtensions;- Parameters:
body (
bytes) – Message body.- Return type:
- Returns:
Decoded
EncryptedExtensions.- Raises:
ProtocolError – If
bodyis malformed.
- _read_tls_extensions(data, *, msg_type)[source]¶
Decode an extension list.
Structure of one extension [RFC 9846 Section 4.3]:
struct { ExtensionType extension_type; opaque extension_data<0..2^16-1>; } Extension;Each
extension_datais unpacked by the schemaExtensionregisters for its type (_read_ext_schema()), then read by the parser__extension__registers. The framing delimits it, so one its schema or parser rejects with aProtocolErroris kept as its raw octets rather than failing the message. Both run in aCaughtByCallerblock, so that error is quiet: nothing is logged and no exception hook installed.- Parameters:
data (
bytes) – The extension list, i.e. one or more concatenated extensions, with no further length prefix of its own.msg_type (
HandshakeType) – Handshake message carrying the list, which the structure of some extensions depends on;hello_retry_requestfor aServerHellothat is aHelloRetryRequest.
- Return type:
- Returns:
The decoded extensions, in order.
- Raises:
ProtocolError – If an extension’s header or body runs past the end of
data.
- _read_ext_schema(ext_type, data, *, msg_type)[source]¶
Unpack an
extension_databy the schema registered for its type.- Parameters:
ext_type (
ExtensionType) – Extension type.data (
bytes) –extension_dataoctets.msg_type (
HandshakeType) – Handshake message carrying the extension, which the schema reads as__msg_type__, as it reads_dtlsas__dtls__.
- Return type:
- Returns:
The schema
Extensionregisters forext_type, orUnknownExtension.- Raises:
ProtocolError – If
dataends inside a field, leaves octets of a vector unread, or holds a vector its items do not tile.
- _make_tls_content(content_type, content, *, dtls)[source]¶
Encode a record fragment by its content type – the inverse of
_read_tls_content().- Parameters:
content_type (
ContentType) – Record content type.content (
Any) – Decoded record content, or already-encodedbytes.dtls (
bool) – Whether this is a DTLS record.
- Return type:
- Returns:
Encoded record fragment.
- _make_tls_client_hello(data, *, dtls)[source]¶
Encode a
ClientHellohandshake message body – the inverse of_read_tls_client_hello().- Parameters:
data (
ClientHello) – DecodedClientHello.dtls (
bool) – Whether this is a DTLSClientHello, i.e. whether to write thecookiefield.
- Return type:
- Returns:
Encoded message body.
- _make_tls_server_hello(data)[source]¶
Encode a
ServerHellohandshake message body – the inverse of_read_tls_server_hello().- Parameters:
data (
ServerHello) – DecodedServerHello.- Return type:
- Returns:
Encoded message body.
- _make_tls_encrypted_extensions(data)[source]¶
Encode an
EncryptedExtensionshandshake message body – the inverse of_read_tls_encrypted_extensions().- Parameters:
data (
EncryptedExtensions) – DecodedEncryptedExtensions.- Return type:
- Returns:
Encoded message body.
- _make_tls_extensions(extensions, *, msg_type)[source]¶
Encode an extension list – the inverse of
_read_tls_extensions().Raw
extension_dataoctets are written as they are; anything else goes to the constructor__extension__registers for the type, which returns theextension_dataschema, checked by_make_ext_values()before it is packed.- Parameters:
extensions (
Iterable[Extension|tuple[ExtensionType|int,dict[str,Any]]]) – Decoded extensions, or(type, kwargs)pairs for the registered constructor to build from.msg_type (
HandshakeType) – Handshake message carrying the list, as for_read_tls_extensions().
- Return type:
- Returns:
Encoded extension list, with no further length prefix of its own.
- Raises:
ProtocolError – If the type of a
(type, kwargs)pair is a name, abool, or a member or code the 16-bit extension type field cannot carry; or if a constructor returns anything but aSchema, as one written for 1.6.x returnsbytes.
- _make_ext_values(schema)[source]¶
Check the values of a made
extension_dataschema fit their fields.A
NumberFieldmasks an out-of-range value when it packs, so each integer, a vector’s length included, is packed by_make_pack()first and stored as theintit packed. Each octet string is stored as thebytesits buffer holds. AConditionalFieldwhose test the schema’s values fail is absent, and is passed over.- Parameters:
schema (
Schema) – The schema, and every schema nested in it.- Raises:
StructError – If an integer does not fit in its field.
TypeError – If an integer field holds what
intcannot convert,Noneincluded, or an octet field holds what is not bytes-like.
- _make_ext_value(value, size)[source]¶
Check
valuefits asize-octet field, as_make_ext_values()does each.
Header Schemas¶
Added in version 1.7.0.
- class pcapkit.protocols.application.ssl.schema.Extension(*args, **kwargs)[source]¶
Bases:
EnumSchema[ExtensionType]Header schema for the
extension_dataof a TLS extension.
- class pcapkit.protocols.application.ssl.schema.UnknownExtension(data=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ExtensionHeader schema for an
extension_datawith no structure, kept raw.
- class pcapkit.protocols.application.ssl.schema.Empty(dict_=None, *, __packet__=None, **kwargs)[source]¶
Bases:
SchemaHeader schema for
struct {} Empty(RFC 9846 Section 3.6).
- class pcapkit.protocols.application.ssl.schema.Opaque8(length=NO_VALUE, data=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
SchemaHeader schema for an
opaque <..2^8-1>vector item.
- class pcapkit.protocols.application.ssl.schema.Opaque16(length=NO_VALUE, data=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
SchemaHeader schema for an
opaque <..2^16-1>vector item.
- class pcapkit.protocols.application.ssl.schema.ServerName(name_type=NO_VALUE, length=NO_VALUE, name=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
SchemaHeader schema for a
ServerName(RFC 6066 Section 3).
- class pcapkit.protocols.application.ssl.schema.ServerNameList(length=NO_VALUE, server_name_list=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
SchemaHeader schema for a
ServerNameList(RFC 6066 Section 3).- length: int = <UInt16Field length>¶
Length of
server_name_list.
- server_name_list: list[ServerName] = <ListField server_name_list>¶
Server names.
- class pcapkit.protocols.application.ssl.schema.ServerNameExtension(data=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ExtensionHeader schema for
server_name(RFC 6066 Section 3).- data: ServerNameList | Empty | bytes = <SwitchField data>¶
A
ServerNameListin aClientHello, empty in aServerHelloorEncryptedExtensions.
- class pcapkit.protocols.application.ssl.schema.OCSPStatusRequest(responder_id_list_length=NO_VALUE, responder_id_list=NO_VALUE, request_extensions_length=NO_VALUE, request_extensions=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
SchemaHeader schema for an
OCSPStatusRequest(RFC 6066 Section 8).- responder_id_list_length: int = <UInt16Field responder_id_list_length>¶
Length of
responder_id_list.
- request_extensions_length: int = <UInt16Field request_extensions_length>¶
Length of
request_extensions.
- class pcapkit.protocols.application.ssl.schema.CertificateStatusRequest(status_type=NO_VALUE, request=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
SchemaHeader schema for a
CertificateStatusRequest(RFC 6066 Section 8).- request: OCSPStatusRequest = <ConditionalField request>¶
The request, for
ocsp, the one type it is defined for.
- class pcapkit.protocols.application.ssl.schema.StatusRequestExtension(data=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ExtensionHeader schema for
status_request.- data: CertificateStatusRequest | Empty | bytes = <SwitchField data>¶
A
CertificateStatusRequestin aClientHello, empty in aServerHello.
- class pcapkit.protocols.application.ssl.schema.NamedGroupList(length=NO_VALUE, named_group_list=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
SchemaHeader schema for a
NamedGroupList(RFC 9846 Section 4.3.7).- length: int = <UInt16Field length>¶
Length of
named_group_list.
- class pcapkit.protocols.application.ssl.schema.SupportedGroupsExtension(data=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ExtensionHeader schema for
supported_groups.- data: NamedGroupList | bytes = <SwitchField data>¶
A
NamedGroupListin aClientHelloorEncryptedExtensions.
- class pcapkit.protocols.application.ssl.schema.ECPointFormatList(length=NO_VALUE, ec_point_format_list=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
SchemaHeader schema for an
ECPointFormatList(RFC 8422 Section 5.1.2).- length: int = <UInt8Field length>¶
Length of
ec_point_format_list.
- class pcapkit.protocols.application.ssl.schema.ECPointFormatsExtension(data=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ExtensionHeader schema for
ec_point_formats.- data: ECPointFormatList | bytes = <SwitchField data>¶
An
ECPointFormatListin aClientHelloorServerHello.
- class pcapkit.protocols.application.ssl.schema.SignatureSchemeList(length=NO_VALUE, supported_signature_algorithms=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
SchemaHeader schema for a
SignatureSchemeList(RFC 9846 Section 4.3.3).- length: int = <UInt16Field length>¶
Length of
supported_signature_algorithms.
- class pcapkit.protocols.application.ssl.schema.SignatureAlgorithmsExtension(data=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ExtensionHeader schema for
signature_algorithms.- data: SignatureSchemeList | bytes = <SwitchField data>¶
A
SignatureSchemeListin aClientHelloorCertificateRequest.
- class pcapkit.protocols.application.ssl.schema.ProtocolNameList(length=NO_VALUE, protocol_name_list=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
SchemaHeader schema for a
ProtocolNameList(RFC 7301 Section 3.1).- length: int = <UInt16Field length>¶
Length of
protocol_name_list.
- class pcapkit.protocols.application.ssl.schema.ALPNExtension(data=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ExtensionHeader schema for
application_layer_protocol_negotiation.- data: ProtocolNameList | bytes = <SwitchField data>¶
A
ProtocolNameListin aClientHello,ServerHelloorEncryptedExtensions.
- class pcapkit.protocols.application.ssl.schema.SignedCertificateTimestampList(length=NO_VALUE, sct_list=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
SchemaHeader schema for a
SignedCertificateTimestampList(RFC 6962 Section 3.3).
- class pcapkit.protocols.application.ssl.schema.SignedCertificateTimestampExtension(data=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ExtensionHeader schema for
signed_certificate_timestamp.- data: SignedCertificateTimestampList | Empty | bytes = <SwitchField data>¶
Empty in a
ClientHello, aSignedCertificateTimestampListin aServerHello.
- class pcapkit.protocols.application.ssl.schema.Padding(padding=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
SchemaHeader schema for the
paddingof RFC 7685 Section 3.
- class pcapkit.protocols.application.ssl.schema.PaddingExtension(data=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ExtensionHeader schema for
padding.
- class pcapkit.protocols.application.ssl.schema.ExtendedMainSecretExtension(data=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ExtensionHeader schema for
extended_main_secret(RFC 7627 Section 5.1).
- class pcapkit.protocols.application.ssl.schema.CertificateCompressionAlgorithms(length=NO_VALUE, algorithms=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
SchemaHeader schema for a
CertificateCompressionAlgorithms(RFC 8879 Section 3).- length: int = <UInt8Field length>¶
Length of
algorithms.
- class pcapkit.protocols.application.ssl.schema.CompressCertificateExtension(data=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ExtensionHeader schema for
compress_certificate.- data: CertificateCompressionAlgorithms | bytes = <SwitchField data>¶
A
CertificateCompressionAlgorithmsin aClientHello.
- class pcapkit.protocols.application.ssl.schema.RecordSizeLimit(record_size_limit=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
SchemaHeader schema for a
RecordSizeLimit(RFC 8449 Section 4).
- class pcapkit.protocols.application.ssl.schema.RecordSizeLimitExtension(data=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ExtensionHeader schema for
record_size_limit.- data: RecordSizeLimit | bytes = <SwitchField data>¶
A
RecordSizeLimitin aClientHello,ServerHelloorEncryptedExtensions.
- class pcapkit.protocols.application.ssl.schema.SessionTicket(ticket=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
SchemaHeader schema for a
SessionTicket(RFC 5077 Section 3.2), with no length of its own.
- class pcapkit.protocols.application.ssl.schema.SessionTicketExtension(data=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ExtensionHeader schema for
session_ticket.- data: SessionTicket | bytes = <SwitchField data>¶
The ticket in a
ClientHelloorServerHello.
- class pcapkit.protocols.application.ssl.schema.PskIdentity(length=NO_VALUE, identity=NO_VALUE, obfuscated_ticket_age=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
SchemaHeader schema for a
PskIdentity(RFC 9846 Section 4.3.11).
- class pcapkit.protocols.application.ssl.schema.OfferedPsks(identities_length=NO_VALUE, identities=NO_VALUE, binders_length=NO_VALUE, binders=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
SchemaHeader schema for an
OfferedPsks(RFC 9846 Section 4.3.11).- identities_length: int = <UInt16Field identities_length>¶
Length of
identities.
- identities: list[PskIdentity] = <ListField identities>¶
The identities.
Bases:
SchemaHeader schema for a
ServerHello’spre_shared_key(RFC 9846 Section 4.3.11).Index of the identity selected.
Bases:
ExtensionHeader schema for
pre_shared_key, aPreSharedKeyExtension.An
OfferedPsksin aClientHello, the selection in aServerHello.
- class pcapkit.protocols.application.ssl.schema.EarlyDataExtension(data=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ExtensionHeader schema for
early_data, anEarlyDataIndication(RFC 9846 Section 4.3.10).
- class pcapkit.protocols.application.ssl.schema.SupportedVersionsClientHello(length=NO_VALUE, versions=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
SchemaHeader schema for a
ClientHello’ssupported_versions(RFC 9846 Section 4.3.1).
- class pcapkit.protocols.application.ssl.schema.SupportedVersionsServerHello(selected_version=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
SchemaHeader schema for a
ServerHello’ssupported_versions(RFC 9846 Section 4.3.1).
- class pcapkit.protocols.application.ssl.schema.SupportedVersionsExtension(data=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ExtensionHeader schema for
supported_versions, aSupportedVersions.- data: SupportedVersionsClientHello | SupportedVersionsServerHello | bytes = <SwitchField data>¶
The versions in a
ClientHello, the selection in aServerHelloorHelloRetryRequest.
- class pcapkit.protocols.application.ssl.schema.Cookie(length=NO_VALUE, cookie=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
SchemaHeader schema for a
Cookie(RFC 9846 Section 4.3.2).
- class pcapkit.protocols.application.ssl.schema.CookieExtension(data=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ExtensionHeader schema for
cookie.
- class pcapkit.protocols.application.ssl.schema.PskKeyExchangeModes(length=NO_VALUE, ke_modes=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
SchemaHeader schema for a
PskKeyExchangeModes(RFC 9846 Section 4.3.9).
- class pcapkit.protocols.application.ssl.schema.PskKeyExchangeModesExtension(data=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ExtensionHeader schema for
psk_key_exchange_modes.- data: PskKeyExchangeModes | bytes = <SwitchField data>¶
A
PskKeyExchangeModesin aClientHello.
- class pcapkit.protocols.application.ssl.schema.PostHandshakeAuthExtension(data=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ExtensionHeader schema for
post_handshake_auth(RFC 9846 Section 4.3.6).
Bases:
SchemaHeader schema for a
KeyShareEntry(RFC 9846 Section 4.3.8).NamedGroup.
Length of
key_exchange.
Key exchange information.
Bases:
SchemaHeader schema for a
KeyShareClientHello(RFC 9846 Section 4.3.8).Length of
client_shares.
Key shares offered.
Bases:
SchemaHeader schema for a
KeyShareHelloRetryRequest(RFC 9846 Section 4.3.8).NamedGroupselected.
Bases:
SchemaHeader schema for a
KeyShareServerHello(RFC 9846 Section 4.3.8).Key share selected.
Bases:
ExtensionHeader schema for
key_share.The structure of a
ClientHello,HelloRetryRequestorServerHello.
- class pcapkit.protocols.application.ssl.schema.ConnectionId(length=NO_VALUE, cid=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
SchemaHeader schema for a
ConnectionId(RFC 9146 Section 3).
- class pcapkit.protocols.application.ssl.schema.ConnectionIdExtension(data=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ExtensionHeader schema for
connection_id.- data: ConnectionId | bytes = <SwitchField data>¶
A
ConnectionIdin a DTLSClientHelloorServerHello.
- class pcapkit.protocols.application.ssl.schema.HpkeSymmetricCipherSuite(kdf_id=NO_VALUE, aead_id=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
SchemaHeader schema for an
HpkeSymmetricCipherSuite(RFC 9849 Section 4).- aead_id: HpkeAeadId = <EnumField aead_id>¶
HpkeAeadId.
- class pcapkit.protocols.application.ssl.schema.ECHClientHello(type=NO_VALUE, cipher_suite=NO_VALUE, config_id=NO_VALUE, enc_length=NO_VALUE, enc=NO_VALUE, payload_length=NO_VALUE, payload=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
SchemaHeader schema for an
ECHClientHello(RFC 9849 Section 5).- cipher_suite: HpkeSymmetricCipherSuite = <ConditionalField cipher_suite>¶
Cipher suite, for
outer.
- class pcapkit.protocols.application.ssl.schema.ECHHelloRetryRequest(confirmation=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
SchemaHeader schema for an
ECHHelloRetryRequest(RFC 9849 Section 5).
- class pcapkit.protocols.application.ssl.schema.ECHConfigExtension(type=NO_VALUE, length=NO_VALUE, data=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
SchemaHeader schema for an
ECHConfigExtension(RFC 9849 Section 4).
- class pcapkit.protocols.application.ssl.schema.ECHConfigContents(config_id=NO_VALUE, kem_id=NO_VALUE, public_key_length=NO_VALUE, public_key=NO_VALUE, cipher_suites_length=NO_VALUE, cipher_suites=NO_VALUE, maximum_name_length=NO_VALUE, public_name_length=NO_VALUE, public_name=NO_VALUE, extensions_length=NO_VALUE, extensions=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
SchemaHeader schema for an
ECHConfigContents(RFC 9849 Section 4), itsHpkeKeyConfiginline, since that has no length of its own.- public_key_length: int = <UInt16Field public_key_length>¶
Length of
public_key.
- cipher_suites_length: int = <UInt16Field cipher_suites_length>¶
Length of
cipher_suites.
- cipher_suites: list[HpkeSymmetricCipherSuite] = <ListField cipher_suites>¶
Cipher suites of the
HpkeKeyConfig.
- maximum_name_length: int = <UInt8Field maximum_name_length>¶
Longest name the client may pad its inner name to.
- public_name_length: int = <UInt8Field public_name_length>¶
Length of
public_name.
- extensions_length: int = <UInt16Field extensions_length>¶
Length of
extensions.
- extensions: list[ECHConfigExtension] = <ListField extensions>¶
Configuration extensions.
- class pcapkit.protocols.application.ssl.schema.ECHConfig(version=NO_VALUE, length=NO_VALUE, contents=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
SchemaHeader schema for an
ECHConfig(RFC 9849 Section 4).- contents: ECHConfigContents | bytes = <SwitchField contents>¶
The contents of version
0xFE0D; the raw octets of any other.
- class pcapkit.protocols.application.ssl.schema.ECHEncryptedExtensions(length=NO_VALUE, retry_configs=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
SchemaHeader schema for an
ECHEncryptedExtensions(RFC 9849 Section 5).- length: int = <UInt16Field length>¶
Length of
retry_configs.
- class pcapkit.protocols.application.ssl.schema.ECHExtension(data=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
ExtensionHeader schema for
encrypted_client_hello.- data: ECHClientHello | ECHHelloRetryRequest | ECHEncryptedExtensions | bytes = <SwitchField data>¶
An
ECHClientHello,ECHHelloRetryRequestorECHEncryptedExtensions.
- class pcapkit.protocols.application.ssl.schema.RenegotiationInfo(length=NO_VALUE, renegotiated_connection=NO_VALUE, *, __packet__=None, **kwargs)[source]¶
Bases:
SchemaHeader schema for a
RenegotiationInfo(RFC 5746 Section 3.2).- length: int = <UInt8Field length>¶
Length of
renegotiated_connection.
Data Models¶
- class pcapkit.protocols.application.ssl.data.Handshake(*args, **kwargs)[source]¶
Bases:
DataData model for a TLS/DTLS handshake message.
bodyholds aClientHello,ServerHelloorEncryptedExtensionsfor those message types, and the raw, undecoded message body for every otherHandshakeType– message-TYPE-level framing only (#2437).- msg_type: HandshakeType¶
Handshake message type.
- body: ClientHello | ServerHello | EncryptedExtensions | bytes¶
Message body.
- class pcapkit.protocols.application.ssl.data.ClientHello(version, random, session_id, cookie, cipher_suites, compression_methods, extensions)[source]¶
Bases:
DataData model for a TLS/DTLS
ClientHellohandshake message body.- cookie: bytes | None¶
DTLS’s
cookie(RFC 6347 Section 4.2.1; carried forward aslegacy_cookieby RFC 9147 Section 5.3), orNonefor TLS, whoseClientHellocarries no cookie field at all – distinct from DTLS’s empty cookie, which isb''.
- class pcapkit.protocols.application.ssl.data.ServerHello(version, random, session_id, cipher_suite, compression_method, extensions)[source]¶
Bases:
DataData model for a TLS/DTLS
ServerHellohandshake message body.A
HelloRetryRequestshares the structure and is told apart by itsrandom(RFC 9846 Section 4.2.3); its extensions decode in the shapes aHelloRetryRequestgives them.
- class pcapkit.protocols.application.ssl.data.EncryptedExtensions(extensions)[source]¶
Bases:
DataData model for a TLS/DTLS
EncryptedExtensionshandshake message body (RFC 9846 Section 4.4.1).
- class pcapkit.protocols.application.ssl.data.Extension(type, data)[source]¶
Bases:
DataData model for a TLS/DTLS extension list entry (RFC 9846 Section 4.3).
dataholds the decodedextension_datawhereSSL.__extension__registers a decoder fortype, and the raw octets otherwise – including a body its decoder cannot read exactly, or one in a message whose structure for it the decoder does not know.- type: ExtensionType¶
Extension type.
- data: ExtensionData | bytes¶
Extension data – decoded, or the raw octets.
- class pcapkit.protocols.application.ssl.data.ExtensionData(*args, **kwargs)[source]¶
Bases:
DataData model for a decoded TLS/DTLS
extension_datafield.Each subclass is a structure an
ExtensionTypecarries, named as its specification names it;Emptyserves every type whoseextension_datais empty.
- class pcapkit.protocols.application.ssl.data.ServerNameList(server_name_list)[source]¶
Bases:
ExtensionDataData model for the
server_nameextension (RFC 6066 Section 3).A
ServerHelloorEncryptedExtensionscarries the extension with emptyextension_data, which staysb''.- server_name_list: tuple[ServerName, ...]¶
Server names.
- class pcapkit.protocols.application.ssl.data.ServerName(name_type, name)[source]¶
Bases:
DataData model for one
ServerNameof aserver_nameextension (RFC 6066 Section 3).
- class pcapkit.protocols.application.ssl.data.NamedGroupList(named_group_list)[source]¶
Bases:
ExtensionDataData model for the
supported_groupsextension (RFC 9846 Section 4.3.7).
- class pcapkit.protocols.application.ssl.data.SignatureSchemeList(supported_signature_algorithms)[source]¶
Bases:
ExtensionDataData model for the
signature_algorithmsextension (RFC 9846 Section 4.3.3).
- class pcapkit.protocols.application.ssl.data.ProtocolNameList(protocol_name_list)[source]¶
Bases:
ExtensionDataData model for the
application_layer_protocol_negotiationextension (RFC 7301 Section 3.1).
- class pcapkit.protocols.application.ssl.data.SupportedVersionsClientHello(versions)[source]¶
Bases:
ExtensionDataData model for a
ClientHello’ssupported_versionsextension (RFC 9846 Section 4.3.1).
- class pcapkit.protocols.application.ssl.data.SupportedVersionsServerHello(selected_version)[source]¶
Bases:
ExtensionDataData model for a
ServerHello’s orHelloRetryRequest’ssupported_versionsextension (RFC 9846 Section 4.3.1).
Bases:
ExtensionDataData model for a
ClientHello’skey_shareextension (RFC 9846 Section 4.3.8).Key shares offered, most preferred first.
Bases:
ExtensionDataData model for a
HelloRetryRequest’skey_shareextension (RFC 9846 Section 4.3.8).NamedGroupthe server asks a retriedClientHelloto share.
Bases:
ExtensionDataData model for a
ServerHello’skey_shareextension (RFC 9846 Section 4.3.8).The server’s key share.
Bases:
DataData model for one
KeyShareEntryof akey_shareextension (RFC 9846 Section 4.3.8).NamedGroupof the key.
Key exchange information.
- class pcapkit.protocols.application.ssl.data.ConnectionId(cid)[source]¶
Bases:
ExtensionDataData model for the
connection_idextension (RFC 9146 Section 3).The extension is DTLS-only (RFC 9146 Section 10.2); a TLS hello that carries it, which does not conform, decodes to this model all the same.
- class pcapkit.protocols.application.ssl.data.Empty(dict_=None, **kwargs)[source]¶
Bases:
ExtensionDataData model for an
extension_datathat is empty in the message carrying it, theEmptystructure of RFC 9846 Section 4.3.10.extended_main_secret(RFC 7627 Section 5.1) andpost_handshake_auth(RFC 9846 Section 4.3.6) are always empty,early_datain aClientHelloandEncryptedExtensions(RFC 9846 Section 4.3.10),signed_certificate_timestampin aClientHello(RFC 6962 Section 3.3.1), andstatus_requestin aServerHello(RFC 6066 Section 8).Added in version 1.7.0.
- class pcapkit.protocols.application.ssl.data.CertificateStatusRequest(status_type, request)[source]¶
Bases:
ExtensionDataData model for a
ClientHello’sstatus_requestextension (RFC 6066 Section 8).Only
ocsphas arequeststructure, so a body naming anotherstatus_typestays raw octets.Added in version 1.7.0.
- status_type: CertificateStatusType¶
Status type.
- request: OCSPStatusRequest¶
The OCSP request.
- class pcapkit.protocols.application.ssl.data.OCSPStatusRequest(responder_id_list, request_extensions)[source]¶
Bases:
DataData model for the
OCSPStatusRequestof astatus_requestextension (RFC 6066 Section 8).Added in version 1.7.0.
- class pcapkit.protocols.application.ssl.data.ECPointFormatList(ec_point_format_list)[source]¶
Bases:
ExtensionDataData model for the
ec_point_formatsextension (RFC 8422 Section 5.1.2).Added in version 1.7.0.
- ec_point_format_list: tuple[ECPointFormat, ...]¶
Point formats, most preferred first.
- class pcapkit.protocols.application.ssl.data.SignedCertificateTimestampList(sct_list)[source]¶
Bases:
ExtensionDataData model for a
ServerHello’ssigned_certificate_timestampextension (RFC 6962 Section 3.3).Added in version 1.7.0.
- class pcapkit.protocols.application.ssl.data.Padding(padding)[source]¶
Bases:
ExtensionDataData model for the
paddingextension (RFC 7685 Section 3).Added in version 1.7.0.
- padding: bytes¶
Padding octets as captured, which RFC 7685 Section 3 requires to be zero.
- class pcapkit.protocols.application.ssl.data.CertificateCompressionAlgorithms(algorithms)[source]¶
Bases:
ExtensionDataData model for the
compress_certificateextension (RFC 8879 Section 3).Added in version 1.7.0.
- algorithms: tuple[CertificateCompressionAlgorithm, ...]¶
Compression algorithms, most preferred first.
- class pcapkit.protocols.application.ssl.data.RecordSizeLimit(record_size_limit)[source]¶
Bases:
ExtensionDataData model for the
record_size_limitextension (RFC 8449 Section 4).Added in version 1.7.0.
- class pcapkit.protocols.application.ssl.data.SessionTicket(ticket)[source]¶
Bases:
ExtensionDataData model for the
session_ticketextension (RFC 5077 Section 3.2).Added in version 1.7.0.
- class pcapkit.protocols.application.ssl.data.OfferedPsks(identities, binders)[source]¶
Bases:
ExtensionDataData model for a
ClientHello’spre_shared_keyextension (RFC 9846 Section 4.3.11).Added in version 1.7.0.
- identities: tuple[PskIdentity, ...]¶
Identities offered.
- class pcapkit.protocols.application.ssl.data.PskIdentity(identity, obfuscated_ticket_age)[source]¶
Bases:
DataData model for one
PskIdentityof apre_shared_keyextension (RFC 9846 Section 4.3.11).Added in version 1.7.0.
Bases:
ExtensionDataData model for a
ServerHello’spre_shared_keyextension (RFC 9846 Section 4.3.11).Added in version 1.7.0.
Index of the identity selected, into the
ClientHello’s list.
- class pcapkit.protocols.application.ssl.data.Cookie(cookie)[source]¶
Bases:
ExtensionDataData model for the
cookieextension (RFC 9846 Section 4.3.2).Added in version 1.7.0.
- class pcapkit.protocols.application.ssl.data.PskKeyExchangeModes(ke_modes)[source]¶
Bases:
ExtensionDataData model for the
psk_key_exchange_modesextension (RFC 9846 Section 4.3.9).Added in version 1.7.0.
- ke_modes: tuple[PskKeyExchangeMode, ...]¶
Key exchange modes the client supports with a PSK.
- class pcapkit.protocols.application.ssl.data.ECHClientHelloOuter(cipher_suite, config_id, enc, payload)[source]¶
Bases:
ExtensionDataData model for the outer variant of a
ClientHello’sencrypted_client_helloextension (RFC 9849 Section 5).Added in version 1.7.0.
- cipher_suite: HpkeSymmetricCipherSuite¶
Cipher suite encrypting the inner
ClientHello.
- class pcapkit.protocols.application.ssl.data.ECHClientHelloInner(dict_=None, **kwargs)[source]¶
Bases:
ExtensionDataData model for the inner variant of a
ClientHello’sencrypted_client_helloextension (RFC 9849 Section 5), which carries its type alone.Added in version 1.7.0.
- class pcapkit.protocols.application.ssl.data.ECHHelloRetryRequest(confirmation)[source]¶
Bases:
ExtensionDataData model for a
HelloRetryRequest’sencrypted_client_helloextension (RFC 9849 Section 5).Added in version 1.7.0.
- class pcapkit.protocols.application.ssl.data.ECHEncryptedExtensions(retry_configs)[source]¶
Bases:
ExtensionDataData model for an
EncryptedExtensions’encrypted_client_helloextension (RFC 9849 Section 5).Added in version 1.7.0.
- class pcapkit.protocols.application.ssl.data.ECHConfig(version, contents)[source]¶
Bases:
DataData model for one
ECHConfigof anECHConfigList(RFC 9849 Section 4).Added in version 1.7.0.
- contents: ECHConfigContents | bytes¶
The decoded contents for the version RFC 9849 defines,
0xFE0D, and the raw octets for any other, which a client skips.
- class pcapkit.protocols.application.ssl.data.ECHConfigContents(key_config, maximum_name_length, public_name, extensions)[source]¶
Bases:
DataData model for the
ECHConfigContentsof anECHConfig(RFC 9849 Section 4).Added in version 1.7.0.
- key_config: HpkeKeyConfig¶
HPKE key configuration.
- extensions: tuple[ECHConfigExtension, ...]¶
Configuration extensions.
- class pcapkit.protocols.application.ssl.data.HpkeKeyConfig(config_id, kem_id, public_key, cipher_suites)[source]¶
Bases:
DataData model for the
HpkeKeyConfigof anECHConfig(RFC 9849 Section 4).Added in version 1.7.0.
- kem_id: HpkeKemId¶
HPKE KEM identifier (RFC 9180 Section 7.1).
- cipher_suites: tuple[HpkeSymmetricCipherSuite, ...]¶
Cipher suites a client may encrypt with.
- class pcapkit.protocols.application.ssl.data.HpkeSymmetricCipherSuite(kdf_id, aead_id)[source]¶
Bases:
DataData model for an
HpkeSymmetricCipherSuite(RFC 9849 Section 4).Added in version 1.7.0.
- kdf_id: HpkeKdfId¶
HPKE KDF identifier (RFC 9180 Section 7.2).
- aead_id: HpkeAeadId¶
HPKE AEAD identifier (RFC 9180 Section 7.3).
- class pcapkit.protocols.application.ssl.data.ECHConfigExtension(type, data)[source]¶
Bases:
DataData model for one
ECHConfigExtensionof anECHConfig(RFC 9849 Section 4.2).Added in version 1.7.0.
- class pcapkit.protocols.application.ssl.data.RenegotiationInfo(renegotiated_connection)[source]¶
Bases:
ExtensionDataData model for the
renegotiation_infoextension (RFC 5746 Section 3.2).Added in version 1.7.0.
Constants¶
Added in version 1.7.0.
- pcapkit.protocols.application.ssl.const.TLS13_VERSION = 772¶
The
supported_versionsvalue for TLS 1.3 (RFC 9846 Section 4.3.1).
- pcapkit.protocols.application.ssl.const.DTLS13_VERSION = 65276¶
The
supported_versionsvalue for DTLS 1.3 (RFC 9147 Section 5.3).
- pcapkit.protocols.application.ssl.const._HRR_RANDOM¶
The
randomthat makes aServerHelloaHelloRetryRequest– the SHA-256 of"HelloRetryRequest"(RFC 9846 Section 4.2.3).
Footnotes