Package org.apache.wss4j.common.crypto
Class JasyptPasswordEncryptor
java.lang.Object
org.apache.wss4j.common.crypto.JasyptPasswordEncryptor
- All Implemented Interfaces:
PasswordEncryptor
An implementation of PasswordEncryptor that relies on Jasypt's StandardPBEStringEncryptor to
encrypt and decrypt passwords. The default algorithm that is used is
"PBEWithHmacSHA512AndAES_256". Values encrypted under the previous non-FIPS default
("PBEWithMD5AndTripleDES") can still be decrypted by setting the
"org.apache.wss4j.crypto.jasypt.useLegacyDefaultAlgorithm" system property to "true", or by
passing that algorithm to the constructor explicitly - but the legacy algorithm (an MD5-based
PKCS#5 v1.5 KDF with 3DES) is weak against offline dictionary attack and values should be
re-encrypted under the current default.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final StringThe default algorithm prior to WSS4J adopting "PBEWithHmacSHA512AndAES_256" universally (it was previously only the default when FIPS mode was enabled).static final StringSystem property to restoreLEGACY_DEFAULT_ALGORITHMas the default algorithm (ignored in FIPS mode), for compatibility with values encrypted under previous releases. -
Constructor Summary
ConstructorsConstructorDescriptionJasyptPasswordEncryptor(String password) JasyptPasswordEncryptor(String password, String algorithm) JasyptPasswordEncryptor(CallbackHandler callbackHandler) JasyptPasswordEncryptor(CallbackHandler callbackHandler, String algorithm) -
Method Summary
-
Field Details
-
LEGACY_DEFAULT_ALGORITHM
The default algorithm prior to WSS4J adopting "PBEWithHmacSHA512AndAES_256" universally (it was previously only the default when FIPS mode was enabled).- See Also:
-
USE_LEGACY_DEFAULT_ALGORITHM_PROPERTY
System property to restoreLEGACY_DEFAULT_ALGORITHMas the default algorithm (ignored in FIPS mode), for compatibility with values encrypted under previous releases. The property is read each time an instance is constructed without an explicit algorithm, not once at class-loading time.- See Also:
-
DEFAULT_ALGORITHM
- See Also:
-
-
Constructor Details
-
JasyptPasswordEncryptor
-
JasyptPasswordEncryptor
-
JasyptPasswordEncryptor
-
JasyptPasswordEncryptor
-
-
Method Details
-
encrypt
Encrypt the given password- Specified by:
encryptin interfacePasswordEncryptor- Parameters:
password- the password to be encrypted- Returns:
- the encrypted password
-
decrypt
Decrypt the given encrypted password- Specified by:
decryptin interfacePasswordEncryptor- Parameters:
encryptedPassword- the encrypted password to decrypt- Returns:
- the decrypted password
-