Package org.conscrypt
Class HpkeContext
- java.lang.Object
-
- org.conscrypt.HpkeContext
-
- Direct Known Subclasses:
HpkeContextRecipient,HpkeContextSender
public abstract class HpkeContext extends java.lang.ObjectHybrid 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
HpkeSpiwhich is located using the JCAProvidermechanism.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:
- RFC 9180 (HPKE)
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedHpkeContext(HpkeSpi spi)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]export(int length, byte[] context)Exports secret key material from this HpkeContext as described in RFC 9180.private static java.security.ProviderfindFirstProvider(java.lang.String algorithm)protected static HpkeSpifindSpi(java.lang.String algorithm)protected static HpkeSpifindSpi(java.lang.String algorithm, java.lang.String providerName)protected static HpkeSpifindSpi(java.lang.String algorithm, java.security.Provider provider)HpkeSpigetSpi()Returns theHpkeSpibeing used by this HpkeContext.
-
-
-
Field Detail
-
spi
protected final HpkeSpi spi
-
-
Constructor Detail
-
HpkeContext
protected HpkeContext(HpkeSpi spi)
-
-
Method Detail
-
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:
java.lang.IllegalArgumentException- if the length is not valid for the KDF in usejava.lang.IllegalStateException- if this HpkeContext has not been initialised
-
findSpi
protected static HpkeSpi findSpi(java.lang.String algorithm) throws java.security.NoSuchAlgorithmException
- Throws:
java.security.NoSuchAlgorithmException
-
findFirstProvider
private static java.security.Provider findFirstProvider(java.lang.String algorithm) throws java.security.NoSuchAlgorithmException- Throws:
java.security.NoSuchAlgorithmException
-
findSpi
protected static HpkeSpi findSpi(java.lang.String algorithm, java.lang.String providerName) throws java.security.NoSuchAlgorithmException, java.lang.IllegalArgumentException, java.security.NoSuchProviderException
- Throws:
java.security.NoSuchAlgorithmExceptionjava.lang.IllegalArgumentExceptionjava.security.NoSuchProviderException
-
findSpi
protected static HpkeSpi findSpi(java.lang.String algorithm, java.security.Provider provider) throws java.security.NoSuchAlgorithmException, java.lang.IllegalArgumentException
- Throws:
java.security.NoSuchAlgorithmExceptionjava.lang.IllegalArgumentException
-
-