StringFixedSaltGenerator, which
implements the new FixedSaltGenerator interface and therefore is able to benefit
from the performance improvements associated with it. This class will be removed
in 1.10.0 (or 2.0.0).public class FixedStringSaltGenerator extends java.lang.Object implements SaltGenerator
This implementation of SaltGenerator always returns a fixed salt
set by the user as a String, which is returned as salt bytes using the
specified charset for conversion (UTF-8 by default).
If the requested salt has a size in bytes smaller than the specified salt, the first n bytes are returned. If it is larger, an exception is thrown.
This class is thread-safe.
| Modifier and Type | Field and Description |
|---|---|
private java.lang.String |
charset
Deprecated.
|
private static java.lang.String |
DEFAULT_CHARSET
Deprecated.
|
private java.lang.String |
salt
Deprecated.
|
private byte[] |
saltBytes
Deprecated.
|
| Constructor and Description |
|---|
FixedStringSaltGenerator()
Deprecated.
Creates a new instance of FixedStringSaltGenerator
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
generateSalt(int lengthBytes)
Deprecated.
Return salt with the specified byte length.
|
boolean |
includePlainSaltInEncryptionResults()
Deprecated.
As this salt generator provides a fixed salt, its inclusion
unencrypted in encryption results
is not necessary, and in fact not desirable (so that it remains hidden).
|
void |
setCharset(java.lang.String charset)
Deprecated.
Sets the charset to be applied to the salt for conversion into bytes.
|
void |
setSalt(java.lang.String salt)
Deprecated.
Sets the salt to be returned.
|
private static final java.lang.String DEFAULT_CHARSET
private java.lang.String salt
private java.lang.String charset
private byte[] saltBytes
public FixedStringSaltGenerator()
public void setSalt(java.lang.String salt)
salt - the specified salt.public void setCharset(java.lang.String charset)
charset - the specified charsetpublic byte[] generateSalt(int lengthBytes)
generateSalt in interface SaltGeneratorlengthBytes - length in bytes.public boolean includePlainSaltInEncryptionResults()
includePlainSaltInEncryptionResults in interface SaltGenerator