decrypt

abstract suspend fun decrypt(aad: ByteArray, encryptedKey: ByteArray, iv: ByteArray, data: ByteArray, tag: ByteArray, contentAlgorithm: EncryptionContentAlgorithm): ByteArray(source)

Decrypts and authenticates the JWE token components, returning the plaintext payload bytes.

Return

the decrypted plaintext payload bytes

Parameters

aad

the additional authenticated data (the ASCII encoding of the JWE Protected Header)

encryptedKey

the encrypted content encryption key bytes

iv

the initialization vector bytes

data

the ciphertext bytes to decrypt

tag

the authentication tag bytes

contentAlgorithm

the content encryption algorithm used to encrypt the payload

Throws

if authentication tag verification fails