public interface DigesterConfig
Common interface for config classes applicable to
StandardByteDigester
,
StandardStringDigester
,
PooledByteDigester
or
PooledStringDigester
objects.
This interface lets the user create new DigesterConfig classes which retrieve values for this parameters from different (and maybe more secure) sources (remote servers, LDAP, other databases...), and do this transparently for the digester object.
The config objects passed to a digester will only be queried once for each configuration parameter, and this will happen during the initialization of the digester object.
For a default implementation, see SimpleDigesterConfig
.
Modifier and Type | Method and Description |
---|---|
String |
getAlgorithm()
Returns the name of an algorithm to be used for hashing, like "MD5" or
"SHA-1".
|
Boolean |
getInvertPositionOfPlainSaltInEncryptionResults()
Returns Boolean.TRUE if the plain (not hashed) salt bytes are to
be appended after the digest operation result bytes.
|
Boolean |
getInvertPositionOfSaltInMessageBeforeDigesting()
Returns Boolean.TRUE if the salt bytes are to be appended after the
message ones before performing the digest operation on the whole.
|
Integer |
getIterations()
Returns the number of times the hash function will be applied recursively.
|
Integer |
getPoolSize()
Get the size of the pool of digesters to be created.
|
Provider |
getProvider()
Returns the java.security.Provider implementation object
to be used by the digester for obtaining the digest algorithm.
|
String |
getProviderName()
Returns the name of the java.security.Provider implementation
to be used by the digester for obtaining the digest algorithm.
|
SaltGenerator |
getSaltGenerator()
Returns a
SaltGenerator implementation to be used by the digester. |
Integer |
getSaltSizeBytes()
Returns the size of the salt to be used to compute the digest.
|
Boolean |
getUseLenientSaltSizeCheck()
Returns Boolean.TRUE if digest matching operations will allow matching
digests with a salt size different to the one configured in the "saltSizeBytes"
property.
|
String getAlgorithm()
Returns the name of an algorithm to be used for hashing, like "MD5" or "SHA-1".
This algorithm has to be supported by your Java Virtual Machine, and it should be allowed as an algorithm for creating java.security.MessageDigest instances.
If this method returns null, the digester will ignore the config object when deciding the algorithm to be used.
Integer getSaltSizeBytes()
Returns the size of the salt to be used to compute the digest. This mechanism is explained in PKCS #5: Password-Based Cryptography Standard.
If salt size is set to zero, then no salt will be used.
If this method returns null, the digester will ignore the config object when deciding the size of the salt to be used.
Integer getIterations()
Returns the number of times the hash function will be applied recursively.
The hash function will be applied to its own results as many times as
specified: h(h(...h(x)...))
This mechanism is explained in PKCS #5: Password-Based Cryptography Standard.
If this method returns null, the digester will ignore the config object when deciding the number of hashing iterations.
SaltGenerator getSaltGenerator()
Returns a SaltGenerator
implementation to be used by the digester.
If this method returns null, the digester will ignore the config object when deciding the salt generator to be used.
String getProviderName()
Returns the name of the java.security.Provider implementation to be used by the digester for obtaining the digest algorithm. This provider must have been registered beforehand.
If this method returns null, the digester will ignore this parameter when deciding the name of the security provider to be used.
If this method does not return null, and neither does getProvider()
,
providerName will be ignored, and the provider object returned
by getProvider() will be used.
Provider getProvider()
Returns the java.security.Provider implementation object to be used by the digester for obtaining the digest algorithm.
If this method returns null, the digester will ignore this parameter when deciding the security provider object to be used.
If this method does not return null, and neither does getProviderName()
,
providerName will be ignored, and the provider object returned
by getProvider() will be used.
The provider returned by this method does not need to be registered beforehand, and its use will not result in its being registered.
Boolean getInvertPositionOfSaltInMessageBeforeDigesting()
Returns Boolean.TRUE if the salt bytes are to be appended after the message ones before performing the digest operation on the whole. The default behaviour is to insert those bytes before the message bytes, but setting this configuration item to true allows compatibility with some external systems and specifications (e.g. LDAP {SSHA}).
Boolean getInvertPositionOfPlainSaltInEncryptionResults()
Returns Boolean.TRUE if the plain (not hashed) salt bytes are to be appended after the digest operation result bytes. The default behaviour is to insert them before the digest result, but setting this configuration item to true allows compatibility with some external systems and specifications (e.g. LDAP {SSHA}).
Boolean getUseLenientSaltSizeCheck()
Returns Boolean.TRUE if digest matching operations will allow matching digests with a salt size different to the one configured in the "saltSizeBytes" property. This is possible because digest algorithms will produce a fixed-size result, so the remaining bytes from the hashed input will be considered salt.
This will allow the digester to match digests produced in environments which do not establish a fixed salt size as standard (for example, SSHA password encryption in LDAP systems).
The value of this property will not affect the creation of digests, which will always have a salt of the size established by the "saltSizeBytes" property. It will only affect digest matching.
Setting this property to true is not compatible with SaltGenerator
implementations which return false for their
SaltGenerator.includePlainSaltInEncryptionResults()
property.
Also, be aware that some algorithms or algorithm providers might not support knowing the size of the digests beforehand, which is also incompatible with a lenient behaviour.
Default is FALSE.
Integer getPoolSize()
Get the size of the pool of digesters to be created.
This parameter will be ignored if used with a non-pooled digester.
Copyright © 2017 JBoss by Red Hat. All rights reserved.