Recipient


public class Recipient
extends Object

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


A class for receiving HPKE messages.

Summary

Nested classes

class Recipient.Builder

A builder for HPKE Recipient objects. 

Public methods

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

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

Provider getProvider()

Returns the Provider being used by this Recipient.

HpkeSpi getSpi()

Returns the HpkeSpi being used by this Recipient.

byte[] open(byte[] ciphertext, byte[] aad)

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

Inherited methods

Public methods

export

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

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

Parameters
length int: expected output length

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

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

Throws
IllegalArgumentException if the length is not valid for the KDF in use

getProvider

public Provider getProvider ()

Returns the Provider being used by this Recipient.

Returns
Provider the Provider.
This value cannot be null.

getSpi

public HpkeSpi getSpi ()

Returns the HpkeSpi being used by this Recipient.

Returns
HpkeSpi the SPI.
This value cannot be null.

open

public byte[] open (byte[] ciphertext, 
                byte[] aad)

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

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

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

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

Throws
GeneralSecurityException on decryption failures