Class SimpleGCMByteEncryptor

  • All Implemented Interfaces:
    org.jasypt.encryption.ByteEncryptor

    public class SimpleGCMByteEncryptor
    extends Object
    implements org.jasypt.encryption.ByteEncryptor

    SimpleGCMByteEncryptor class.

    Version:
    $Id: $Id
    Author:
    Sergio.U.Bocchio
    • Field Detail

      • AES_KEY_SIZE

        public static final int AES_KEY_SIZE
        Constant AES_KEY_SIZE=256
        See Also:
        Constant Field Values
      • AES_KEY_PASSWORD_SALT_LENGTH

        public static final int AES_KEY_PASSWORD_SALT_LENGTH
        Constant AES_KEY_PASSWORD_SALT_LENGTH=16
        See Also:
        Constant Field Values
      • GCM_IV_LENGTH

        public static final int GCM_IV_LENGTH
        Constant GCM_IV_LENGTH=12
        See Also:
        Constant Field Values
      • GCM_TAG_LENGTH

        public static final int GCM_TAG_LENGTH
        Constant GCM_TAG_LENGTH=128
        See Also:
        Constant Field Values
    • Constructor Detail

      • SimpleGCMByteEncryptor

        public SimpleGCMByteEncryptor​(SimpleGCMConfig config)

        Constructor for SimpleGCMByteEncryptor.

        Parameters:
        config - a SimpleGCMConfig object
    • Method Detail

      • encrypt

        public byte[] encrypt​(byte[] message)
        Specified by:
        encrypt in interface org.jasypt.encryption.ByteEncryptor
      • decrypt

        public byte[] decrypt​(byte[] encryptedMessage)
        Specified by:
        decrypt in interface org.jasypt.encryption.ByteEncryptor
      • generateSecretKey

        public static SecretKey generateSecretKey()

        generateSecretKey.

        Returns:
        a SecretKey object
      • generateBase64EncodedSecretKey

        public static String generateBase64EncodedSecretKey()

        generateBase64EncodedSecretKey.

        Returns:
        a String object
      • getAESKeyFromPassword

        public static SecretKey getAESKeyFromPassword​(char[] password,
                                                      org.jasypt.salt.SaltGenerator saltGenerator,
                                                      int iterations,
                                                      String algorithm)

        getAESKeyFromPassword.

        Parameters:
        password - an array of char objects
        saltGenerator - a SaltGenerator object
        iterations - a int
        algorithm - a String object
        Returns:
        a SecretKey object