org.jasypt.util.numeric
Class StrongDecimalNumberEncryptor

Object
  extended by org.jasypt.util.numeric.StrongDecimalNumberEncryptor
All Implemented Interfaces:
DecimalNumberEncryptor

public final class StrongDecimalNumberEncryptor
extends Object
implements DecimalNumberEncryptor

Utility class for easily performing normal-strength encryption of BigDecimal objects.

This class internally holds a StandardPBEBigDecimalEncryptor configured this way:

The required steps to use it are:

  1. Create an instance (using new).
  2. Set a password (using setPassword(String) or setPasswordCharArray(char[])).
  3. Perform the desired encrypt(BigDecimal) or decrypt(BigDecimal) operations.

This class is thread-safe.

Since:
1.2
Author:
Daniel Fernández

Constructor Summary
StrongDecimalNumberEncryptor()
          Creates a new instance of StrongDecimalNumberEncryptor.
 
Method Summary
 BigDecimal decrypt(BigDecimal encryptedNumber)
          Decrypts a number.
 BigDecimal encrypt(BigDecimal number)
          Encrypts a number
 void setPassword(String password)
          Sets a password.
 void setPasswordCharArray(char[] password)
          Sets a password, as a char[].
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StrongDecimalNumberEncryptor

public StrongDecimalNumberEncryptor()
Creates a new instance of StrongDecimalNumberEncryptor.

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 BigDecimal encrypt(BigDecimal number)
Encrypts a number

Specified by:
encrypt in interface DecimalNumberEncryptor
Parameters:
number - the number to be encrypted.
See Also:
StandardPBEBigDecimalEncryptor.encrypt(BigDecimal)

decrypt

public BigDecimal decrypt(BigDecimal encryptedNumber)
Decrypts a number.

Specified by:
decrypt in interface DecimalNumberEncryptor
Parameters:
encryptedNumber - the number to be decrypted.
See Also:
StandardPBEBigDecimalEncryptor.decrypt(BigDecimal)


Copyright © 2011 The JASYPT team. All Rights Reserved.