Package org.jasypt.util.text
Class BasicTextEncryptor
java.lang.Object
org.jasypt.util.text.BasicTextEncryptor
- All Implemented Interfaces:
TextEncryptor
Utility class for easily performing normal-strength encryption of texts.
This class internally holds a StandardPBEStringEncryptor
configured this way:
- Algorithm: PBEWithMD5AndDES.
- Key obtention iterations: 1000.
The required steps to use it are:
- Create an instance (using new).
- Set a password (using
setPassword(String)
orsetPasswordCharArray(char[])
). - Perform the desired
encrypt(String)
ordecrypt(String)
operations.
This class is thread-safe.
- Since:
- 1.2 (class existed as org.jasypt.util.TextEncryptor since 1.0)
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionDecrypts a message.Encrypts a message.void
setPassword
(String password) Sets a password.void
setPasswordCharArray
(char[] password) Sets a password, as a char[]
-
Field Details
-
encryptor
-
-
Constructor Details
-
BasicTextEncryptor
public BasicTextEncryptor()Creates a new instance of BasicTextEncryptor.
-
-
Method Details
-
setPassword
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
Encrypts a message.- Specified by:
encrypt
in interfaceTextEncryptor
- Parameters:
message
- the message to be encrypted.- See Also:
-
decrypt
Decrypts a message.- Specified by:
decrypt
in interfaceTextEncryptor
- Parameters:
encryptedMessage
- the message to be decrypted.- See Also:
-