Package org.jasypt.util.binary
Class AES256BinaryEncryptor
Object
org.jasypt.util.binary.AES256BinaryEncryptor
- All Implemented Interfaces:
BinaryEncryptor
Utility class for easily performing high-strength encryption of binaries (byte arrays).
This class internally holds a StandardPBEByteEncryptor
configured this way:
- Algorithm: PBEWithHMACSHA512AndAES_256.
- Key obtention iterations: 1000.
The required steps to use it are:
- Create an instance (using new).
- Set a password (using
setPassword(String)
orsetPasswordCharArray(char[])
). - Perform the desired
encrypt(byte[])
ordecrypt(byte[])
operations.
This class is thread-safe.
- Since:
- 1.9.3
- Author:
- Hoki Torres
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
decrypt
(byte[] encryptedBinary) Decrypts a byte array.byte[]
encrypt
(byte[] binary) Encrypts a byte arrayvoid
setPassword
(String password) Sets a password.void
setPasswordCharArray
(char[] password) Sets a password, as a char[].
-
Constructor Details
-
AES256BinaryEncryptor
public AES256BinaryEncryptor()Creates a new instance of StrongBinaryEncryptor.
-
-
Method Details
-
setPassword
Sets a password.- Parameters:
password
- the password to be set.
-
setPasswordCharArray
public void setPasswordCharArray(char[] password) Sets a password, as a char[].- Parameters:
password
- the password to be set.
-
encrypt
public byte[] encrypt(byte[] binary) Encrypts a byte array- Specified by:
encrypt
in interfaceBinaryEncryptor
- Parameters:
binary
- the byte array to be encrypted.- See Also:
-
decrypt
public byte[] decrypt(byte[] encryptedBinary) Decrypts a byte array.- Specified by:
decrypt
in interfaceBinaryEncryptor
- Parameters:
encryptedBinary
- the byte array to be decrypted.- See Also:
-