Package: org.conscrypt

HpkeContext

public abstract class HpkeContext
Hybrid Public Key Encryption (HPKE) sender APIs.

Base class for HPKE sender and recipient contexts.

This is the client API for HPKE usage, all operations are delegated to an implementation class implementing HpkeSpi which is located using the JCA Provider mechanism.

The implementation maintains the context for an HPKE exchange, including the key schedule to use for seal and open operations. Secret key material based on the context may also be generated and exported as per RFC 9180.

See: RFC 9180 (HPKE)

Public Methods

export

public byte[] export(int length, byte[] context)
Exports secret key material from this HpkeContext as described in RFC 9180.
Parameters
length expected output length
context optional context string, may be null or empty
Returns
byte[] exported value
Throws
IllegalArgumentException if the length is not valid for the KDF in use
IllegalStateException if this HpkeContext has not been initialised

getSpi

public HpkeSpi getSpi()
Returns the HpkeSpi being used by this HpkeContext.
Returns
org.conscrypt.HpkeSpi the SPI