encrypt

expect fun encrypt(algorithm: Algorithm, key: ByteArray, nonce: ByteArray, messagePlaintext: ByteArray, aad: ByteArray? = null): ByteArray

Message encryption.

Return

the cipher text with the tag appended to it.

Parameters

key

the encryption key.

nonce

the nonce/IV.

messagePlaintext

the message to encrypt.

aad

additional authenticated data or null.

Throws

if the given algorithm is not supported.

actual fun encrypt(algorithm: <Error class: unknown class>, key: ByteArray, nonce: ByteArray, messagePlaintext: ByteArray, aad: ByteArray?): ByteArray
actual fun encrypt(algorithm: Algorithm, key: ByteArray, nonce: ByteArray, messagePlaintext: ByteArray, aad: ByteArray?): ByteArray

Message encryption.

Return

the cipher text with the tag appended to it.

Parameters

key

the encryption key.

nonce

the nonce/IV.

messagePlaintext

the message to encrypt.

aad

additional authenticated data or null.

Throws

if the given algorithm is not supported.