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:
setPassword(String) or
setPasswordCharArray(char[])).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.
| Modifier and Type | Field and Description |
|---|---|
private StandardPBEStringEncryptor |
encryptor |
| Constructor and Description |
|---|
StrongTextEncryptor()
Creates a new instance of StrongTextEncryptor.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
void |
setPasswordCharArray(char[] password)
Sets a password, as a char[].
|
private final StandardPBEStringEncryptor encryptor
public StrongTextEncryptor()
public void setPassword(java.lang.String password)
password - the password to be set.public void setPasswordCharArray(char[] password)
password - the password to be set.public java.lang.String encrypt(java.lang.String message)
encrypt in interface TextEncryptormessage - the message to be encrypted.StandardPBEStringEncryptor.encrypt(String)public java.lang.String decrypt(java.lang.String encryptedMessage)
decrypt in interface TextEncryptorencryptedMessage - the message to be decrypted.StandardPBEStringEncryptor.decrypt(String)