hpkeEncrypt

expect fun hpkeEncrypt(cipherSuite: Algorithm, receiverPublicKey: EcPublicKey, plainText: ByteArray, aad: ByteArray): Pair<ByteArray, EcPublicKey>

Encrypts data using HPKE according to RFC 9180.

The resulting ciphertext and encapsulated key should be sent to the receiver and both parties must also agree on the AAD used.

Return

the ciphertext and the encapsulated key.

Parameters

cipherSuite

the cipher suite for selecting the KEM, KDF, and encryption algorithm. Presently only Algorithm.HPKE_BASE_P256_SHA256_AES128GCM is supported.

receiverPublicKey

the public key of the receiver, curve must match the cipher suite.

plainText

the data to encrypt.

aad

additional authenticated data.

actual fun hpkeEncrypt(cipherSuite: <Error class: unknown class>, receiverPublicKey: <Error class: unknown class>, plainText: ByteArray, aad: ByteArray): Pair<ByteArray, <Error class: unknown class>>
actual fun hpkeEncrypt(cipherSuite: Algorithm, receiverPublicKey: EcPublicKey, plainText: ByteArray, aad: ByteArray): Pair<ByteArray, EcPublicKey>

Encrypts data using HPKE according to RFC 9180.

The resulting ciphertext and encapsulated key should be sent to the receiver and both parties must also agree on the AAD used.

Return

the ciphertext and the encapsulated key.

Parameters

cipherSuite

the cipher suite for selecting the KEM, KDF, and encryption algorithm. Presently only Algorithm.HPKE_BASE_P256_SHA256_AES128GCM is supported.

receiverPublicKey

the public key of the receiver, curve must match the cipher suite.

plainText

the data to encrypt.

aad

additional authenticated data.