public final class StrongTextEncryptor extends 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.
| Constructor and Description |
|---|
StrongTextEncryptor()
Creates a new instance of StrongTextEncryptor.
|
| Modifier and Type | Method and Description |
|---|---|
String |
decrypt(String encryptedMessage)
Decrypts a message.
|
String |
encrypt(String message)
Encrypts a message.
|
void |
setPassword(String password)
Sets a password.
|
void |
setPasswordCharArray(char[] password)
Sets a password, as a char[].
|
public StrongTextEncryptor()
public void setPassword(String password)
password - the password to be set.public void setPasswordCharArray(char[] password)
password - the password to be set.public String encrypt(String message)
encrypt in interface TextEncryptormessage - the message to be encrypted.StandardPBEStringEncryptor.encrypt(String)public String decrypt(String encryptedMessage)
decrypt in interface TextEncryptorencryptedMessage - the message to be decrypted.StandardPBEStringEncryptor.decrypt(String)Copyright © 2017 JBoss by Red Hat. All rights reserved.