You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit f5b9c25
Browse filesBrowse the repository at this point in the historyBrowse files
feat(application): implement TLS/SSL and DTLS record layer + handshake framing
pcapkit.protocols.application.ssl.SSL is the shared record-layer base over
the part TLS and DTLS genuinely share (RFC 8446 §5.1 / RFC 9147 §4.1):
ContentType/legacy-version/length and content-type dispatch. tls.py and
dtls.py are the two concrete subclasses; DTLS alone carries the epoch +
sequence number in its record header and the message_seq/fragment_offset/
fragment_length header each of its handshake messages adds (RFC 6347
§4.2.2), plus a cookie field in its ClientHello that TLS's does not carry
(RFC 6347 §4.2.1 / RFC 9147 §5.3).
- ClientHello/ServerHello decode to their version, random, session ID,
cipher suite(s), compression method(s) and extension list (TYPE+LENGTH
framed, extension bodies undecoded); every other handshake type is
message-TYPE-level framing only. Alert and ChangeCipherSpec decode in
full; application_data and unrecognised content types stay opaque bytes.
- SSL._validate_tls_record rejects a content type the registry has no
member for, a legacy version outside TLS's/DTLS's range, or a declared
length that runs past the buffer, so dispatch falls back to Raw instead
of fabricating a record from unrelated bytes (e.g. a mid-stream TLS
ciphertext continuation on port 443).
- New const registries pcapkit.const.tls.{content_type,handshake_type},
following the generated-shape convention (EnumRegistry + IntEnum);
HandshakeType now also names 17/21/22/23, previously unnamed gaps.
- TCP port 443 (https) and UDP port 5684 (coaps) are bound to TLS/DTLS.
- DTLS handshake-fragment reassembly is deliberately out of scope,
tracked as #2440.
Every message shape implemented has a hand-crafted byte fixture proven
byte-exact both ways (parse-then-rebuild and make-then-parse), including a
genuine DTLS ClientHello with a cookie. Build/test: mypy and pylint clean
on every changed file; isort clean; the full tests/protocols, tests/project
and tests/const suites pass.
Refs #2437
Copy file name to clipboardExpand all lines: CHANGELOG.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,12 @@
2
2
3
3
Wave 2 of the roadmap, per the contributing docs' enhancement-proposal page: the protocol pairs that wanted a shared abstract base, and the two that simply had no dissector at all.
4
4
5
+
### pcapkit.protocols
6
+
7
+
#### Added
8
+
9
+
- TLS and DTLS record-layer and handshake-message framing [[RFC 5246](https://datatracker.ietf.org/doc/html/rfc5246), [RFC 8446](https://datatracker.ietf.org/doc/html/rfc8446), [RFC 6347](https://datatracker.ietf.org/doc/html/rfc6347), [RFC 9147](https://datatracker.ietf.org/doc/html/rfc9147)] ([#2437](https://github.com/JarryShaw/PyPCAPKit/issues/2437), [#2441](https://github.com/JarryShaw/PyPCAPKit/pull/2441)). `SSL` is a shared base over the record header and content-type dispatch TLS and DTLS hold in common; `TLS` and `DTLS` are the two concrete subclasses, DTLS alone carrying the epoch/sequence-number pair and the fragment header each handshake message adds. `ClientHello`/`ServerHello` decode to their version, random, session ID, DTLS's `cookie`, cipher suite(s), compression method(s) and extension list (TYPE+LENGTH framed, extension bodies undecoded); every other handshake message is message-TYPE-level framing only. TCP port 443 (`https`) and UDP port 5684 (`coaps`) are bound to TLS and DTLS respectively. Reassembling a handshake message DTLS has fragmented across several records is left to its own follow-up ([#2440](https://github.com/JarryShaw/PyPCAPKit/issues/2440)).
10
+
5
11
---
6
12
7
13
Full changelog: <https://jarryshaw.github.io/PyPCAPKit/changelog.html>
0 commit comments