crypto / org.apache.tuweni.crypto.sodium / XChaCha20Poly1305 / decrypt

decrypt

@Nullable static fun decrypt(cipherText: Bytes, key: Key, nonce: Nonce): Bytes? (source)
@Nullable static fun decrypt(cipherText: ByteArray, key: Key, nonce: Nonce): ByteArray? (source)

Decrypt a message using a given key.

Parameters

cipherText - The cipher text to decrypt.

key - The key to use for decryption.

nonce - The nonce that was used for encryption.

Return
The decrypted data, or null if verification failed.

@Nullable static fun decrypt(cipherText: Bytes, data: Bytes, key: Key, nonce: Nonce): Bytes? (source)

Decrypt a message using a given key.

Parameters

cipherText - The cipher text to decrypt.

data - Extra non-confidential data that is included within the encrypted payload.

key - The key to use for decryption.

nonce - The nonce that was used for encryption.

Return
The decrypted data, or null if verification failed.

@Nullable static fun decrypt(cipherText: ByteArray, data: ByteArray, key: Key, nonce: Nonce): ByteArray? (source)

Decrypt a message using a given key.

Parameters

cipherText - The cipher text to decrypt.

data - Extra non-confidential data that is included within the encrypted payload.

key - The key to use for decryption.

nonce - The nonce that was used for encryption.

Exceptions

UnsupportedOperationException - If XChaCha20Poly1305 support is not available.

Return
The decrypted data, or null if verification failed.