Sender


public class Sender
extends Object

java.lang.Object
   ↳ android.crypto.hpke.Sender


A class for sending HPKE messages.

Summary

Nested classes

class Sender.Builder

A builder for HPKE Sender objects. 

Public methods

byte[] export(int length, byte[] context)

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

byte[] getEncapsulated()

Returns the encapsulated ephemeral key created for this Sender.

Provider getProvider()

Returns the Provider being used by this Sender.

HpkeSpi getSpi()

Returns the HpkeSpi being used by this Sender.

byte[] seal(byte[] plaintext, byte[] aad)

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

Inherited methods

Public methods

export

public byte[] export (int length, 
                byte[] context)

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

Parameters
length int: expected output length

context byte: optional exporter context string, may be null or empty

Returns
byte[] the exported value.
This value cannot be null.

Throws
IllegalArgumentException if the length is not valid for the Sender's KDF

getEncapsulated

public byte[] getEncapsulated ()

Returns the encapsulated ephemeral key created for this Sender.

Returns
byte[] the encapsulated key.
This value cannot be null.

getProvider

public Provider getProvider ()

Returns the Provider being used by this Sender.

Returns
Provider the Provider.
This value cannot be null.

getSpi

public HpkeSpi getSpi ()

Returns the HpkeSpi being used by this Sender.

Returns
HpkeSpi the SPI.
This value cannot be null.

seal

public byte[] seal (byte[] plaintext, 
                byte[] aad)

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

Parameters
plaintext byte: the plaintext.
This value cannot be null.

aad byte: optional additional authenticated data, may be null or empty

Returns
byte[] the ciphertext.
This value cannot be null.