Package-level declarations

Functions

Link copied to clipboard

Registers a pre-built EncryptionKey.DecryptionOnlyKey for JWE token decryption.

Registers a pre-built EncryptionKey.EncryptionKeyPair for JWE token decryption.

fun JwtParserBuilder.decryptWith(algorithm: EncryptionAlgorithm, privateKey: Key, keyId: String? = null): JwtParserBuilder

Registers a raw Key for JWE token decryption using any EncryptionAlgorithm.

Registers a direct (dir) SimpleKey symmetric key for JWE decryption.

Registers an RSA-OAEP (RSA-OAEP / RSA-OAEP-256) private key for JWE decryption.

Registers a direct key (dir) for JWE decryption from a raw ByteArray.

Registers a direct key (dir) for JWE decryption from a UTF-8 String.

suspend fun JwtParserBuilder.decryptWith(algorithm: EncryptionAlgorithm.OAEPBased, jwk: Jwk.Rsa, keyId: String? = jwk.kid, cryptoProvider: CryptographyProvider = CryptographyProvider.Default): JwtParserBuilder

Configures the parser to decrypt JWE tokens using an RSA OAEP private key derived from the given Jwk.Rsa JWK.

Link copied to clipboard
suspend fun JwtBuilder.encryptWith(key: EncryptionKey.EncryptionKeyPair, contentAlgorithm: EncryptionContentAlgorithm, keyId: String? = key.identifier.keyId): JwtInstance.Jwe

Builds and returns a JWE compact serialization using a pre-built EncryptionKey.EncryptionKeyPair.

suspend fun JwtBuilder.encryptWith(key: EncryptionKey.EncryptionOnlyKey, contentAlgorithm: EncryptionContentAlgorithm, keyId: String? = key.identifier.keyId): JwtInstance.Jwe

Builds and returns a JWE compact serialization using a pre-built EncryptionKey.EncryptionOnlyKey.

suspend fun JwtBuilder.encryptWith(key: SimpleKey, keyAlgorithm: EncryptionAlgorithm.Dir, contentAlgorithm: EncryptionContentAlgorithm, keyId: String? = null): JwtInstance.Jwe

Encrypts the JWT using a direct (dir) SimpleKey symmetric key.

Encrypts the JWT using an RSA-OAEP (RSA-OAEP / RSA-OAEP-256) public key.

suspend fun JwtBuilder.encryptWith(key: Key, keyAlgorithm: EncryptionAlgorithm, contentAlgorithm: EncryptionContentAlgorithm, keyId: String? = null): JwtInstance.Jwe

Encrypts the JWT using any EncryptionAlgorithm and raw Key.

suspend fun JwtBuilder.encryptWith(key: ByteArray, keyAlgorithm: EncryptionAlgorithm.Dir, contentAlgorithm: EncryptionContentAlgorithm, keyId: String? = null): JwtInstance.Jwe

Encrypts the JWT using the direct key algorithm (dir) with a raw key supplied as a ByteArray.

suspend fun JwtBuilder.encryptWith(key: String, keyAlgorithm: EncryptionAlgorithm.Dir, contentAlgorithm: EncryptionContentAlgorithm, keyId: String? = null): JwtInstance.Jwe

Encrypts the JWT using the direct key algorithm (dir) with a key supplied as a UTF-8 String.

suspend fun JwtBuilder.encryptWith(jwk: Jwk.Rsa, keyAlgorithm: EncryptionAlgorithm.OAEPBased, contentAlgorithm: EncryptionContentAlgorithm, keyId: String? = jwk.kid, cryptoProvider: CryptographyProvider = CryptographyProvider.Default): JwtInstance.Jwe

Encrypts the JWT using an RSA OAEP public key derived from the given Jwk.Rsa JWK.

Link copied to clipboard

Looks up the existing BaseJweProcessor for the algorithm and key ID in key's identifier, then merges key with that existing processor.

Link copied to clipboard

Looks up the existing BaseJwsProcessor for the algorithm and key ID in key's identifier, then merges key with that existing processor.

Link copied to clipboard
suspend fun Jwk.Thumbprint.hashed(jsonInstance: Json = Jwt.defaultJsonParser, cryptoProvider: CryptographyProvider = CryptographyProvider.Default): String

Computes the base64url-encoded SHA-256 hash of this JWK Thumbprint as defined by RFC 7638.

Link copied to clipboard

Returns the JwtDigest implied by the JWK's Jwk.alg field, or null if absent/unrecognised.

Link copied to clipboard

Wraps an existing raw key ByteArray as a Dir encryption key.

Link copied to clipboard

Generates a new random symmetric key for use with the dir algorithm.

suspend fun SigningAlgorithm.ECDSABased.newKey(keyId: String? = null, cryptographyProvider: CryptographyProvider = CryptographyProvider.Default): SigningKey.SigningKeyPair

Generates a new ECDSA key pair for use with this algorithm.

suspend fun SigningAlgorithm.MACBased.newKey(keyId: String? = null, cryptographyProvider: CryptographyProvider = CryptographyProvider.Default): SigningKey.SigningKeyPair

Generates a new random HMAC key for use with this algorithm.

suspend fun EncryptionAlgorithm.OAEPBased.newKey(keyId: String? = null, keySize: BinarySize = 2048.bits, publicExponent: BigInt = 65537.toBigInt(), cryptographyProvider: CryptographyProvider = CryptographyProvider.Default): EncryptionKey.EncryptionKeyPair

Generates a new RSA-OAEP key pair for use with this algorithm.

suspend fun SigningAlgorithm.PKCS1Based.newKey(keyId: String? = null, keySize: BinarySize = 2048.bits, publicExponent: BigInt = 65537.toBigInt(), cryptographyProvider: CryptographyProvider = CryptographyProvider.Default): SigningKey.SigningKeyPair

Generates a new RSA PKCS#1 v1.5 key pair for use with this algorithm.

suspend fun SigningAlgorithm.PSSBased.newKey(keyId: String? = null, keySize: BinarySize = 2048.bits, publicExponent: BigInt = 65537.toBigInt(), cryptographyProvider: CryptographyProvider = CryptographyProvider.Default): SigningKey.SigningKeyPair

Generates a new RSA PSS key pair for use with this algorithm.

Link copied to clipboard
suspend fun SigningAlgorithm.MACBased.parse(key: ByteArray, keyId: String? = null, format: HMAC.Key.Format = HMAC.Key.Format.RAW, cryptographyProvider: CryptographyProvider = CryptographyProvider.Default): SigningKey.SigningKeyPair

Decodes an existing HMAC key from a ByteArray for use with this algorithm.

Link copied to clipboard
suspend fun EncryptionAlgorithm.OAEPBased.parseKeyPair(publicKey: ByteArray, privateKey: ByteArray, keyId: String? = null, publicKeyFormat: RSA.PublicKey.Format = RSA.PublicKey.Format.PEM, privateKeyFormat: RSA.PrivateKey.Format = RSA.PrivateKey.Format.PEM, cryptographyProvider: CryptographyProvider = CryptographyProvider.Default): EncryptionKey.EncryptionKeyPair

Decodes an RSA-OAEP key pair from separate public and private key ByteArrays.

suspend fun SigningAlgorithm.ECDSABased.parseKeyPair(publicKey: ByteArray, privateKey: ByteArray, keyId: String? = null, publicKeyFormat: EC.PublicKey.Format = EC.PublicKey.Format.RAW, privateKeyFormat: EC.PrivateKey.Format = EC.PrivateKey.Format.RAW, cryptographyProvider: CryptographyProvider = CryptographyProvider.Default): SigningKey.SigningKeyPair

Decodes an ECDSA key pair from separate public and private key ByteArrays.

suspend fun SigningAlgorithm.PKCS1Based.parseKeyPair(publicKey: ByteArray, privateKey: ByteArray, keyId: String? = null, publicKeyFormat: RSA.PublicKey.Format = RSA.PublicKey.Format.PEM, privateKeyFormat: RSA.PrivateKey.Format = RSA.PrivateKey.Format.PEM, cryptographyProvider: CryptographyProvider = CryptographyProvider.Default): SigningKey.SigningKeyPair

Decodes an RSA PKCS#1 v1.5 key pair from separate public and private key ByteArrays.

suspend fun SigningAlgorithm.PSSBased.parseKeyPair(publicKey: ByteArray, privateKey: ByteArray, keyId: String? = null, publicKeyFormat: RSA.PublicKey.Format = RSA.PublicKey.Format.PEM, privateKeyFormat: RSA.PrivateKey.Format = RSA.PrivateKey.Format.PEM, cryptographyProvider: CryptographyProvider = CryptographyProvider.Default): SigningKey.SigningKeyPair

Decodes an RSA PSS key pair from separate public and private key ByteArrays.

Link copied to clipboard
suspend fun EncryptionAlgorithm.OAEPBased.parsePrivateKey(key: ByteArray, keyId: String? = null, format: RSA.PrivateKey.Format = RSA.PrivateKey.Format.PEM, cryptographyProvider: CryptographyProvider = CryptographyProvider.Default): EncryptionKey.DecryptionOnlyKey

Decodes an RSA-OAEP private key from a ByteArray for use with this algorithm.

suspend fun SigningAlgorithm.ECDSABased.parsePrivateKey(key: ByteArray, keyId: String? = null, format: EC.PrivateKey.Format = EC.PrivateKey.Format.RAW, cryptographyProvider: CryptographyProvider = CryptographyProvider.Default): SigningKey.SigningOnlyKey

Decodes an ECDSA private key from a ByteArray for use with this algorithm.

suspend fun SigningAlgorithm.PKCS1Based.parsePrivateKey(key: ByteArray, keyId: String? = null, format: RSA.PrivateKey.Format = RSA.PrivateKey.Format.PEM, cryptographyProvider: CryptographyProvider = CryptographyProvider.Default): SigningKey.SigningOnlyKey

Decodes an RSA PKCS#1 v1.5 private key from a ByteArray for use with this algorithm.

suspend fun SigningAlgorithm.PSSBased.parsePrivateKey(key: ByteArray, keyId: String? = null, format: RSA.PrivateKey.Format = RSA.PrivateKey.Format.PEM, cryptographyProvider: CryptographyProvider = CryptographyProvider.Default): SigningKey.SigningOnlyKey

Decodes an RSA PSS private key from a ByteArray for use with this algorithm.

Link copied to clipboard
suspend fun EncryptionAlgorithm.OAEPBased.parsePublicKey(key: ByteArray, keyId: String? = null, format: RSA.PublicKey.Format = RSA.PublicKey.Format.PEM, cryptographyProvider: CryptographyProvider = CryptographyProvider.Default): EncryptionKey.EncryptionOnlyKey

Decodes an RSA-OAEP public key from a ByteArray for use with this algorithm.

suspend fun SigningAlgorithm.ECDSABased.parsePublicKey(key: ByteArray, keyId: String? = null, format: EC.PublicKey.Format = EC.PublicKey.Format.RAW, cryptographyProvider: CryptographyProvider = CryptographyProvider.Default): SigningKey.VerifyOnlyKey

Decodes an ECDSA public key from a ByteArray for use with this algorithm.

suspend fun SigningAlgorithm.PKCS1Based.parsePublicKey(key: ByteArray, keyId: String? = null, format: RSA.PublicKey.Format = RSA.PublicKey.Format.PEM, cryptographyProvider: CryptographyProvider = CryptographyProvider.Default): SigningKey.VerifyOnlyKey

Decodes an RSA PKCS#1 v1.5 public key from a ByteArray for use with this algorithm.

suspend fun SigningAlgorithm.PSSBased.parsePublicKey(key: ByteArray, keyId: String? = null, format: RSA.PublicKey.Format = RSA.PublicKey.Format.PEM, cryptographyProvider: CryptographyProvider = CryptographyProvider.Default): SigningKey.VerifyOnlyKey

Decodes an RSA PSS public key from a ByteArray for use with this algorithm.

Link copied to clipboard

Registers an EncryptionKey in this registry, merging it with any existing processor for the same algorithm and key ID.

Registers any EncryptionKey variant for JWE token decryption, merging it with any previously registered processor for the same algorithm and key ID.

Link copied to clipboard

Registers a SigningKey in this registry, merging it with any existing processor for the same algorithm and key ID.

Registers any SigningKey variant for JWS signature verification, merging it with any previously registered processor for the same algorithm and key ID.

Link copied to clipboard
suspend fun JwtBuilder.signWith(key: SigningKey.SigningKeyPair, keyId: String? = key.identifier.keyId): JwtInstance.Jws

Builds and returns a JWS compact serialization using a pre-built SigningKey.SigningKeyPair.

suspend fun JwtBuilder.signWith(key: SigningKey.SigningOnlyKey, keyId: String? = key.identifier.keyId): JwtInstance.Jws

Builds and returns a JWS compact serialization using a pre-built SigningKey.SigningOnlyKey.

suspend fun JwtBuilder.signWith(algorithm: SigningAlgorithm, key: Key, keyId: String? = null): JwtInstance.Jws

Signs the JWT using any SigningAlgorithm and raw Key.

Signs the JWT using an ECDSA (ES256/384/512) private key.

suspend fun JwtBuilder.signWith(algorithm: SigningAlgorithm.MACBased, key: HMAC.Key, keyId: String? = null): JwtInstance.Jws

Signs the JWT using an HMAC (HS256/384/512) symmetric key.

Signs the JWT using an RSA PKCS#1 (RS256/384/512) private key.

Signs the JWT using an RSA PSS (PS256/384/512) private key.

suspend fun JwtBuilder.signWith(algorithm: SigningAlgorithm.ECDSABased, jwk: Jwk.Ec, keyId: String? = jwk.kid, cryptoProvider: CryptographyProvider = CryptographyProvider.Default): JwtInstance.Jws

Signs the JWT using an ECDSA private key derived from the given Jwk.Ec JWK.

suspend fun JwtBuilder.signWith(algorithm: SigningAlgorithm.MACBased, jwk: Jwk.Oct, keyId: String? = jwk.kid, cryptoProvider: CryptographyProvider = CryptographyProvider.Default): JwtInstance.Jws

Signs the JWT using an HMAC key derived from the given Jwk.Oct symmetric JWK.

suspend fun JwtBuilder.signWith(algorithm: SigningAlgorithm.PKCS1Based, jwk: Jwk.Rsa, keyId: String? = jwk.kid, cryptoProvider: CryptographyProvider = CryptographyProvider.Default): JwtInstance.Jws

Signs the JWT using an RSA PKCS#1 private key derived from the given Jwk.Rsa JWK.

suspend fun JwtBuilder.signWith(algorithm: SigningAlgorithm.PSSBased, jwk: Jwk.Rsa, keyId: String? = jwk.kid, cryptoProvider: CryptographyProvider = CryptographyProvider.Default): JwtInstance.Jws

Signs the JWT using an RSA PSS private key derived from the given Jwk.Rsa JWK.

suspend fun JwtBuilder.signWith(algorithm: SigningAlgorithm.ECDSABased, key: String, keyFormat: EC.PrivateKey.Format, keyId: String? = null, cryptoProvider: CryptographyProvider = CryptographyProvider.Default): JwtInstance.Jws

Signs the JWT using an ECDSA algorithm with a private key decoded from a String.

suspend fun JwtBuilder.signWith(algorithm: SigningAlgorithm.MACBased, key: String, keyFormat: HMAC.Key.Format, keyId: String? = null, cryptoProvider: CryptographyProvider = CryptographyProvider.Default): JwtInstance.Jws

Signs the JWT using an HMAC algorithm with a key decoded from a String.

suspend fun JwtBuilder.signWith(algorithm: SigningAlgorithm.PKCS1Based, key: String, keyFormat: RSA.PrivateKey.Format, keyId: String? = null, cryptoProvider: CryptographyProvider = CryptographyProvider.Default): JwtInstance.Jws

Signs the JWT using an RSA PKCS#1 algorithm with a private key decoded from a String.

suspend fun JwtBuilder.signWith(algorithm: SigningAlgorithm.PSSBased, key: String, keyFormat: RSA.PrivateKey.Format, keyId: String? = null, cryptoProvider: CryptographyProvider = CryptographyProvider.Default): JwtInstance.Jws

Signs the JWT using an RSA PSS algorithm with a private key decoded from a String.

Link copied to clipboard
suspend fun Jwk.Ec.toEcdsaPrivateKey(cryptoProvider: CryptographyProvider = CryptographyProvider.Default): ECDSA.PrivateKey

Converts this Jwk.Ec to an ECDSA.PrivateKey for ES256/ES384/ES512 signing.

Link copied to clipboard
suspend fun Jwk.Ec.toEcdsaPublicKey(cryptoProvider: CryptographyProvider = CryptographyProvider.Default): ECDSA.PublicKey

Converts this Jwk.Ec to an ECDSA.PublicKey for ES256/ES384/ES512 signature verification.

Link copied to clipboard
suspend fun Jwk.Oct.toHmacKey(digest: CryptographyAlgorithmId<Digest>, cryptoProvider: CryptographyProvider = CryptographyProvider.Default): HMAC.Key

Converts this Jwk.Oct to an HMAC.Key for the given digest.

Link copied to clipboard
suspend fun Jwk.Rsa.toRsaOaepPrivateKey(digest: CryptographyAlgorithmId<Digest>, cryptoProvider: CryptographyProvider = CryptographyProvider.Default): RSA.OAEP.PrivateKey

Converts this Jwk.Rsa to an RSA.OAEP.PrivateKey for RSA-OAEP / RSA-OAEP-256 key decryption.

Link copied to clipboard
suspend fun Jwk.Rsa.toRsaOaepPublicKey(digest: CryptographyAlgorithmId<Digest>, cryptoProvider: CryptographyProvider = CryptographyProvider.Default): RSA.OAEP.PublicKey

Converts this Jwk.Rsa to an RSA.OAEP.PublicKey for RSA-OAEP / RSA-OAEP-256 key encryption.

Link copied to clipboard
suspend fun Jwk.Rsa.toRsaPkcs1PrivateKey(digest: CryptographyAlgorithmId<Digest>, cryptoProvider: CryptographyProvider = CryptographyProvider.Default): RSA.PKCS1.PrivateKey

Converts this Jwk.Rsa to an RSA.PKCS1.PrivateKey for RS256/RS384/RS512 signing.

Link copied to clipboard
suspend fun Jwk.Rsa.toRsaPkcs1PublicKey(digest: CryptographyAlgorithmId<Digest>, cryptoProvider: CryptographyProvider = CryptographyProvider.Default): RSA.PKCS1.PublicKey

Converts this Jwk.Rsa to an RSA.PKCS1.PublicKey for RS256/RS384/RS512 signature verification.

Link copied to clipboard
suspend fun Jwk.Rsa.toRsaPssPrivateKey(digest: CryptographyAlgorithmId<Digest>, cryptoProvider: CryptographyProvider = CryptographyProvider.Default): RSA.PSS.PrivateKey

Converts this Jwk.Rsa to an RSA.PSS.PrivateKey for PS256/PS384/PS512 signing.

Link copied to clipboard
suspend fun Jwk.Rsa.toRsaPssPublicKey(digest: CryptographyAlgorithmId<Digest>, cryptoProvider: CryptographyProvider = CryptographyProvider.Default): RSA.PSS.PublicKey

Converts this Jwk.Rsa to an RSA.PSS.PublicKey for PS256/PS384/PS512 signature verification.

Link copied to clipboard

Registers a pre-built SigningKey.SigningKeyPair for JWS signature verification.

Registers a pre-built SigningKey.VerifyOnlyKey for JWS signature verification.

fun JwtParserBuilder.verifyWith(algorithm: SigningAlgorithm, key: Key, keyId: String? = null): JwtParserBuilder

Registers a raw Key for JWS signature verification using any SigningAlgorithm.

Registers an ECDSA (ES256/384/512) public key for JWS signature verification.

Registers an HMAC (HS256/384/512) symmetric key for JWS signature verification.

Registers an RSA PKCS#1 (RS256/384/512) public key for JWS signature verification.

Registers an RSA PSS (PS256/384/512) public key for JWS signature verification.

suspend fun JwtParserBuilder.verifyWith(algorithm: SigningAlgorithm.ECDSABased, jwk: Jwk.Ec, keyId: String? = jwk.kid, cryptoProvider: CryptographyProvider = CryptographyProvider.Default): JwtParserBuilder

Configures the parser to verify JWS signatures using an ECDSA public key derived from the given Jwk.Ec JWK.

suspend fun JwtParserBuilder.verifyWith(algorithm: SigningAlgorithm.MACBased, jwk: Jwk.Oct, keyId: String? = jwk.kid, cryptoProvider: CryptographyProvider = CryptographyProvider.Default): JwtParserBuilder

Configures the parser to verify JWS signatures using an HMAC key derived from the given Jwk.Oct JWK.

suspend fun JwtParserBuilder.verifyWith(algorithm: SigningAlgorithm.PKCS1Based, jwk: Jwk.Rsa, keyId: String? = jwk.kid, cryptoProvider: CryptographyProvider = CryptographyProvider.Default): JwtParserBuilder

Configures the parser to verify JWS signatures using an RSA PKCS#1 public key derived from the given Jwk.Rsa JWK.

suspend fun JwtParserBuilder.verifyWith(algorithm: SigningAlgorithm.PSSBased, jwk: Jwk.Rsa, keyId: String? = jwk.kid, cryptoProvider: CryptographyProvider = CryptographyProvider.Default): JwtParserBuilder

Configures the parser to verify JWS signatures using an RSA PSS public key derived from the given Jwk.Rsa JWK.

suspend fun JwtParserBuilder.verifyWith(algorithm: SigningAlgorithm.ECDSABased, key: String, keyFormat: EC.PublicKey.Format, keyId: String? = null, cryptoProvider: CryptographyProvider = CryptographyProvider.Default): JwtParserBuilder

Registers an ECDSA public key decoded from a String for JWS signature verification.

suspend fun JwtParserBuilder.verifyWith(algorithm: SigningAlgorithm.MACBased, key: String, keyFormat: HMAC.Key.Format, keyId: String? = null, cryptoProvider: CryptographyProvider = CryptographyProvider.Default): JwtParserBuilder

Registers an HMAC verification key decoded from a String.

suspend fun JwtParserBuilder.verifyWith(algorithm: SigningAlgorithm.PKCS1Based, key: String, keyFormat: RSA.PublicKey.Format, keyId: String? = null, cryptoProvider: CryptographyProvider = CryptographyProvider.Default): JwtParserBuilder

Registers an RSA PKCS#1 public key decoded from a String for JWS signature verification.

suspend fun JwtParserBuilder.verifyWith(algorithm: SigningAlgorithm.PSSBased, key: String, keyFormat: RSA.PublicKey.Format, keyId: String? = null, cryptoProvider: CryptographyProvider = CryptographyProvider.Default): JwtParserBuilder

Registers an RSA PSS public key decoded from a String for JWS signature verification.