encrypt

abstract suspend fun encrypt(data: ByteArray, aad: ByteArray, contentAlgorithm: EncryptionContentAlgorithm): JweEncryptResult(source)

Encrypts data using the given contentAlgorithm and returns the full JWE encryption result.

Return

the JweEncryptResult containing the encrypted key, IV, ciphertext, and authentication tag

Parameters

data

the plaintext payload bytes to encrypt

aad

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

contentAlgorithm

the content encryption algorithm to use for encrypting data