public class EnvironmentPBEConfig extends SimplePBEConfig
Implementation for PBEConfig
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 SimplePBEConfig
, 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 |
---|
EnvironmentPBEConfig()
Creates a new EnvironmentPBEConfig 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 |
getKeyObtentionIterationsEnvName()
Retrieve the name of the environment variable which value has been
loaded as the key obtention iteration count.
|
String |
getKeyObtentionIterationsSysPropertyName()
Retrieve the name of the JVM system property which value has been
loaded as the key obtention iteration count.
|
String |
getPasswordEnvName()
Retrieve the name of the environment variable which value has been
loaded as the password.
|
String |
getPasswordSysPropertyName()
Retrieve the name of the JVM system property which value has been
loaded as the password.
|
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.
|
void |
setAlgorithm(String algorithm)
Sets a value for the encryption 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 |
setKeyObtentionIterations(Integer keyObtentionIterations)
Sets the number of hashing iterations applied to obtain the
encryption key.
|
void |
setKeyObtentionIterations(String keyObtentionIterations)
Sets the number of hashing iterations applied to obtain the
encryption key.
|
void |
setKeyObtentionIterationsEnvName(String keyObtentionIterationsEnvName)
Set the config object to use the specified environment variable to
load the value for the key obtention iteration count.
|
void |
setKeyObtentionIterationsSysPropertyName(String keyObtentionIterationsSysPropertyName)
Set the config object to use the specified JVM system property to
load the value for the key obtention iteration count.
|
void |
setPassword(String password)
Sets the password to be used for encryption.
|
void |
setPasswordCharArray(char[] password)
Sets the password to be used for encryption, as a char[].
|
void |
setPasswordEnvName(String passwordEnvName)
Set the config object to use the specified environment variable to
load the value for the password.
|
void |
setPasswordSysPropertyName(String passwordSysPropertyName)
Set the config object to use the specified JVM system property to
load the value for the password.
|
void |
setPoolSize(Integer poolSize)
Sets the size of the pool of encryptors to be created.
|
void |
setPoolSize(String poolSize)
Sets the size of the pool of encryptors 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 encryption
algorithm.
|
void |
setProviderClassName(String providerClassName)
Sets the security provider to be used for obtaining the encryption
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 encryption
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 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.
|
cleanPassword, getAlgorithm, getKeyObtentionIterations, getPassword, getPasswordCharArray, getPoolSize, getProvider, getProviderName, getSaltGenerator
public EnvironmentPBEConfig()
Creates a new EnvironmentPBEConfig 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 getKeyObtentionIterationsEnvName()
public void setKeyObtentionIterationsEnvName(String keyObtentionIterationsEnvName)
keyObtentionIterationsEnvName
- the name of the environment variablepublic String getKeyObtentionIterationsSysPropertyName()
public void setKeyObtentionIterationsSysPropertyName(String keyObtentionIterationsSysPropertyName)
keyObtentionIterationsSysPropertyName
- the name of the propertypublic String getPasswordEnvName()
public void setPasswordEnvName(String passwordEnvName)
passwordEnvName
- the name of the environment variablepublic String getPasswordSysPropertyName()
public void setPasswordSysPropertyName(String passwordSysPropertyName)
passwordSysPropertyName
- 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 encryptor.
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 encryptor.
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 encryptor.
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 encryptor.
providerClassNameSysPropertyName
- 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)
SimplePBEConfig
Sets a value for the encryption algorithm
This algorithm has to be supported by your JCE provider and, if this provider supports it, you can also specify mode and padding for it, like ALGORITHM/MODE/PADDING.
Determines the result of: SimplePBEConfig.getAlgorithm()
setAlgorithm
in class SimplePBEConfig
algorithm
- the name of the algorithm to be usedpublic void setKeyObtentionIterations(Integer keyObtentionIterations)
SimplePBEConfig
Determines the result of: SimplePBEConfig.getKeyObtentionIterations()
setKeyObtentionIterations
in class SimplePBEConfig
keyObtentionIterations
- the number of iterations.public void setKeyObtentionIterations(String keyObtentionIterations)
SimplePBEConfig
Determines the result of: SimplePBEConfig.getKeyObtentionIterations()
setKeyObtentionIterations
in class SimplePBEConfig
keyObtentionIterations
- the number of iterations.public void setPassword(String password)
SimplePBEConfig
Determines the result of: SimplePBEConfig.getPassword()
and
SimplePBEConfig.getPasswordCharArray()
.
setPassword
in class SimplePBEConfig
password
- the password to be used.public void setPasswordCharArray(char[] password)
SimplePBEConfig
This allows the password to be specified as a cleanable char[] instead of a String, in extreme security conscious environments in which no copy of the password as an immutable String should be kept in memory.
Important: the array specified as a parameter WILL BE COPIED in order to be stored in the configuration object. The caller of this method will therefore be responsible for its cleaning (jasypt will only clean the internally stored copy).
Determines the result of: SimplePBEConfig.getPassword()
and
SimplePBEConfig.getPasswordCharArray()
.
setPasswordCharArray
in class SimplePBEConfig
password
- the password to be used.public void setSaltGenerator(SaltGenerator saltGenerator)
SimplePBEConfig
Sets the salt generator.
If not set, null will returned.
Determines the result of: SimplePBEConfig.getSaltGenerator()
setSaltGenerator
in class SimplePBEConfig
saltGenerator
- the salt generator.public void setSaltGeneratorClassName(String saltGeneratorClassName)
SimplePBEConfig
Sets the salt generator.
If not set, null will returned.
Determines the result of: SimplePBEConfig.getSaltGenerator()
setSaltGeneratorClassName
in class SimplePBEConfig
saltGeneratorClassName
- the name of the salt generator class.public void setProviderName(String providerName)
SimplePBEConfig
Sets the name of the security provider to be asked for the encryption 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 encryptor object.
If not set, null will be returned.
Determines the result of: SimplePBEConfig.getProviderName()
setProviderName
in class SimplePBEConfig
providerName
- the name of the security provider.public void setProvider(Provider provider)
SimplePBEConfig
Sets the security provider to be used for obtaining the encryption
algorithm. This method is an alternative to
both SimplePBEConfig.setProviderName(String)
and
SimplePBEConfig.setProviderClassName(String)
and they should not be used
altogether.
The provider specified with SimplePBEConfig.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 encryptor object.
If not set, null will be returned.
Determines the result of: SimplePBEConfig.getProvider()
setProvider
in class SimplePBEConfig
provider
- the security provider object.public void setProviderClassName(String providerClassName)
SimplePBEConfig
Sets the security provider to be used for obtaining the encryption
algorithm. This method is an alternative to
both SimplePBEConfig.setProviderName(String)
and SimplePBEConfig.setProvider(Provider)
and they should not be used altogether.
The provider specified with SimplePBEConfig.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 encryptor object.
If not set, null will be returned.
Determines the result of: SimplePBEConfig.getProvider()
setProviderClassName
in class SimplePBEConfig
providerClassName
- the name of the security provider class.public void setPoolSize(Integer poolSize)
SimplePBEConfig
Sets the size of the pool of encryptors to be created.
This parameter will be ignored if used with a non-pooled encryptor.
If not set, null will be returned.
Determines the result of: SimplePBEConfig.getPoolSize()
setPoolSize
in class SimplePBEConfig
poolSize
- the size of the pool to be used if this configuration is used with a
pooled encryptorpublic void setPoolSize(String poolSize)
SimplePBEConfig
Sets the size of the pool of encryptors to be created.
This parameter will be ignored if used with a non-pooled encryptor.
If not set, null will be returned.
Determines the result of: SimplePBEConfig.getPoolSize()
setPoolSize
in class SimplePBEConfig
poolSize
- the size of the pool to be used if this configuration is used with a
pooled encryptorCopyright © 2019 JBoss by Red Hat. All rights reserved.