org.jasypt.util.numeric
Class BasicIntegerNumberEncryptor

Object
  extended by org.jasypt.util.numeric.BasicIntegerNumberEncryptor
All Implemented Interfaces:
IntegerNumberEncryptor

public final class BasicIntegerNumberEncryptor
extends Object
implements IntegerNumberEncryptor

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

This class internally holds a StandardPBEBigIntegerEncryptor 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(BigInteger) or decrypt(BigInteger) operations.

This class is thread-safe.

Since:
1.2
Author:
Daniel Fernández

Constructor Summary
BasicIntegerNumberEncryptor()
          Creates a new instance of BasicIntegerNumberEncryptor.
 
Method Summary
 BigInteger decrypt(BigInteger encryptedNumber)
          Decrypts a number.
 BigInteger encrypt(BigInteger 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

BasicIntegerNumberEncryptor

public BasicIntegerNumberEncryptor()
Creates a new instance of BasicIntegerNumberEncryptor.

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

Specified by:
encrypt in interface IntegerNumberEncryptor
Parameters:
number - the number to be encrypted.
See Also:
StandardPBEBigIntegerEncryptor.encrypt(BigInteger)

decrypt

public BigInteger decrypt(BigInteger encryptedNumber)
Decrypts a number.

Specified by:
decrypt in interface IntegerNumberEncryptor
Parameters:
encryptedNumber - the number to be decrypted.
See Also:
StandardPBEBigIntegerEncryptor.decrypt(BigInteger)


Copyright © 2011 The JASYPT team. All Rights Reserved.