Recipient


open class Recipient
kotlin.Any
   ↳ android.crypto.hpke.Recipient

A class for receiving HPKE messages.

Summary

Nested classes
open

A builder for HPKE Recipient objects.

Public methods
open ByteArray
export(length: Int, context: ByteArray?)

Exports secret key material from this Recipient as described in RFC 9180.

open Provider

Returns the Provider being used by this Recipient.

open HpkeSpi

Returns the HpkeSpi being used by this Recipient.

open ByteArray
open(ciphertext: ByteArray, aad: ByteArray?)

Opens a message, using the internal key schedule maintained by this Recipient.

Public methods

export

open fun export(
    length: Int,
    context: ByteArray?
): ByteArray

Exports secret key material from this Recipient as described in RFC 9180.

Parameters
length Int: expected output length
context ByteArray?: optional exporter context string, may be null or empty
Return
ByteArray exported value.
This value cannot be null.
Exceptions
java.lang.IllegalArgumentException if the length is not valid for the KDF in use

getProvider

open fun getProvider(): Provider

Returns the Provider being used by this Recipient.

Return
Provider the Provider.
This value cannot be null.

getSpi

open fun getSpi(): HpkeSpi

Returns the HpkeSpi being used by this Recipient.

Return
HpkeSpi the SPI.
This value cannot be null.

open

open fun open(
    ciphertext: ByteArray,
    aad: ByteArray?
): ByteArray

Opens a message, using the internal key schedule maintained by this Recipient.

Parameters
ciphertext ByteArray: the ciphertext.
This value cannot be null.
aad ByteArray?: optional additional authenticated data, may be null or empty
Return
ByteArray the plaintext.
This value cannot be null.
Exceptions
java.security.GeneralSecurityException on decryption failures

See Also