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

encrypt

fun encrypt(message: Bytes, nonce: Nonce): Bytes (source)
fun encrypt(message: ByteArray, nonce: Nonce): ByteArray (source)

Encrypt a message for a given key.

Parameters

message - The message to encrypt.

nonce - A unique nonce.

Return
The encrypted data.

static fun encrypt(message: Bytes, receiver: PublicKey, sender: SecretKey, nonce: Nonce): Bytes (source)
static fun encrypt(message: ByteArray, receiver: PublicKey, sender: SecretKey, nonce: Nonce): ByteArray (source)

Encrypt a message for a given key.

Parameters

message - The message to encrypt.

receiver - The public key of the receiver.

sender - The secret key of the sender.

nonce - A unique nonce.

Return
The encrypted data.