Package org.jasypt.util.numeric
Class BasicDecimalNumberEncryptor
- Object
-
- org.jasypt.util.numeric.BasicDecimalNumberEncryptor
-
- All Implemented Interfaces:
DecimalNumberEncryptor
public final class BasicDecimalNumberEncryptor extends Object implements DecimalNumberEncryptor
Utility class for easily performing normal-strength encryption of BigDecimal objects.
This class internally holds a
StandardPBEBigDecimalEncryptor
configured this way:- Algorithm: PBEWithMD5AndDES.
- 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.2
- Author:
- Daniel Fernández
-
-
Constructor Summary
Constructors Constructor Description BasicDecimalNumberEncryptor()
Creates a new instance of BasicDecimalNumberEncryptor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.math.BigDecimal
decrypt(java.math.BigDecimal encryptedNumber)
Decrypts a number.java.math.BigDecimal
encrypt(java.math.BigDecimal number)
Encrypts a numbervoid
setPassword(String password)
Sets a password.void
setPasswordCharArray(char[] password)
Sets a password, as a char[].
-
-
-
Method Detail
-
setPassword
public void setPassword(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.- Since:
- 1.8
-
encrypt
public java.math.BigDecimal encrypt(java.math.BigDecimal number)
Encrypts a number- Specified by:
encrypt
in 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:
decrypt
in interfaceDecimalNumberEncryptor
- Parameters:
encryptedNumber
- the number to be decrypted.- See Also:
StandardPBEBigDecimalEncryptor.decrypt(BigDecimal)
-
-