public abstract class EncryptionProvider extends Object
javax.crypto.Cipher
.
Note that clients are strongly recommended to use HTTPS instead of HTTP to secure communications, in which case this class is useless.
Cipher
Constructor and Description |
---|
EncryptionProvider() |
Modifier and Type | Method and Description |
---|---|
abstract String |
decrypt(String text)
Deprecated.
This method relies on the default platform character encoding. Clients are advised to use the decrypt(String, String) method that
allows specifying an explicit charset.
|
abstract String |
decrypt(String text,
String charsetName)
De-obfuscate the specified String into the original String that can be interpreted by a human.
|
abstract String |
encrypt(String text)
Deprecated.
This method relies on the default platform character encoding. Clients are advised to use the encrypt(String, String) method that
allows specifying an explicit charset.
|
abstract String |
encrypt(String text,
String charsetName)
Obfuscate the specified String content into a String that can hardly be interpreted by a human.
|
static EncryptionProvider |
getInstance(String algorithm,
String iv)
Instantiates an
EncryptionProvider for the specified cipher algorithm
and initialization vector. |
public static EncryptionProvider getInstance(String algorithm, String iv) throws CoreException
EncryptionProvider
for the specified cipher algorithm
and initialization vector.
If the algorithm is null
or an empty String,
the returned instance will not encrypt nor decrypt provided content.algorithm
- the cipher algorithm.iv
- the cipher initialization vector.EncryptionProvider
instance.CoreException
- if the specified algorithm cannot be used
or if the encryption secret key is not set as servlet context parameter or a System property.Options.OPTION_ENCRYPTION_SECRET_KEY
@Deprecated public abstract String encrypt(String text) throws CoreException
text
- the text to encrypt.CoreException
- if the encryption algorithm cannot be used.public abstract String encrypt(String text, String charsetName) throws CoreException
text
- the text to encrypt.charsetName
- the character encoding used to convert characters to bytes ("UTF-8"
is recommended).CoreException
- if the encryption algorithm cannot be used.@Deprecated public abstract String decrypt(String text) throws CoreException
text
- the text to decrypt.CoreException
- if the encryption algorithm cannot be used.decrypt(String, String)
public abstract String decrypt(String text, String charsetName) throws CoreException
text
- the text to decrypt.charsetName
- the character encoding used to convert decrypted bytes to characters ("UTF-8"
is recommended).CoreException
- if the encryption algorithm cannot be used or the charset is unknown.