Class KEM
java.lang.Object
org.bouncycastle.crypto.hpke.KEM
Abstract base for HPKE Key Encapsulation Mechanisms per
RFC 9180 §4.
Concrete subclass DHKEM implements the five DHKEM variants registered
by RFC 9180 (P-256/P-384/P-521/X25519/X448). External implementations —
e.g. post-quantum KEMs such as ML-KEM or the hybrid X25519+Kyber768 used by
MLS — can be plugged in by subclassing this class and passing the
instance to the HPKE(mode, kemId, kdfId, aeadId, KEM, encSize)
constructor; the framework only requires:
Encap/Decap— the basic KEM encapsulate / decapsulate pair returning[enc, sharedSecret].Encap(pkR, kpE)— a sender-supplied-ephemeral variant used by the OHTTP test vectors and any deterministic KAT.AuthEncap/AuthDecap— the authenticated variant used bymode_auth/mode_auth_psk.GeneratePrivateKey/DeriveKeyPair(ikm)— fresh and deterministic key generation respectively.SerializePublicKey/DeserializePublicKey/SerializePrivateKey/DeserializePrivateKey— the KEM-specific wire encoding.getEncryptionSize— the byte-length of theencoutput, used by the facade to allocate space.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
KEM
public KEM()
-