tls: expose negotiated TLS 1.3 key exchange group in supported_versions #462
+58
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Expose negotiated TLS 1.3 key exchange group in
supported_versionsSummary
This PR extends the TLS handshake logging to expose the negotiated key exchange group (CurveID / NamedGroup) for TLS 1.3 connections under:
handshake_log.server_hello.supported_versions.selected_version.key_exchangeIn TLS 1.3, cipher suites no longer encode the key exchange mechanism, which makes it impossible for consumers to determine whether a server negotiated
X25519,secp256r1, etc.zcrypto already parses this information internally from the ServerHello, but it was not previously exposed in the JSON output.
This change makes that information available in a backward-compatible way.
Motivation / Rationale
In TLS ≤ 1.2, the key exchange mechanism can be inferred from the cipher suite name (e.g.
ECDHE_RSA_*vsRSA_*).However, in TLS 1.3, cipher suites are decoupled from the key exchange group (RFC 8446), and all TLS 1.3 cipher suites are AEAD-only.
As a result, consumers of zcrypto (e.g. zgrab2 and downstream tooling) currently cannot determine which key exchange group was actually negotiated for TLS 1.3 connections, even though this information is security-relevant (e.g. X25519 vs P-256, crypto posture analysis, TLS hardening, future PQ transition work).
zcrypto already parses:
key_shareextension, andbut this information was not surfaced in the handshake log.
This PR closes that gap.
Changes
supported_versions.selected_versionthat preserves the existingnameandvaluefields.key_exchangefield with the negotiatedCurveID:serverShare.groupwhen present.selectedGroupfor the HelloRetryRequest path.The output remains fully backward compatible for existing consumers.
Example Output zgrab2 (TLS 1.3)
Compatibility & Impact