encryptWith
Encrypts the JWT using a direct (dir) SimpleKey symmetric key.
Return
the resulting JwtInstance.Jwe compact serialization
Parameters
the SimpleKey wrapping the raw symmetric content encryption key
the direct key encryption algorithm (EncryptionAlgorithm.Dir)
the content encryption algorithm to apply to the JWT payload
optional key ID to embed in the token header's kid field. Defaults to null.
Encrypts the JWT using an RSA-OAEP (RSA-OAEP / RSA-OAEP-256) public key.
Return
the resulting JwtInstance.Jwe compact serialization
Parameters
the RSA OAEP public key used to wrap the content encryption key
the OAEP-based key encryption algorithm (RSA-OAEP or RSA-OAEP-256)
the content encryption algorithm to apply to the JWT payload
optional key ID to embed in the token header's kid field. Defaults to null.
Encrypts the JWT using any EncryptionAlgorithm and raw Key.
Prefer the strongly typed overloads (e.g. encryptWith accepting RSA.OAEP.PublicKey or SimpleKey) when possible, as they enforce the correct key type at compile time.
Return
the resulting JwtInstance.Jwe compact serialization
Parameters
the raw cryptography-kotlin key to use for key encryption; must be compatible with keyAlgorithm
the JWE key-encryption algorithm to use
the content encryption algorithm to apply to the JWT payload
optional key ID to embed in the token header's kid field. Defaults to null.
Builds and returns a JWE compact serialization using a pre-built EncryptionKey.EncryptionOnlyKey.
Return
the resulting JwtInstance.Jwe compact serialization
Parameters
the encryption key used to wrap the content encryption key
the content encryption algorithm used to encrypt the payload
optional key ID to embed in the JWE header's kid field. Defaults to the key ID stored in key's identifier.
Builds and returns a JWE compact serialization using a pre-built EncryptionKey.EncryptionKeyPair.
Return
the resulting JwtInstance.Jwe compact serialization
Parameters
the encryption key used to wrap the content encryption key
the content encryption algorithm used to encrypt the payload
optional key ID to embed in the JWE header's kid field. Defaults to the key ID stored in key's identifier.
Encrypts the JWT using an RSA OAEP public key derived from the given Jwk.Rsa JWK.
Return
the encrypted JwtInstance.Jwe token
Parameters
the RSA JWK containing the public key parameters n and e
the OAEP-based key encryption algorithm (RSA-OAEP or RSA-OAEP-256)
the content encryption algorithm to use for the JWE payload
optional key ID override; when set, it is embedded in the token header's kid field. Defaults to the JWK's own kid field.
the CryptographyProvider used to decode the key; defaults to CryptographyProvider.Default
Encrypts the JWT using the direct key algorithm (dir) with a raw key supplied as a ByteArray.
Return
the encrypted JwtInstance.Jwe token.
Parameters
the raw symmetric key bytes used for direct encryption.
the direct key encryption algorithm (EncryptionAlgorithm.Dir).
the content encryption algorithm to apply to the JWT payload.
optional key ID to embed in the token header's kid field. Defaults to null.
Encrypts the JWT using the direct key algorithm (dir) with a key supplied as a UTF-8 String.
The string is converted to bytes using UTF-8 encoding before being used as the symmetric key.
Return
the encrypted JwtInstance.Jwe token.
Parameters
the symmetric key as a UTF-8 string.
the direct key encryption algorithm (EncryptionAlgorithm.Dir).
the content encryption algorithm to apply to the JWT payload.
optional key ID to embed in the token header's kid field. Defaults to null.