Class HybridKexExporter
java.lang.Object
zeroecho.sdk.hybrid.kex.HybridKexExporter
- All Implemented Interfaces:
AutoCloseable, Destroyable
Deterministic exporter for deriving multiple independent keys from a single
hybrid KEX.
Many protocols require more than one key from a single handshake (for example, separate traffic keys for each direction, confirmation keys, or application exporters). This class provides a minimal key schedule API over HKDF-SHA256.
Construction
The exporter is seeded by a caller-supplied secret (typically the output of
HybridKexContext.deriveSecret()). The exporter then derives sub-keys
by varying HKDF info.
Security notes
- Use distinct labels per purpose (for example
"app/tx"vs"app/rx"). - Bind transcript/context by including it in the
infobytes.
- Since:
- 1.0
-
Constructor Summary
ConstructorsConstructorDescriptionHybridKexExporter(byte[] rootSecret, byte[] salt) Creates an exporter seeded from a root secret. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes this exporter by destroying its retained secret material.voiddestroy()Overwrites the exporter root secret and salt.byte[]DerivesoutLenBytesbytes for a specific purpose.byte[]DerivesoutLenBytesbytes for a specific purpose using only the label.booleanReports whether this exporter has been destroyed.
-
Constructor Details
-
HybridKexExporter
public HybridKexExporter(byte[] rootSecret, byte[] salt) Creates an exporter seeded from a root secret.- Parameters:
rootSecret- root secret (must not be null)salt- optional HKDF salt (may be null)
-
-
Method Details
-
export
DerivesoutLenBytesbytes for a specific purpose.- Parameters:
label- ASCII/UTF-8 label identifying the purpose (must not be null)info- optional additional binding info (may be null)outLenBytes- output length in bytes (1..8160)- Returns:
- derived bytes
- Throws:
IllegalArgumentException- if outLenBytes is out of range- Since:
- 1.0
-
export
DerivesoutLenBytesbytes for a specific purpose using only the label.Equivalent to
export(label, null, outLenBytes). Use the three-argument form to additionally bind a transcript or context value.- Parameters:
label- ASCII/UTF-8 label identifying the purpose (must not be null)outLenBytes- output length in bytes (1..8160)- Returns:
- derived bytes
- Throws:
IllegalArgumentException- if outLenBytes is out of rangeIllegalStateException- if the exporter has been destroyed- Since:
- 1.0
-
destroy
public void destroy()Overwrites the exporter root secret and salt.Destruction is idempotent. All subsequent export or diagnostic access fails with
IllegalStateException.- Specified by:
destroyin interfaceDestroyable
-
isDestroyed
public boolean isDestroyed()Reports whether this exporter has been destroyed.- Specified by:
isDestroyedin interfaceDestroyable- Returns:
trueafter destruction
-
close
public void close()Closes this exporter by destroying its retained secret material.- Specified by:
closein interfaceAutoCloseable
-