Class HpkeContext
java.lang.Object
org.conscrypt.HpkeContext
- Direct Known Subclasses:
HpkeContextRecipient, HpkeContextSender
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 Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]export(int length, byte[] context) Exports secret key material from this HpkeContext as described in RFC 9180.private static ProviderfindFirstProvider(String algorithm) protected static HpkeSpiprotected static HpkeSpiprotected static HpkeSpigetSpi()Returns theHpkeSpibeing used by this HpkeContext.
-
Field Details
-
spi
-
-
Constructor Details
-
HpkeContext
-
-
Method Details
-
export
public byte[] export(int length, byte[] context) Exports secret key material from this HpkeContext as described in RFC 9180.- Parameters:
length- expected output lengthcontext- optional context string, may be null or empty- Returns:
- exported value
- Throws:
IllegalArgumentException- if the length is not valid for the KDF in useIllegalStateException- if this HpkeContext has not been initialised
-
getSpi
-
findSpi
- Throws:
NoSuchAlgorithmException
-
findFirstProvider
- Throws:
NoSuchAlgorithmException
-
findSpi
protected static HpkeSpi findSpi(String algorithm, String providerName) throws NoSuchAlgorithmException, IllegalArgumentException, NoSuchProviderException -
findSpi
protected static HpkeSpi findSpi(String algorithm, Provider provider) throws NoSuchAlgorithmException, IllegalArgumentException
-