org.jasypt.util.text
Class StrongTextEncryptor

java.lang.Object
  extended by org.jasypt.util.text.StrongTextEncryptor
All Implemented Interfaces:
TextEncryptor

public final class StrongTextEncryptor
extends java.lang.Object
implements TextEncryptor

Utility class for easily performing high-strength encryption of texts.

This class internally holds a StandardPBEStringEncryptor configured this way:

The required steps to use it are:

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

To use this class, you may need to download and install the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files.

This class is thread-safe.

Since:
1.2 (class existed in org.jasypt.util package since 1.0)
Author:
Daniel Fernández

Constructor Summary
StrongTextEncryptor()
          Creates a new instance of StrongTextEncryptor.
 
Method Summary
 java.lang.String decrypt(java.lang.String encryptedMessage)
          Decrypts a message.
 java.lang.String encrypt(java.lang.String message)
          Encrypts a message.
 void setPassword(java.lang.String password)
          Sets a password.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StrongTextEncryptor

public StrongTextEncryptor()
Creates a new instance of StrongTextEncryptor.

Method Detail

setPassword

public void setPassword(java.lang.String password)
Sets a password.

Parameters:
password - the password to be set.

encrypt

public java.lang.String encrypt(java.lang.String message)
Encrypts a message.

Specified by:
encrypt in interface TextEncryptor
Parameters:
message - the message to be encrypted.
See Also:
StandardPBEStringEncryptor.encrypt(String)

decrypt

public java.lang.String decrypt(java.lang.String encryptedMessage)
Decrypts a message.

Specified by:
decrypt in interface TextEncryptor
Parameters:
encryptedMessage - the message to be decrypted.
See Also:
StandardPBEStringEncryptor.decrypt(String)


Copyright © 2010 The JASYPT team. All Rights Reserved.