tuweni / org.apache.tuweni.crypto.sodium / AES256GCM / encryptDetached

encryptDetached

fun encryptDetached(message: Bytes, nonce: Nonce): DetachedEncryptionResult (source)
fun encryptDetached(message: ByteArray, nonce: Nonce): DetachedEncryptionResult (source)

Encrypt a message, generating a detached message authentication code.

Parameters

message - The message to encrypt.

nonce - A unique nonce.

Return
The encrypted data and message authentication code.

fun encryptDetached(message: Bytes, data: Bytes, nonce: Nonce): DetachedEncryptionResult (source)
fun encryptDetached(message: ByteArray, data: ByteArray, nonce: Nonce): DetachedEncryptionResult (source)

Encrypt a message, generating a detached message authentication code.

Parameters

message - The message to encrypt.

data - Extra non-confidential data that will be included with the encrypted payload.

nonce - A unique nonce.

Return
The encrypted data and message authentication code.

static fun encryptDetached(message: Bytes, key: Key, nonce: Nonce): DetachedEncryptionResult (source)
static fun encryptDetached(message: ByteArray, key: Key, nonce: Nonce): DetachedEncryptionResult (source)

Encrypt a message for a given key, generating a detached message authentication code.

Parameters

message - The message to encrypt.

key - The key to encrypt for.

nonce - A unique nonce.

Return
The encrypted data and message authentication code.

static fun encryptDetached(message: Bytes, data: Bytes, key: Key, nonce: Nonce): DetachedEncryptionResult (source)

Encrypt a message for a given key, generating a detached message authentication code.

Parameters

message - The message to encrypt.

data - Extra non-confidential data that will be included with the encrypted payload.

key - The key to encrypt for.

nonce - A unique nonce.

Return
The encrypted data and message authentication code.

static fun encryptDetached(message: ByteArray, data: ByteArray, key: Key, nonce: Nonce): DetachedEncryptionResult (source)

Encrypt a message for a given key, generating a detached message authentication code.

Parameters

message - The message to encrypt.

data - Extra non-confidential data that will be included with the encrypted payload.

key - The key to encrypt for.

nonce - A unique nonce.

Exceptions

UnsupportedOperationException - If AES256-GSM support is not available.

Return
The encrypted data and message authentication code.