decrypt

suspend fun decrypt(encryptedJwt: String, recipientKey: AsymmetricKey): JsonObject

Decrypts an encrypted JWT using ECDH-ES.

Reference: RFC 7518 Section 4.6 Key Agreement with Elliptic Curve Diffie-Hellman Ephemeral Static (ECDH-ES)

Return

the decrypted claims set.

Parameters

encryptedJwt

the compact serialization of the JWE.

recipientKey

the recipients private key corresponding to the public key this was encrypted to.

Throws

if the JWE format or algorithm is invalid or unsupported.

if decryption fails.

if the key needs unlocking.

if the key is no longer usable.