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
algorithm
must be one of Algorithm.A128GCM, Algorithm.A192GCM, or Algorithm.A256GCM.
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: Algorithm, key: ByteArray, nonce: ByteArray, messagePlaintext: ByteArray, aad: ByteArray?): ByteArray
Message encryption.
Return
the cipher text with the tag appended to it.
Parameters
algorithm
must be one of Algorithm.A128GCM, Algorithm.A192GCM, Algorithm.A256GCM.
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.