Recipient.Builder


public static class Recipient.Builder
extends Object

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


A builder for HPKE Recipient objects.

Summary

Public constructors

Builder(Hpke hpke, byte[] encapsulated, PrivateKey recipientKey)

Creates the builder.

Public methods

Recipient build()

Builds the Recipient.

Recipient.Builder setApplicationInfo(byte[] applicationInfo)

Adds optional application-related data which will be used during the key generation process.

Recipient.Builder setPsk(byte[] psk, byte[] pskId)

Sets pre-shared key information to be used for message authentication.

Recipient.Builder setSenderKey(PublicKey senderKey)

Sets the sender key to be used by the recipient for message authentication.

Inherited methods

Public constructors

Builder

public Builder (Hpke hpke, 
                byte[] encapsulated, 
                PrivateKey recipientKey)

Creates the builder.

Parameters
hpke Hpke: This value cannot be null.

encapsulated byte: encapsulated ephemeral key from an Sender
This value cannot be null.

recipientKey PrivateKey: private key of the recipient.
This value cannot be null.

Public methods

build

public Recipient build ()

Builds the Recipient.

Returns
Recipient the Recipient.
This value cannot be null.

Throws
UnsupportedOperationException if this Provider does not support the expected mode
InvalidKeyException if the sender or recipient key are unsupported

setApplicationInfo

public Recipient.Builder setApplicationInfo (byte[] applicationInfo)

Adds optional application-related data which will be used during the key generation process.

Parameters
applicationInfo byte: application-specific information.
This value cannot be null.

Returns
Recipient.Builder the Builder.
This value cannot be null.

setPsk

public Recipient.Builder setPsk (byte[] psk, 
                byte[] pskId)

Sets pre-shared key information to be used for message authentication.

Parameters
psk byte: the pre-shared secret key.
This value cannot be null.

pskId byte: the id of the pre-shared key.
This value cannot be null.

Returns
Recipient.Builder the Builder.
This value cannot be null.

setSenderKey

public Recipient.Builder setSenderKey (PublicKey senderKey)

Sets the sender key to be used by the recipient for message authentication.

Parameters
senderKey PublicKey: the sender's public key.
This value cannot be null.

Returns
Recipient.Builder the Builder.
This value cannot be null.