Interface JwtEncryption

  • All Known Subinterfaces:
    JwtEncryptionBuilder

    public interface JwtEncryption
    JWT JsonWebEncryption.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      String 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.
      String encrypt​(String keyLocation)
      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.
      String encrypt​(PublicKey keyEncryptionKey)
      Encrypt the claims or inner JWT with PublicKey.
      String encrypt​(SecretKey keyEncryptionKey)
      Encrypt the claims or inner JWT with SecretKey.
      String encryptWithSecret​(String secret)
      Encrypt the claims or inner JWT with a secret key string.
    • Method Detail

      • encrypt

        String encrypt​(PublicKey keyEncryptionKey)
                throws JwtEncryptionException
        Encrypt the claims or inner JWT with PublicKey. '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 with JwtEncryptionBuilder or 'smallrye.jwt.new-token.key-encryption-algorithm' property. 'A256GCM' content encryption algorithm will be used unless a different one has been set with JwtEncryptionBuilder or '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

        String encrypt​(SecretKey keyEncryptionKey)
                throws JwtEncryptionException
        Encrypt the claims or inner JWT with SecretKey. 'A256KW' key encryption algorithm will be used unless a different one has been set with JwtEncryptionBuilder or 'smallrye.jwt.new-token.key-encryption-algorithm' property. 'A256GCM' content encryption algorithm will be used unless a different one has been set with JwtEncryptionBuilder or '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

        String encrypt​(String keyLocation)
                throws JwtEncryptionException
        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 with JwtEncryptionBuilder or 'smallrye.jwt.new-token.key-encryption-algorithm' property. 'A256GCM' content encryption algorithm will be used unless a different one has been set with JwtEncryptionBuilder or '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

        String encrypt()
                throws JwtEncryptionException
        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 with JwtEncryptionBuilder or 'smallrye.jwt.new-token.key-encryption-algorithm' property. 'A256GCM' content encryption algorithm will be used unless a different one have been set with JwtEncryptionBuilder or '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

        String encryptWithSecret​(String secret)
                          throws JwtEncryptionException
        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 with JwtEncryptionBuilder or 'smallrye.jwt.new-token.key-encryption-algorithm' property. 'A256GCM' content encryption algorithm will be used unless a different one has been set with JwtEncryptionBuilder or '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