encrypt
fun encrypt(claimsSet: JsonObject, recipientPublicKey: EcPublicKey, encAlg: Algorithm, apu: ByteString?, apv: ByteString?, random: Random = Random.Default, kid: String? = null, compressionLevel: Int? = null): String
Encrypts a claim set using ECDH-ES.
Reference: RFC 7518 Section 4.6 Key Agreement with Elliptic Curve Diffie-Hellman Ephemeral Static (ECDH-ES)
Return
the compact serialization of the JWE.
Parameters
claimsSet
the claims set to encrypt.
recipientPublicKey
the public key to encrypt to.
encAlg
the encryption algorithm, Algorithm.A128GCM, Algorithm.A192GCM, or Algorithm.A256GCM.
apu
agreement PartyUInfo (apu) parameter or null
.
apv
agreement PartyVInfo (apv) parameter or null
.
random
the Random used to generate a nonce.
kid
if not null
, this will be included as the value for the kid
parameter in the header.
compressionLevel
The compression level to use for DEFLATE compression or null
to not compress.