tuweni / org.apache.tuweni.crypto.sodium / Box / encryptSealed

encryptSealed

static fun encryptSealed(message: Bytes!, receiver: PublicKey!): Bytes! (source)

Encrypt a sealed message for a given key.

Sealed boxes are designed to anonymously send messages to a recipient given its public key.

Only the recipient can decrypt these messages, using its private key. While the recipient can verify the integrity of the message, it cannot verify the identity of the sender.

A message is encrypted using an ephemeral key pair, whose secret part is destroyed right after the encryption process.

Without knowing the secret key used for a given message, the sender cannot decrypt its own message later. And without additional data, a message cannot be correlated with the identity of its sender.

Parameters

message - Bytes!: The message to encrypt.

receiver - PublicKey!: The public key of the receiver.

Return
Bytes!: The encrypted data.

static fun encryptSealed(message: ByteArray!, receiver: PublicKey!): ByteArray! (source)

Encrypt a sealed message for a given key.

Sealed boxes are designed to anonymously send messages to a recipient given its public key.

Only the recipient can decrypt these messages, using its private key. While the recipient can verify the integrity of the message, it cannot verify the identity of the sender.

A message is encrypted using an ephemeral key pair, whose secret part is destroyed right after the encryption process.

Without knowing the secret key used for a given message, the sender cannot decrypt its own message later. And without additional data, a message cannot be correlated with the identity of its sender.

Parameters

message - ByteArray!: The message to encrypt.

receiver - PublicKey!: The public key of the receiver.

Return
ByteArray!: The encrypted data.