public final class BasicTextEncryptor extends Object implements TextEncryptor
Utility class for easily performing normal-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.This class is thread-safe.
| Constructor and Description |
|---|
BasicTextEncryptor()
Creates a new instance of BasicTextEncryptor.
|
| 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 BasicTextEncryptor()
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.