To encrypt a password I use (modified from http://www.jasypt.org/encrypting-texts.html):
BasicTextEncryptor textEncryptor = new BasicTextEncryptor();
textEncryptor.setPassword(myEncryptionPassword);
String myEncryptedText = textEncryptor.encrypt(myText);
String plainText = textEncryptor.decrypt(myEncryptedText);
Why is a password required to be set on BasicTextEncryptor ?
I may be not understanding something fundamental here but does this not make sense, although it does not work :
BasicTextEncryptor textEncryptor = new BasicTextEncryptor();
String myEncryptedText = textEncryptor.encrypt(myText);
String plainText = textEncryptor.decrypt(myEncryptedText);
It does work and it does require password for encryption and decryption. To simplify the example I have initiated two sessions of StandardPBEStringEncryptor as encryptor and decryptor
output: