public class EncryptionServiceImpl extends Object implements EncryptionService
Constructor and Description |
---|
EncryptionServiceImpl() |
Modifier and Type | Method and Description |
---|---|
String |
decrypt(String encryptedValue)
Decrypts a plain text value using Keyczar
|
String |
decryptValue(String wrappedEncryptedValue)
Decrypts a wrapped encrypted value in the "ENC(*)" format.
|
String |
encrypt(String plainTextValue)
Encrypts a plain text value using Keyczar.
|
String |
unwrapEncryptedValue(String wrappedEncryptedValue)
Unwraps an encrypted value in the "ENC(*)" format.
|
public String encrypt(String plainTextValue)
encrypt
in interface org.apache.wss4j.common.crypto.PasswordEncryptor
plainTextValue
- The value to encrypt.public String decrypt(String encryptedValue)
decrypt
in interface org.apache.wss4j.common.crypto.PasswordEncryptor
encryptedValue
- The value to decrypt.public String decryptValue(String wrappedEncryptedValue)
One can encrypt passwords using the security:encrypt console command.
user@local>security:encrypt secret
c+GitDfYAMTDRESXSDDsMw==
A wrapped encrypted password is wrapped in ENC() as follows: ENC(HsOcGt8seSKc34sRUYpakQ==)
decryptValue
in interface EncryptionService
wrappedEncryptedValue
- a string of the form "ENC(", followed by an encrypted value, and
terminated with ")".public String unwrapEncryptedValue(String wrappedEncryptedValue)
Given a string that starts with 'ENC(' and ends with ')', returns the in-between substring. This method is meant to remove the wrapping notation for encrypted values, typically passwords.
If the input is a password and is not in the form ENC(my-encrypted-password), we assume the password is not encrypted.
unwrapEncryptedValue
in interface EncryptionService
wrappedEncryptedValue
- The wrapped encrypted value, in the form
'ENC(my-encrypted-value)'.This work is licensed under a Creative Commons Attribution 4.0 International License.