@ThreadSafe public final class HpkeContext extends Object
https://www.rfc-editor.org/rfc/rfc9180.html#name-creating-the-encryption-con
| Modifier and Type | Method and Description |
|---|---|
static HpkeContext |
createAuthRecipientContext(byte[] encapsulatedKey,
HpkeKemPrivateKey recipientPrivateKey,
HpkeKem kem,
HpkeKdf kdf,
HpkeAead aead,
byte[] info,
HpkePublicKey senderPublicKey)
Creates HPKE recipient context with authentication according to KeySchedule() defined in
https://www.rfc-editor.org/rfc/rfc9180.html#section-5.1.3.
|
static HpkeContext |
createAuthSenderContext(HpkePublicKey recipientPublicKey,
HpkeKem kem,
HpkeKdf kdf,
HpkeAead aead,
byte[] info,
HpkeKemPrivateKey senderPrivateKey)
Creates HPKE sender context with authentication according to KeySchedule() defined in
https://www.rfc-editor.org/rfc/rfc9180.html#section-5.1.3.
|
static HpkeContext |
createRecipientContext(byte[] encapsulatedKey,
HpkeKemPrivateKey recipientPrivateKey,
HpkeKem kem,
HpkeKdf kdf,
HpkeAead aead,
byte[] info)
Creates HPKE sender recipient context according to KeySchedule() defined in
https://www.rfc-editor.org/rfc/rfc9180.html#section-5.1-9.
|
byte[] |
getEncapsulatedKey() |
byte[] |
open(byte[] ciphertext,
byte[] associatedData)
Performs AEAD decryption of
ciphertext with associatedData according to
ContextR.Open() defined in https://www.rfc-editor.org/rfc/rfc9180.html#section-5.2-10. |
byte[] |
seal(byte[] plaintext,
byte[] associatedData)
Performs AEAD encryption of
plaintext with associatedData according to
ContextS.Seal() defined in https://www.rfc-editor.org/rfc/rfc9180.html#section-5.2-8. |
public static HpkeContext createAuthSenderContext(HpkePublicKey recipientPublicKey, HpkeKem kem, HpkeKdf kdf, HpkeAead aead, byte[] info, HpkeKemPrivateKey senderPrivateKey) throws GeneralSecurityException
recipientPublicKey - recipient's public key (pkR)kem - key encapsulation mechanism primitivekdf - key derivation function primitiveaead - authenticated encryption with associated data primitiveinfo - application-specific information parameter to influence key generationsenderPrivateKey - sender's private key (skS)GeneralSecurityExceptionpublic static HpkeContext createRecipientContext(byte[] encapsulatedKey, HpkeKemPrivateKey recipientPrivateKey, HpkeKem kem, HpkeKdf kdf, HpkeAead aead, byte[] info) throws GeneralSecurityException
encapsulatedKey - encapsulated key (enc)recipientPrivateKey - recipient's private key (skR)kem - key encapsulation mechanism primitivekdf - key derivation function primitiveaead - authenticated encryption with associated data primitiveinfo - application-specific information parameter to influence key generationGeneralSecurityExceptionpublic static HpkeContext createAuthRecipientContext(byte[] encapsulatedKey, HpkeKemPrivateKey recipientPrivateKey, HpkeKem kem, HpkeKdf kdf, HpkeAead aead, byte[] info, HpkePublicKey senderPublicKey) throws GeneralSecurityException
encapsulatedKey - encapsulated key (enc)recipientPrivateKey - recipient's private key (skR)kem - key encapsulation mechanism primitivekdf - key derivation function primitiveaead - authenticated encryption with associated data primitiveinfo - application-specific information parameter to influence key generationsenderPublicKey - sender's public key (pkS)GeneralSecurityExceptionpublic byte[] getEncapsulatedKey()
public byte[] seal(byte[] plaintext,
byte[] associatedData)
throws GeneralSecurityException
plaintext with associatedData according to
ContextS.Seal() defined in https://www.rfc-editor.org/rfc/rfc9180.html#section-5.2-8.GeneralSecurityExceptionpublic byte[] open(byte[] ciphertext,
byte[] associatedData)
throws GeneralSecurityException
ciphertext with associatedData according to
ContextR.Open() defined in https://www.rfc-editor.org/rfc/rfc9180.html#section-5.2-10.GeneralSecurityException