public class EnvironmentDigesterConfig extends SimpleDigesterConfig
Implementation for DigesterConfig
which can retrieve configuration
values from environment variables or system properties.
The name of the environment variable or system property (JVM property) to query for each parameter can be set with its corresponding setXEnvName or setXSysProperty method.
As this class extends SimpleDigesterConfig
, parameter values
can be also set with the usual setX methods.
For any of the configuration parameters, if its value is not configured in any way, a null value will be returned by the corresponding getX method.
Constructor and Description |
---|
EnvironmentDigesterConfig()
Creates a new EnvironmentDigesterConfig instance.
|
Modifier and Type | Method and Description |
---|---|
String |
getAlgorithmEnvName()
Retrieve the name of the environment variable which value has been
loaded as the algorithm.
|
String |
getAlgorithmSysPropertyName()
Retrieve the name of the JVM system property which value has been
loaded as the algorithm.
|
String |
getInvertPositionOfPlainSaltInEncryptionResultsEnvName()
Retrieve the name of the environment variable which value has been
loaded as the value for the invertPositionOfPlainSaltInEncryptionResults
property.
|
String |
getInvertPositionOfPlainSaltInEncryptionResultsSysPropertyName()
Retrieve the name of the JVM system property which value has been
loaded as the value for the invertPositionOfPlainSaltInEncryptionResults
property.
|
String |
getInvertPositionOfSaltInMessageBeforeDigestingEnvName()
Retrieve the name of the environment variable which value has been
loaded as the value for the invertPositionOfSaltInMessageBeforeDigesting
property.
|
String |
getInvertPositionOfSaltInMessageBeforeDigestingSysPropertyName()
Retrieve the name of the JVM system property which value has been
loaded as the value for the invertPositionOfSaltInMessageBeforeDigesting
property.
|
String |
getIterationsEnvName()
Retrieve the name of the environment variable which value has been
loaded as the iteration count.
|
String |
getIterationsSysPropertyName()
Retrieve the name of the JVM system property which value has been
loaded as the iteration count.
|
String |
getPoolSizeEnvName()
Retrieve the name of the environment variable which value has been
loaded as the value for the poolSize
property.
|
String |
getPoolSizeSysPropertyName()
Retrieve the name of the JVM system property which value has been
loaded as the value for the poolSize
property.
|
String |
getProviderClassNameEnvName()
Retrieve the name of the environment variable which value has been
loaded as the provider class name.
|
String |
getProviderClassNameSysPropertyName()
Retrieve the name of the JVM system property which value has been
loaded as the provider class name.
|
String |
getProviderNameEnvName()
Retrieve the name of the environment variable which value has been
loaded as the provider name.
|
String |
getProviderNameSysPropertyName()
Retrieve the name of the JVM system property which value has been
loaded as the provider name.
|
String |
getSaltGeneratorClassNameEnvName()
Retrieve the name of the environment variable which value has been
loaded as the salt generator class name.
|
String |
getSaltGeneratorClassNameSysPropertyName()
Retrieve the name of the JVM system property which value has been
loaded as the salt generator class name.
|
String |
getSaltSizeBytesEnvName()
Retrieve the name of the environment variable which value has been
loaded as the salt size in bytes.
|
String |
getSaltSizeBytesSysPropertyName()
Retrieve the name of the JVM system property which value has been
loaded as the salt size in bytes.
|
String |
getUseLenientSaltSizeCheckEnvName()
Retrieve the name of the environment variable which value has been
loaded as the value for the useLenientSaltSizeCheck
property.
|
String |
getUseLenientSaltSizeCheckSysPropertyName()
Retrieve the name of the JVM system property which value has been
loaded as the value for the useLenientSaltSizeCheck
property.
|
void |
setAlgorithm(String algorithm)
Sets the name of the algorithm.
|
void |
setAlgorithmEnvName(String algorithmEnvName)
Set the config object to use the specified environment variable to
load the value for the algorithm.
|
void |
setAlgorithmSysPropertyName(String algorithmSysPropertyName)
Set the config object to use the specified JVM system property to
load the value for the algorithm.
|
void |
setInvertPositionOfPlainSaltInEncryptionResults(Boolean invertPositionOfPlainSaltInEncryptionResults)
Whether the plain (not hashed) salt bytes are to
be appended after the digest operation result bytes.
|
void |
setInvertPositionOfPlainSaltInEncryptionResultsEnvName(String invertPositionOfPlainSaltInEncryptionResultsEnvName)
Set the config object to use the specified environment variable to
load the value for the invertPositionOfPlainSaltInEncryptionResults
property.
|
void |
setInvertPositionOfPlainSaltInEncryptionResultsSysPropertyName(String invertPositionOfPlainSaltInEncryptionResultsSysPropertyName)
Set the config object to use the specified JVM system property to
load the value for the invertPositionOfPlainSaltInEncryptionResults
property.
|
void |
setInvertPositionOfSaltInMessageBeforeDigesting(Boolean invertPositionOfSaltInMessageBeforeDigesting)
Whether the salt bytes are to be appended after the
message ones before performing the digest operation on the whole.
|
void |
setInvertPositionOfSaltInMessageBeforeDigestingEnvName(String invertPositionOfSaltInMessageBeforeDigestingEnvName)
Set the config object to use the specified environment variable to
load the value for the invertPositionOfSaltInMessageBeforeDigesting
property.
|
void |
setInvertPositionOfSaltInMessageBeforeDigestingSysPropertyName(String invertPositionOfSaltInMessageBeforeDigestingSysPropertyName)
Set the config object to use the specified JVM system property to
load the value for the invertPositionOfSaltInMessageBeforeDigesting
property.
|
void |
setIterations(Integer iterations)
Sets the number of hashing iterations.
|
void |
setIterations(String iterations)
Sets the number of hashing iterations.
|
void |
setIterationsEnvName(String iterationsEnvName)
Set the config object to use the specified environment variable to
load the value for the iteration count.
|
void |
setIterationsSysPropertyName(String iterationsSysPropertyName)
Set the config object to use the specified JVM system property to
load the value for the iteration count.
|
void |
setPoolSize(Integer poolSize)
Sets the size of the pool of digesters to be created.
|
void |
setPoolSize(String poolSize)
Sets the size of the pool of digesters to be created.
|
void |
setPoolSizeEnvName(String poolSizeEnvName)
Set the config object to use the specified environment variable to
load the value for the poolSize
property.
|
void |
setPoolSizeSysPropertyName(String poolSizeSysPropertyName)
Set the config object to use the specified JVM system property to
load the value for the useLenientSaltSizeCheck
property.
|
void |
setProvider(Provider provider)
Sets the security provider to be used for obtaining the digest
algorithm.
|
void |
setProviderClassName(String providerClassName)
Sets the class name for the security provider to be used for
obtaining the digest algorithm.
|
void |
setProviderClassNameEnvName(String providerClassNameEnvName)
Set the config object to use the specified environment variable to
load the value for the provider class name.
|
void |
setProviderClassNameSysPropertyName(String providerClassNameSysPropertyName)
Set the config object to use the specified JVM system property to
load the value for the provider class name.
|
void |
setProviderName(String providerName)
Sets the name of the security provider to be asked for the digest
algorithm.
|
void |
setProviderNameEnvName(String providerNameEnvName)
Set the config object to use the specified environment variable to
load the value for the provider name.
|
void |
setProviderNameSysPropertyName(String providerNameSysPropertyName)
Set the config object to use the specified JVM system property to
load the value for the provider name.
|
void |
setSaltGenerator(SaltGenerator saltGenerator)
Sets the salt generator.
|
void |
setSaltGeneratorClassName(String saltGeneratorClassName)
Sets the class name of the salt generator.
|
void |
setSaltGeneratorClassNameEnvName(String saltGeneratorClassNameEnvName)
Set the config object to use the specified environment variable to
load the value for the salt generator class name.
|
void |
setSaltGeneratorClassNameSysPropertyName(String saltGeneratorClassNameSysPropertyName)
Set the config object to use the specified JVM system property to
load the value for the salt generator class name.
|
void |
setSaltSizeBytes(Integer saltSizeBytes)
Size in bytes of the salt to be used.
|
void |
setSaltSizeBytes(String saltSizeBytes)
Size in bytes of the salt to be used.
|
void |
setSaltSizeBytesEnvName(String saltSizeBytesEnvName)
Set the config object to use the specified environment variable to
load the value for the salt size in bytes.
|
void |
setSaltSizeBytesSysPropertyName(String saltSizeBytesSysPropertyName)
Set the config object to use the specified JVM system property to
load the value for the salt size in bytes.
|
void |
setUseLenientSaltSizeCheck(Boolean useLenientSaltSizeCheck)
Whether digest matching operations will allow matching
digests with a salt size different to the one configured in the "saltSizeBytes"
property.
|
void |
setUseLenientSaltSizeCheckEnvName(String useLenientSaltSizeCheckEnvName)
Set the config object to use the specified environment variable to
load the value for the useLenientSaltSizeCheck
property.
|
void |
setUseLenientSaltSizeCheckSysPropertyName(String useLenientSaltSizeCheckSysPropertyName)
Set the config object to use the specified JVM system property to
load the value for the useLenientSaltSizeCheck
property.
|
getAlgorithm, getInvertPositionOfPlainSaltInEncryptionResults, getInvertPositionOfSaltInMessageBeforeDigesting, getIterations, getPoolSize, getProvider, getProviderName, getSaltGenerator, getSaltSizeBytes, getUseLenientSaltSizeCheck
public EnvironmentDigesterConfig()
Creates a new EnvironmentDigesterConfig instance.
public String getAlgorithmEnvName()
public void setAlgorithmEnvName(String algorithmEnvName)
algorithmEnvName
- the name of the environment variablepublic String getAlgorithmSysPropertyName()
public void setAlgorithmSysPropertyName(String algorithmSysPropertyName)
algorithmSysPropertyName
- the name of the propertypublic String getIterationsEnvName()
public void setIterationsEnvName(String iterationsEnvName)
iterationsEnvName
- the name of the environment variablepublic String getIterationsSysPropertyName()
public void setIterationsSysPropertyName(String iterationsSysPropertyName)
iterationsSysPropertyName
- the name of the propertypublic String getSaltSizeBytesEnvName()
public void setSaltSizeBytesEnvName(String saltSizeBytesEnvName)
saltSizeBytesEnvName
- the name of the environment variablepublic String getSaltSizeBytesSysPropertyName()
public void setSaltSizeBytesSysPropertyName(String saltSizeBytesSysPropertyName)
saltSizeBytesSysPropertyName
- the name of the propertypublic String getSaltGeneratorClassNameEnvName()
public void setSaltGeneratorClassNameEnvName(String saltGeneratorClassNameEnvName)
Set the config object to use the specified environment variable to load the value for the salt generator class name.
The salt generator class name which is set here must have a no-argument constructor, so that it can be instantiated and passed to the digester.
saltGeneratorClassNameEnvName
- the name of the environment variablepublic String getSaltGeneratorClassNameSysPropertyName()
public void setSaltGeneratorClassNameSysPropertyName(String saltGeneratorClassNameSysPropertyName)
Set the config object to use the specified JVM system property to load the value for the salt generator class name.
The salt generator class name which is set here must have a no-argument constructor, so that it can be instantiated and passed to the digester.
saltGeneratorClassNameSysPropertyName
- the name of the propertypublic String getProviderNameEnvName()
public void setProviderNameEnvName(String providerNameEnvName)
Set the config object to use the specified environment variable to load the value for the provider name.
providerNameEnvName
- the name of the environment variablepublic String getProviderNameSysPropertyName()
public void setProviderNameSysPropertyName(String providerNameSysPropertyName)
providerNameSysPropertyName
- the name of the propertypublic String getProviderClassNameEnvName()
public void setProviderClassNameEnvName(String providerClassNameEnvName)
Set the config object to use the specified environment variable to load the value for the provider class name.
The provider class name which is set here must have a no-argument constructor, so that it can be instantiated and passed to the digester.
providerClassNameEnvName
- the name of the environment variablepublic String getProviderClassNameSysPropertyName()
public void setProviderClassNameSysPropertyName(String providerClassNameSysPropertyName)
Set the config object to use the specified JVM system property to load the value for the provider class name.
The provider class name which is set here must have a no-argument constructor, so that it can be instantiated and passed to the digester.
providerClassNameSysPropertyName
- the name of the propertypublic String getInvertPositionOfSaltInMessageBeforeDigestingEnvName()
public void setInvertPositionOfSaltInMessageBeforeDigestingEnvName(String invertPositionOfSaltInMessageBeforeDigestingEnvName)
Set the config object to use the specified environment variable to load the value for the invertPositionOfSaltInMessageBeforeDigesting property.
invertPositionOfSaltInMessageBeforeDigestingEnvName
- the name of the environment variablepublic String getInvertPositionOfSaltInMessageBeforeDigestingSysPropertyName()
public void setInvertPositionOfSaltInMessageBeforeDigestingSysPropertyName(String invertPositionOfSaltInMessageBeforeDigestingSysPropertyName)
Set the config object to use the specified JVM system property to load the value for the invertPositionOfSaltInMessageBeforeDigesting property.
invertPositionOfSaltInMessageBeforeDigestingSysPropertyName
- the name of the propertypublic String getInvertPositionOfPlainSaltInEncryptionResultsEnvName()
public void setInvertPositionOfPlainSaltInEncryptionResultsEnvName(String invertPositionOfPlainSaltInEncryptionResultsEnvName)
Set the config object to use the specified environment variable to load the value for the invertPositionOfPlainSaltInEncryptionResults property.
invertPositionOfPlainSaltInEncryptionResultsEnvName
- the name of the environment variablepublic String getInvertPositionOfPlainSaltInEncryptionResultsSysPropertyName()
public void setInvertPositionOfPlainSaltInEncryptionResultsSysPropertyName(String invertPositionOfPlainSaltInEncryptionResultsSysPropertyName)
Set the config object to use the specified JVM system property to load the value for the invertPositionOfPlainSaltInEncryptionResults property.
invertPositionOfPlainSaltInEncryptionResultsSysPropertyName
- the name of the propertypublic String getUseLenientSaltSizeCheckEnvName()
public void setUseLenientSaltSizeCheckEnvName(String useLenientSaltSizeCheckEnvName)
Set the config object to use the specified environment variable to load the value for the useLenientSaltSizeCheck property.
useLenientSaltSizeCheckEnvName
- the name of the environment variablepublic String getUseLenientSaltSizeCheckSysPropertyName()
public void setUseLenientSaltSizeCheckSysPropertyName(String useLenientSaltSizeCheckSysPropertyName)
Set the config object to use the specified JVM system property to load the value for the useLenientSaltSizeCheck property.
useLenientSaltSizeCheckSysPropertyName
- the name of the propertypublic String getPoolSizeEnvName()
public void setPoolSizeEnvName(String poolSizeEnvName)
Set the config object to use the specified environment variable to load the value for the poolSize property.
poolSizeEnvName
- the name of the environment variablepublic String getPoolSizeSysPropertyName()
public void setPoolSizeSysPropertyName(String poolSizeSysPropertyName)
Set the config object to use the specified JVM system property to load the value for the useLenientSaltSizeCheck property.
poolSizeSysPropertyName
- the name of the propertypublic void setAlgorithm(String algorithm)
SimpleDigesterConfig
Sets the name of the algorithm.
This algorithm has to be supported by your security infrastructure, and it should be allowed as an algorithm for creating java.security.MessageDigest instances.
If you are specifying a security provider with SimpleDigesterConfig.setProvider(Provider)
or
SimpleDigesterConfig.setProviderName(String)
, this algorithm should be
supported by your specified provider.
If you are not specifying a provider, you will be able to use those algorithms provided by the default security provider of your JVM vendor. For valid names in the Sun JVM, see Java Cryptography Architecture API Specification & Reference.
Determines the result of: SimpleDigesterConfig.getAlgorithm()
setAlgorithm
in class SimpleDigesterConfig
algorithm
- the name of the algorithm.public void setIterations(Integer iterations)
SimpleDigesterConfig
Sets the number of hashing iterations.
If not set, null will be returned.
Determines the result of: SimpleDigesterConfig.getIterations()
setIterations
in class SimpleDigesterConfig
iterations
- the number of iterations.public void setIterations(String iterations)
SimpleDigesterConfig
Sets the number of hashing iterations.
If not set, null will be returned.
Determines the result of: SimpleDigesterConfig.getIterations()
setIterations
in class SimpleDigesterConfig
iterations
- the number of iterations.public void setSaltSizeBytes(Integer saltSizeBytes)
SimpleDigesterConfig
Size in bytes of the salt to be used.
If not set, null will be returned.
Determines the result of: SimpleDigesterConfig.getSaltSizeBytes()
setSaltSizeBytes
in class SimpleDigesterConfig
saltSizeBytes
- the size of the salt, in bytes.public void setSaltSizeBytes(String saltSizeBytes)
SimpleDigesterConfig
Size in bytes of the salt to be used.
If not set, null will be returned.
Determines the result of: SimpleDigesterConfig.getSaltSizeBytes()
setSaltSizeBytes
in class SimpleDigesterConfig
saltSizeBytes
- the size of the salt, in bytes.public void setSaltGenerator(SaltGenerator saltGenerator)
SimpleDigesterConfig
Sets the salt generator.
If not set, null will be returned.
Determines the result of: SimpleDigesterConfig.getSaltGenerator()
setSaltGenerator
in class SimpleDigesterConfig
saltGenerator
- the salt generator.public void setSaltGeneratorClassName(String saltGeneratorClassName)
SimpleDigesterConfig
Sets the class name of the salt generator.
If not set, null will be returned.
Determines the result of: SimpleDigesterConfig.getSaltGenerator()
setSaltGeneratorClassName
in class SimpleDigesterConfig
saltGeneratorClassName
- the name of the salt generator class.public void setProviderName(String providerName)
SimpleDigesterConfig
Sets the name of the security provider to be asked for the digest algorithm. This provider should be already registered.
If both the providerName and provider properties are set, only provider will be used, and providerName will have no meaning for the digester object.
If not set, null will be returned.
Determines the result of: SimpleDigesterConfig.getProviderName()
setProviderName
in class SimpleDigesterConfig
providerName
- the name of the security provider.public void setProvider(Provider provider)
SimpleDigesterConfig
Sets the security provider to be used for obtaining the digest
algorithm. This method is an alternative to
both SimpleDigesterConfig.setProviderName(String)
and
SimpleDigesterConfig.setProviderClassName(String)
and they should not be used
altogether.
The provider specified with SimpleDigesterConfig.setProvider(Provider)
does not
have to be registered beforehand, and its use will not result in its
being registered.
If both the providerName and provider properties are set, only provider will be used, and providerName will have no meaning for the digester object.
If not set, null will be returned.
Determines the result of: SimpleDigesterConfig.getProvider()
setProvider
in class SimpleDigesterConfig
provider
- the security provider object.public void setProviderClassName(String providerClassName)
SimpleDigesterConfig
Sets the class name for the security provider to be used for
obtaining the digest algorithm. This method is an alternative to
both SimpleDigesterConfig.setProviderName(String)
SimpleDigesterConfig.setProvider(Provider)
and they should not be used altogether.
The provider specified with SimpleDigesterConfig.setProviderClassName(String)
does not
have to be registered beforehand, and its use will not result in its
being registered.
If both the providerName and provider properties are set, only provider will be used, and providerName will have no meaning for the digester object.
If not set, null will be returned.
Determines the result of: SimpleDigesterConfig.getProvider()
setProviderClassName
in class SimpleDigesterConfig
providerClassName
- the name of the security provider class.public void setInvertPositionOfPlainSaltInEncryptionResults(Boolean invertPositionOfPlainSaltInEncryptionResults)
SimpleDigesterConfig
Whether 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}).
If not set, null will be returned.
Determines the result of: SimpleDigesterConfig.getInvertPositionOfPlainSaltInEncryptionResults()
setInvertPositionOfPlainSaltInEncryptionResults
in class SimpleDigesterConfig
invertPositionOfPlainSaltInEncryptionResults
- whether plain salt will be appended after the digest operation
result instead of inserted before it (which is the
default).public void setInvertPositionOfSaltInMessageBeforeDigesting(Boolean invertPositionOfSaltInMessageBeforeDigesting)
SimpleDigesterConfig
Whether 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}).
If not set, null will be returned.
Determines the result of: SimpleDigesterConfig.getInvertPositionOfSaltInMessageBeforeDigesting()
setInvertPositionOfSaltInMessageBeforeDigesting
in class SimpleDigesterConfig
invertPositionOfSaltInMessageBeforeDigesting
- whether salt will be appended after the message before applying
the digest operation on the whole, instead of inserted before it
(which is the default).public void setUseLenientSaltSizeCheck(Boolean useLenientSaltSizeCheck)
SimpleDigesterConfig
Whether 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.
If not set, null will be returned.
Determines the result of: SimpleDigesterConfig.getUseLenientSaltSizeCheck()
setUseLenientSaltSizeCheck
in class SimpleDigesterConfig
useLenientSaltSizeCheck
- whether the digester will allow matching of
digests with different salt sizes than established or not (default
is false).public void setPoolSize(Integer poolSize)
SimpleDigesterConfig
Sets the size of the pool of digesters to be created.
This parameter will be ignored if used with a non-pooled digester.
If not set, null will be returned.
Determines the result of: SimpleDigesterConfig.getPoolSize()
setPoolSize
in class SimpleDigesterConfig
poolSize
- the size of the pool to be used if this configuration is used with a
pooled digesterpublic void setPoolSize(String poolSize)
SimpleDigesterConfig
Sets the size of the pool of digesters to be created.
This parameter will be ignored if used with a non-pooled digester.
If not set, null will be returned.
Determines the result of: SimpleDigesterConfig.getPoolSize()
setPoolSize
in class SimpleDigesterConfig
poolSize
- the size of the pool to be used if this configuration is used with a
pooled digesterCopyright © 2016 JBoss by Red Hat. All rights reserved.