Package io.smallrye.jwt.build
Interface JwtEncryption
- All Known Subinterfaces:
JwtEncryptionBuilder
public interface JwtEncryption
JWT JsonWebEncryption.
-
Method Summary
Modifier and TypeMethodDescriptionencrypt()Encrypt the claims or inner JWT with a key loaded from the location set with the "smallrye.jwt.encrypt.key.location" property or the key content set with the "smallrye.jwt.encrypt.key" property.Encrypt the claims or inner JWT with a public or secret key loaded from the custom location which can point to a PEM, JWK or JWK set keys.Encrypt the claims or inner JWT withPublicKey.Encrypt the claims or inner JWT withSecretKey.encryptWithSecret(String secret) Encrypt the claims or inner JWT with a secret key string.
-
Method Details
-
encrypt
Encrypt the claims or inner JWT withPublicKey. 'RSA-OAEP' and 'ECDH-ES+A256KW' key encryption algorithms will be used by default when public RSA or EC keys are used unless a different one has been set withJwtEncryptionBuilderor 'smallrye.jwt.new-token.key-encryption-algorithm' property. 'A256GCM' content encryption algorithm will be used unless a different one has been set withJwtEncryptionBuilderor 'smallrye.jwt.new-token.content-encryption-algorithm' property. A key of size 2048 bits or larger MUST be used with the 'RSA-OAEP' and 'RSA-OAEP-256' algorithms.- Parameters:
keyEncryptionKey- the key which encrypts the content encryption key- Returns:
- encrypted JWT token
- Throws:
JwtEncryptionException- the exception if the encryption operation has failed
-
encrypt
Encrypt the claims or inner JWT withSecretKey. 'A256KW' key encryption algorithm will be used unless a different one has been set withJwtEncryptionBuilderor 'smallrye.jwt.new-token.key-encryption-algorithm' property. 'A256GCM' content encryption algorithm will be used unless a different one has been set withJwtEncryptionBuilderor 'smallrye.jwt.new-token.content-encryption-algorithm' property.- Parameters:
keyEncryptionKey- the key which encrypts the content encryption key- Returns:
- encrypted JWT token
- Throws:
JwtEncryptionException- the exception if the encryption operation has failed
-
encrypt
Encrypt the claims or inner JWT with a public or secret key loaded from the custom location which can point to a PEM, JWK or JWK set keys. 'RSA-OAEP', 'ECDH-ES+A256KW' and 'A256KW' key encryption algorithms will be used by default when public RSA, EC or secret keys are used unless a different one has been set withJwtEncryptionBuilderor 'smallrye.jwt.new-token.key-encryption-algorithm' property. 'A256GCM' content encryption algorithm will be used unless a different one has been set withJwtEncryptionBuilderor 'smallrye.jwt.new-token.content-encryption-algorithm' property. A key of size 2048 bits or larger MUST be used with the 'RSA-OAEP' and 'RSA-OAEP-256' algorithms.- Parameters:
keyLocation- the location of the keyEncryptionKey which encrypts the content encryption key- Returns:
- encrypted JWT token
- Throws:
JwtEncryptionException- the exception if the encryption operation has failed
-
encrypt
Encrypt the claims or inner JWT with a key loaded from the location set with the "smallrye.jwt.encrypt.key.location" property or the key content set with the "smallrye.jwt.encrypt.key" property. Keys in PEM, JWK and JWK formats are supported. 'RSA-OAEP', 'ECDH-ES+A256KW' and 'A256KW' key encryption algorithms will be used by default when public RSA, EC or secret keys are used unless a different one has been set withJwtEncryptionBuilderor 'smallrye.jwt.new-token.key-encryption-algorithm' property. 'A256GCM' content encryption algorithm will be used unless a different one have been set withJwtEncryptionBuilderor 'smallrye.jwt.new-token.content-encryption-algorithm' property. A key of size 2048 bits or larger MUST be used with the 'RSA-OAEP' and 'RSA-OAEP-256' algorithms.- Returns:
- encrypted JWT token
- Throws:
JwtEncryptionException- the exception if the encryption operation has failed
-
encryptWithSecret
Encrypt the claims or inner JWT with a secret key string. 'A256KW' key encryption algorithm will be used by default unless a different one has been set withJwtEncryptionBuilderor 'smallrye.jwt.new-token.key-encryption-algorithm' property. 'A256GCM' content encryption algorithm will be used unless a different one has been set withJwtEncryptionBuilderor 'smallrye.jwt.new-token.content-encryption-algorithm' property.- Parameters:
secret- the secret- Returns:
- encrypted JWT token
- Throws:
JwtEncryptionException- the exception if the encryption operation has failed
-