Class BytesEncryptor

java.lang.Object
com.axelor.common.crypto.BytesEncryptor
All Implemented Interfaces:
Encryptor<byte[],byte[]>

@Deprecated public class BytesEncryptor extends Object implements Encryptor<byte[],byte[]>
Deprecated.
Weak key derivation (PBKDF2WithHmacSHA1, 1024 iterations) and instance-scoped salt. Use BytesEncryptorPbkdf2Sha512 (or BytesEncryptorPbkdf2Sha256) for new encryptions, or BytesEncryptorCoordinator to handle legacy $AES$, $AESv1$, and $AESv2$ ciphertext transparently.
AES encryptor operating on raw byte arrays.

Uses PBKDF2WithHmacSHA1 for key derivation with a fixed iteration count of 1024 and an 8-byte salt that is generated once at construction time and reused for every encrypt(byte[]) call.

Binary payload format:

 CBC: | $AES$ (5 bytes) | salt (8 bytes) | encrypted_data |
 GCM: | $AES$ (5 bytes) | salt (8 bytes) | iv (16 bytes) | encrypted_data |
 
  • Constructor Details

  • Method Details

    • cbc

      public static BytesEncryptor cbc(String password)
      Deprecated.
    • gcm

      public static BytesEncryptor gcm(String password)
      Deprecated.
    • getTransformation

      public String getTransformation()
      Deprecated.
    • isEncrypted

      public boolean isEncrypted(byte[] bytes)
      Deprecated.
      Description copied from interface: Encryptor
      Check whether the given message is already encrypted or not.
      Specified by:
      isEncrypted in interface Encryptor<byte[],byte[]>
      Parameters:
      bytes - the message to check
      Returns:
      true if encrypted
    • encrypt

      public byte[] encrypt(byte[] bytes)
      Deprecated.
      Description copied from interface: Encryptor
      Encrypt the given message.
      Specified by:
      encrypt in interface Encryptor<byte[],byte[]>
      Parameters:
      bytes - the message to encrypt
      Returns:
      encrypted message
    • decrypt

      public byte[] decrypt(byte[] bytes)
      Deprecated.
      Description copied from interface: Encryptor
      Decrypt the given encrypted message.
      Specified by:
      decrypt in interface Encryptor<byte[],byte[]>
      Parameters:
      bytes - the encrypted message to decrypt
      Returns:
      decrypted message
    • toString

      public String toString()
      Deprecated.
      Overrides:
      toString in class Object