public class MessageDigestCipher extends AbstractCipher
In this cipher's configuration, the value of algorithm
element
is used to specify the MessageDigest algorithm; and the provider
element may optionally be used to specify the MessageDigest provider.
MessageDigest
Constructor and Description |
---|
MessageDigestCipher() |
Modifier and Type | Method and Description |
---|---|
protected MessageDigest |
createMessageDigest()
|
byte[] |
decrypt(byte[] value)
Decrypts an array of bytes.
|
byte[] |
encrypt(byte[] value)
Encrypts an array of bytes.
|
protected String |
getAlgorithm()
Returns the message digest algorithm to be used.
|
protected String |
getProvider()
Returns the message digest provider to be used.
|
protected boolean |
getUseURLSafeBase64Variant()
Indicates if a URL safe Base64 variant is to be used when encoding
bytes to String.
|
void |
init(Node configuration)
This method is called only once and before any other method are called.
|
protected void |
setAlgorithm(String algorithm)
Sets the message digest algorithm to be used.
|
protected void |
setProvider(String provider)
Sets the message digest provider to be used.
|
decrypt, encrypt, getStringCharset
protected boolean getUseURLSafeBase64Variant()
AbstractCipher
The default value is true. This method may be overridden to change it.
getUseURLSafeBase64Variant
in class AbstractCipher
protected String getAlgorithm()
protected void setAlgorithm(String algorithm)
algorithm
- the algorithm.protected String getProvider()
null
if the default provider
search is to be used.protected void setProvider(String provider)
provider
- the provider, or null
if the default provider
search is to be used.public void init(Node configuration) throws PortalException
ICipherSpi
PortalException
protected MessageDigest createMessageDigest()
MessageDigest.getInstance(String, String)
public byte[] encrypt(byte[] value)
ICipher
value
- the original value.public byte[] decrypt(byte[] value)
ICipher
value
- the encrypted value.LumisXP 12.3.0.200408 - Copyright © 2006–2020 Lumis EIP Tecnologia da Informação LTDA. All Rights Reserved.