Package zeroecho.sdk.hybrid.kex


package zeroecho.sdk.hybrid.kex
Hybrid key exchange (KEX) utilities combining a classic agreement and a post-quantum KEM-style agreement into one derived shared secret.

This package provides an SDK-level composition layer over existing core contracts:

  • AgreementContext for classic DH-style agreements (e.g. X25519, ECDH, DH), and
  • MessageAgreementContext for message-based agreements (typically PQC KEM-style flows such as ML-KEM exposed via KeyUsage.AGREEMENT).

Wire model

A hybrid exchange needs explicit "to-be-sent" bytes. This package unifies the model by emitting a single peer message containing two length-prefixed parts:

  1. classic message (often empty for classic agreements that only require a peer public key),
  2. PQC message (typically KEM ciphertext produced by MessageAgreementContext).

Key derivation

The two underlying secrets are combined using HKDF-SHA256 (RFC 5869) via Kdf.hkdfSha256(byte[], byte[], byte[], int) rather than concatenation. Callers should treat raw intermediate secrets as sensitive and clear them as soon as possible.

Intended usage

Use HybridKexContexts to build initiator and responder contexts and exchange HybridKexContext.getPeerMessage() between parties.

Since:
1.0
  • Class
    Description
    Hybrid key exchange (KEX) context that combines a classic agreement and a post-quantum KEM-style agreement.
    Factory utilities for constructing hybrid key exchange (KEX) contexts.
    Deterministic exporter for deriving multiple independent keys from a single hybrid KEX.
    Hybrid KEX policy helper for minimum security strength enforcement.
    Profile for a hybrid key exchange (KEX) composition.
    Canonical transcript builder for binding hybrid KEX derivation to public handshake context.