JweProcessor

Core abstraction for JWE (encrypted JWT) key encryption and decryption.

Combines the JweEncryptor and JweDecryptor functional interfaces and associates them with an EncryptionAlgorithm and an optional key ID. Implementations are supplied to co.touchlab.kjwt.builder.JwtBuilder for token encryption and to co.touchlab.kjwt.parser.JwtParserBuilder for token decryption.

See also

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The JWE key-encryption algorithm this processor implements.

Link copied to clipboard
abstract val keyId: String?

The optional key ID (kid) associated with the key material used by this processor.

Functions

Link copied to clipboard
abstract suspend fun decrypt(aad: ByteArray, encryptedKey: ByteArray, iv: ByteArray, data: ByteArray, tag: ByteArray, contentAlgorithm: EncryptionContentAlgorithm): ByteArray

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

Link copied to clipboard
abstract suspend fun encrypt(data: ByteArray, aad: ByteArray, contentAlgorithm: EncryptionContentAlgorithm): JweEncryptResult

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

Link copied to clipboard

Merges this BaseJweProcessor with other, producing a combined JweProcessor that supports both encryption and decryption.