Skip to main content

Module tls

Module tls 

Source
Expand description

TLS (Transport Layer Security) protocol layer.

Implements parsing and building for the TLS record protocol (RFC 5246, RFC 8446), including support for SSLv2, TLS 1.0-1.2, and TLS 1.3.

This is a “clean-sheet” implementation that follows Scapy’s “Permissive Parser, Explicit Builder” pattern, allowing construction of malformed packets for security research and fuzzing.

§Record Format

ContentType  type;           // 1 byte (20-24)
ProtocolVersion version;     // 2 bytes
uint16 length;               // 2 bytes
opaque fragment[length];     // variable

Re-exports§

pub use builder::TlsAlertBuilder;
pub use builder::TlsCcsBuilder;
pub use builder::TlsRecordBuilder;
pub use cert::TlsCertificate;
pub use extensions::Extension;
pub use handshake::Certificate;
pub use handshake::ClientHello;
pub use handshake::Finished;
pub use handshake::Handshake;
pub use handshake::HandshakeBody;
pub use handshake::ServerHello;
pub use record::TLS_FIELDS;
pub use record::TLS_RECORD_HEADER_LEN;
pub use record::TlsLayer;
pub use session::TlsSession;
pub use sslv2::Sslv2ClientHello;
pub use sslv2::Sslv2ClientMasterKey;
pub use sslv2::Sslv2ServerHello;
pub use types::ExtensionType;
pub use types::HandshakeType;
pub use types::NamedGroup;
pub use types::SignatureScheme;
pub use types::TlsAlertDescription;
pub use types::TlsAlertLevel;
pub use types::TlsContentType;
pub use types::TlsVersion;

Modules§

builder
TLS Record builder.
cert
TLS Certificate handling.
crypto
TLS cryptographic primitives.
extensions
TLS Extension parsing and building.
handshake
TLS Handshake message parsing and building.
keyexchange
TLS Key Exchange implementations.
record
TLS Record layer view into a packet buffer.
session
TLS Session state management.
sslv2
SSLv2 protocol support.
types
TLS protocol constants and type definitions.

Constants§

TLS_PORT
Standard TLS port (HTTPS).
TLS_PORTS
Additional common TLS ports.

Functions§

is_tls_payload
Check if a TCP payload looks like TLS traffic.