android-components / mozilla.components.lib.dataprotect / Keystore / createDecryptCipher

createDecryptCipher

fun createDecryptCipher(iv: ByteArray): Cipher (source)

Create a cipher initialized for decrypting data with the managed key.

This "low-level" method is useful when a cryptographic context is needed to integrate with other APIs, such as the FingerprintManager.

NOTE: The caller is responsible for associating certain encryption factors, such as the initialization vector and/or additional authentication data (AAD), with the stored ciphertext or decryption will fail.

Parameters

iv - The initialization vector/nonce to decrypt with

Exceptions

InvalidKeyException - If the key is not found, or is not a SecretKey

IllegalArgumentException - If iv is null or invalid (e.g., not 12 bytes in length)

Return
The Cipher, initialized and ready to decrypt data with.