Class HybridKexTranscript
java.lang.Object
zeroecho.sdk.hybrid.kex.HybridKexTranscript
Canonical transcript builder for binding hybrid KEX derivation to public
handshake context.
The derived hybrid keying material should be bound to protocol context to
reduce risk of cross-protocol key reuse and "unknown key-share" style
mistakes. This builder provides a deterministic and self-delimiting binary
encoding intended to be used as HKDF info.
Encoding
The transcript is encoded as a sequence of TLV-like entries:
[u16 tagLen][tagBytes...][u32 valueLen][valueBytes...] ...
Tags are ASCII identifiers (for example "suite", "role",
"peerA", "peerB", "classicMsg", "pqcMsg").
Values are arbitrary bytes. The encoding is stable across JVMs and
independent of locale.
Thread safety
Instances are mutable and not thread-safe.
- Since:
- 1.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds a raw byte value under a tag.Adds a UTF-8 string value under a tag.byte[]Returns the canonical transcript bytes (defensive copy).
-
Constructor Details
-
HybridKexTranscript
public HybridKexTranscript()Creates a new empty transcript.
-
-
Method Details
-
addUtf8
Adds a UTF-8 string value under a tag.- Parameters:
tag- ASCII tag identifiervalue- UTF-8 string value (must not be null)- Returns:
- this transcript
- Throws:
NullPointerException- if tag or value is nullIllegalArgumentException- if tag is empty
-
addBytes
Adds a raw byte value under a tag.The value is defensively copied by the caller if needed; this method does not retain a reference to the provided array.
- Parameters:
tag- ASCII tag identifiervalue- byte value (must not be null)- Returns:
- this transcript
- Throws:
NullPointerException- if tag or value is nullIllegalArgumentException- if tag is empty
-
toByteArray
public byte[] toByteArray()Returns the canonical transcript bytes (defensive copy).- Returns:
- transcript bytes
-