Class SimpleGCMByteEncryptor

java.lang.Object
com.ulisesbocchio.jasyptspringboot.encryptor.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 Details

    • AES_KEY_SIZE

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

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

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

      public static final int GCM_TAG_LENGTH
      Constant GCM_TAG_LENGTH=128
      See Also:
  • Constructor Details

    • SimpleGCMByteEncryptor

      public SimpleGCMByteEncryptor(SimpleGCMConfig config)

      Constructor for SimpleGCMByteEncryptor.

      Parameters:
      config - a SimpleGCMConfig object
  • Method Details

    • 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