Sender


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

A class for sending HPKE messages.

Summary

Nested classes
open

A builder for HPKE Sender objects.

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

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

open ByteArray

Returns the encapsulated ephemeral key created for this Sender.

open Provider

Returns the Provider being used by this Sender.

open HpkeSpi

Returns the HpkeSpi being used by this Sender.

open ByteArray
seal(plaintext: ByteArray, aad: ByteArray?)

Seals a message, using the internal key schedule maintained by this Sender.

Public methods

export

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

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

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

getEncapsulated

open fun getEncapsulated(): ByteArray

Returns the encapsulated ephemeral key created for this Sender.

Return
ByteArray the encapsulated key.
This value cannot be null.

getProvider

open fun getProvider(): Provider

Returns the Provider being used by this Sender.

Return
Provider the Provider.
This value cannot be null.

getSpi

open fun getSpi(): HpkeSpi

Returns the HpkeSpi being used by this Sender.

Return
HpkeSpi the SPI.
This value cannot be null.

seal

open fun seal(
    plaintext: ByteArray,
    aad: ByteArray?
): ByteArray

Seals a message, using the internal key schedule maintained by this Sender.

Parameters
plaintext ByteArray: the plaintext.
This value cannot be null.
aad ByteArray?: optional additional authenticated data, may be null or empty
Return
ByteArray the ciphertext.
This value cannot be null.

See Also