Package org.jasypt.util.numeric
Class AES256DecimalNumberEncryptor
- java.lang.Object
-
- org.jasypt.util.numeric.AES256DecimalNumberEncryptor
-
- All Implemented Interfaces:
DecimalNumberEncryptor
public final class AES256DecimalNumberEncryptor extends java.lang.Object implements DecimalNumberEncryptor
Utility class for easily performing normal-strength encryption of BigDecimal objects.
This class internally holds a
StandardPBEBigDecimalEncryptorconfigured 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(BigDecimal)ordecrypt(BigDecimal)operations.
This class is thread-safe.
- Since:
- 1.9.3
-
-
Field Summary
Fields Modifier and Type Field Description private StandardPBEBigDecimalEncryptorencryptor
-
Constructor Summary
Constructors Constructor Description AES256DecimalNumberEncryptor()Creates a new instance of StrongDecimalNumberEncryptor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.math.BigDecimaldecrypt(java.math.BigDecimal encryptedNumber)Decrypts a number.java.math.BigDecimalencrypt(java.math.BigDecimal number)Encrypts a numbervoidsetPassword(java.lang.String password)Sets a password.voidsetPasswordCharArray(char[] password)Sets a password, as a char[].
-
-
-
Field Detail
-
encryptor
private final StandardPBEBigDecimalEncryptor encryptor
-
-
Method Detail
-
setPassword
public void setPassword(java.lang.String password)
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 java.math.BigDecimal encrypt(java.math.BigDecimal number)
Encrypts a number- Specified by:
encryptin interfaceDecimalNumberEncryptor- Parameters:
number- the number to be encrypted.- See Also:
StandardPBEBigDecimalEncryptor.encrypt(BigDecimal)
-
decrypt
public java.math.BigDecimal decrypt(java.math.BigDecimal encryptedNumber)
Decrypts a number.- Specified by:
decryptin interfaceDecimalNumberEncryptor- Parameters:
encryptedNumber- the number to be decrypted.- See Also:
StandardPBEBigDecimalEncryptor.decrypt(BigDecimal)
-
-