Record Class HybridKexProfile

java.lang.Object
java.lang.Record
zeroecho.sdk.hybrid.kex.HybridKexProfile
Record Components:
hkdfSalt - optional HKDF salt (defensively copied), may be null
hkdfInfo - optional HKDF info/label (defensively copied), may be null
outLenBytes - length of derived keying material in bytes (1..8160)

public record HybridKexProfile(byte[] hkdfSalt, byte[] hkdfInfo, int outLenBytes) extends Record
Profile for a hybrid key exchange (KEX) composition.

A hybrid KEX combines two independently derived secrets:

  • a classic (pre-quantum) agreement secret produced by an AgreementContext (e.g. X25519, ECDH, DH), and
  • a post-quantum agreement secret produced by a MessageAgreementContext (typically a KEM-style agreement such as ML-KEM).

The two secrets are combined using HKDF-SHA256 (RFC 5869) to produce a final keying material byte array of a caller-selected length. The default label is intended to make cross-protocol misuse harder by providing an explicit domain separator.

Notes

  • This profile does not store algorithm identifiers on purpose; it focuses on KDF binding and output size. Algorithm selection happens in higher layers when constructing the two underlying contexts.
  • salt is optional; if null/empty, HKDF uses a zero-filled salt as per RFC 5869 and Kdf.
Since:
1.0
  • Constructor Summary

    Constructors
    Constructor
    Description
    HybridKexProfile(byte[] hkdfSalt, byte[] hkdfInfo, int outLenBytes)
    Canonical constructor with validation and defensive copies.
  • Method Summary

    Modifier and Type
    Method
    Description
    defaultProfile(int outLenBytes)
    Constructs a profile with a default HKDF info label.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    byte[]
    Returns an owned copy of the optional HKDF information.
    byte[]
    Returns an owned copy of the optional HKDF salt.
    int
    Returns the value of the outLenBytes record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • HybridKexProfile

      public HybridKexProfile(byte[] hkdfSalt, byte[] hkdfInfo, int outLenBytes)
      Canonical constructor with validation and defensive copies.
      Parameters:
      hkdfSalt - optional HKDF salt
      hkdfInfo - optional HKDF info/label
      outLenBytes - output length in bytes
  • Method Details

    • defaultProfile

      public static HybridKexProfile defaultProfile(int outLenBytes)
      Constructs a profile with a default HKDF info label.
      Parameters:
      outLenBytes - output length in bytes
      Returns:
      profile with default HKDF info label and no explicit salt
    • hkdfSalt

      public byte[] hkdfSalt()
      Returns an owned copy of the optional HKDF salt.
      Returns:
      salt copy, or null
    • hkdfInfo

      public byte[] hkdfInfo()
      Returns an owned copy of the optional HKDF information.
      Returns:
      information copy, or null
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • outLenBytes

      public int outLenBytes()
      Returns the value of the outLenBytes record component.
      Returns:
      the value of the outLenBytes record component