Class EnvironmentPBEConfig
- All Implemented Interfaces:
PBECleanablePasswordConfig, PBEConfig
- Direct Known Subclasses:
EnvironmentStringPBEConfig
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.
- Since:
- 1.1
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRetrieve the name of the environment variable which value has been loaded as the algorithm.Retrieve the name of the JVM system property which value has been loaded as the algorithm.Retrieve the name of the environment variable which value has been loaded as the IV generator class name.Retrieve the name of the JVM system property which value has been loaded as the IV generator class name.Retrieve the name of the environment variable which value has been loaded as the key obtention iteration count.Retrieve the name of the JVM system property which value has been loaded as the key obtention iteration count.Retrieve the name of the environment variable which value has been loaded as the password.Retrieve the name of the JVM system property which value has been loaded as the password.Retrieve the name of the environment variable which value has been loaded as the value for the poolSize property.Retrieve the name of the JVM system property which value has been loaded as the value for the poolSize property.Retrieve the name of the environment variable which value has been loaded as the provider class name.Retrieve the name of the JVM system property which value has been loaded as the provider class name.Retrieve the name of the environment variable which value has been loaded as the provider name.Retrieve the name of the JVM system property which value has been loaded as the provider name.Retrieve the name of the environment variable which value has been loaded as the salt generator class name.Retrieve the name of the JVM system property which value has been loaded as the salt generator class name.voidsetAlgorithm(String algorithm) Sets a value for the encryption algorithmvoidsetAlgorithmEnvName(String algorithmEnvName) Set the config object to use the specified environment variable to load the value for the algorithm.voidsetAlgorithmSysPropertyName(String algorithmSysPropertyName) Set the config object to use the specified JVM system property to load the value for the algorithm.voidsetIvGenerator(IvGenerator ivGenerator) Sets the IV generator.voidsetIvGeneratorClassName(String ivGeneratorClassName) Sets the IV generator.voidsetIvGeneratorClassNameEnvName(String ivGeneratorClassNameEnvName) Set the config object to use the specified environment variable to load the value for the IV generator class name.voidsetIvGeneratorClassNameSysPropertyName(String ivGeneratorClassNameSysPropertyName) Set the config object to use the specified JVM system property to load the value for the IV generator class name.voidsetKeyObtentionIterations(Integer keyObtentionIterations) Sets the number of hashing iterations applied to obtain the encryption key.voidsetKeyObtentionIterations(String keyObtentionIterations) Sets the number of hashing iterations applied to obtain the encryption key.voidsetKeyObtentionIterationsEnvName(String keyObtentionIterationsEnvName) Set the config object to use the specified environment variable to load the value for the key obtention iteration count.voidsetKeyObtentionIterationsSysPropertyName(String keyObtentionIterationsSysPropertyName) Set the config object to use the specified JVM system property to load the value for the key obtention iteration count.voidsetPassword(String password) Sets the password to be used for encryption.voidsetPasswordCharArray(char[] password) Sets the password to be used for encryption, as a char[].voidsetPasswordEnvName(String passwordEnvName) Set the config object to use the specified environment variable to load the value for the password.voidsetPasswordSysPropertyName(String passwordSysPropertyName) Set the config object to use the specified JVM system property to load the value for the password.voidsetPoolSize(Integer poolSize) Sets the size of the pool of encryptors to be created.voidsetPoolSize(String poolSize) Sets the size of the pool of encryptors to be created.voidsetPoolSizeEnvName(String poolSizeEnvName) Set the config object to use the specified environment variable to load the value for the poolSize property.voidsetPoolSizeSysPropertyName(String poolSizeSysPropertyName) Set the config object to use the specified JVM system property to load the value for the useLenientSaltSizeCheck property.voidsetProvider(Provider provider) Sets the security provider to be used for obtaining the encryption algorithm.voidsetProviderClassName(String providerClassName) Sets the security provider to be used for obtaining the encryption algorithm.voidsetProviderClassNameEnvName(String providerClassNameEnvName) Set the config object to use the specified environment variable to load the value for the provider class name.voidsetProviderClassNameSysPropertyName(String providerClassNameSysPropertyName) Set the config object to use the specified JVM system property to load the value for the provider class name.voidsetProviderName(String providerName) Sets the name of the security provider to be asked for the encryption algorithm.voidsetProviderNameEnvName(String providerNameEnvName) Set the config object to use the specified environment variable to load the value for the provider name.voidsetProviderNameSysPropertyName(String providerNameSysPropertyName) Set the config object to use the specified JVM system property to load the value for the provider name.voidsetSaltGenerator(SaltGenerator saltGenerator) Sets the salt generator.voidsetSaltGeneratorClassName(String saltGeneratorClassName) Sets the salt generator.voidsetSaltGeneratorClassNameEnvName(String saltGeneratorClassNameEnvName) Set the config object to use the specified environment variable to load the value for the salt generator class name.voidsetSaltGeneratorClassNameSysPropertyName(String saltGeneratorClassNameSysPropertyName) Set the config object to use the specified JVM system property to load the value for the salt generator class name.Methods inherited from class SimplePBEConfig
cleanPassword, getAlgorithm, getIvGenerator, getKeyObtentionIterations, getPassword, getPasswordCharArray, getPoolSize, getProvider, getProviderName, getSaltGenerator
-
Field Details
-
algorithmEnvName
-
keyObtentionIterationsEnvName
-
passwordEnvName
-
saltGeneratorClassNameEnvName
-
ivGeneratorClassNameEnvName
-
providerNameEnvName
-
providerClassNameEnvName
-
poolSizeEnvName
-
algorithmSysPropertyName
-
keyObtentionIterationsSysPropertyName
-
passwordSysPropertyName
-
saltGeneratorClassNameSysPropertyName
-
ivGeneratorClassNameSysPropertyName
-
providerNameSysPropertyName
-
providerClassNameSysPropertyName
-
poolSizeSysPropertyName
-
-
Constructor Details
-
EnvironmentPBEConfig
public EnvironmentPBEConfig()Creates a new EnvironmentPBEConfig instance.
-
-
Method Details
-
getAlgorithmEnvName
Retrieve the name of the environment variable which value has been loaded as the algorithm.- Returns:
- the name of the variable
-
setAlgorithmEnvName
Set the config object to use the specified environment variable to load the value for the algorithm.- Parameters:
algorithmEnvName- the name of the environment variable
-
getAlgorithmSysPropertyName
Retrieve the name of the JVM system property which value has been loaded as the algorithm.- Returns:
- the name of the property
-
setAlgorithmSysPropertyName
Set the config object to use the specified JVM system property to load the value for the algorithm.- Parameters:
algorithmSysPropertyName- the name of the property
-
getKeyObtentionIterationsEnvName
Retrieve the name of the environment variable which value has been loaded as the key obtention iteration count.- Returns:
- the name of the variable
-
setKeyObtentionIterationsEnvName
Set the config object to use the specified environment variable to load the value for the key obtention iteration count.- Parameters:
keyObtentionIterationsEnvName- the name of the environment variable
-
getKeyObtentionIterationsSysPropertyName
Retrieve the name of the JVM system property which value has been loaded as the key obtention iteration count.- Returns:
- the name of the property
-
setKeyObtentionIterationsSysPropertyName
Set the config object to use the specified JVM system property to load the value for the key obtention iteration count.- Parameters:
keyObtentionIterationsSysPropertyName- the name of the property
-
getPasswordEnvName
Retrieve the name of the environment variable which value has been loaded as the password.- Returns:
- the name of the variable
-
setPasswordEnvName
Set the config object to use the specified environment variable to load the value for the password.- Parameters:
passwordEnvName- the name of the environment variable
-
getPasswordSysPropertyName
Retrieve the name of the JVM system property which value has been loaded as the password.- Returns:
- the name of the property
-
setPasswordSysPropertyName
Set the config object to use the specified JVM system property to load the value for the password.- Parameters:
passwordSysPropertyName- the name of the property
-
getSaltGeneratorClassNameEnvName
Retrieve the name of the environment variable which value has been loaded as the salt generator class name.- Returns:
- the name of the variable
- Since:
- 1.3
-
setSaltGeneratorClassNameEnvName
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.
- Parameters:
saltGeneratorClassNameEnvName- the name of the environment variable- Since:
- 1.3
-
getSaltGeneratorClassNameSysPropertyName
Retrieve the name of the JVM system property which value has been loaded as the salt generator class name.- Returns:
- the name of the property
- Since:
- 1.3
-
setSaltGeneratorClassNameSysPropertyName
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.
- Parameters:
saltGeneratorClassNameSysPropertyName- the name of the property- Since:
- 1.3
-
getIvGeneratorClassNameEnvName
Retrieve the name of the environment variable which value has been loaded as the IV generator class name.- Returns:
- the name of the variable
- Since:
- 1.9.3
-
setIvGeneratorClassNameEnvName
Set the config object to use the specified environment variable to load the value for the IV generator class name.
The IV generator class name which is set here must have a no-argument constructor, so that it can be instantiated and passed to the encryptor.
- Parameters:
ivGeneratorClassNameEnvName- the name of the environment variable- Since:
- 1.9.3
-
getIvGeneratorClassNameSysPropertyName
Retrieve the name of the JVM system property which value has been loaded as the IV generator class name.- Returns:
- the name of the property
- Since:
- 1.9.3
-
setIvGeneratorClassNameSysPropertyName
Set the config object to use the specified JVM system property to load the value for the IV generator class name.
The IV generator class name which is set here must have a no-argument constructor, so that it can be instantiated and passed to the encryptor.
- Parameters:
ivGeneratorClassNameSysPropertyName- the name of the property- Since:
- 1.9.3
-
getProviderNameEnvName
Retrieve the name of the environment variable which value has been loaded as the provider name.- Returns:
- the name of the variable
- Since:
- 1.3
-
setProviderNameEnvName
Set the config object to use the specified environment variable to load the value for the provider name.
- Parameters:
providerNameEnvName- the name of the environment variable- Since:
- 1.3
-
getProviderNameSysPropertyName
Retrieve the name of the JVM system property which value has been loaded as the provider name.- Returns:
- the name of the property
- Since:
- 1.3
-
setProviderNameSysPropertyName
Set the config object to use the specified JVM system property to load the value for the provider name.- Parameters:
providerNameSysPropertyName- the name of the property- Since:
- 1.3
-
getProviderClassNameEnvName
Retrieve the name of the environment variable which value has been loaded as the provider class name.- Returns:
- the name of the variable
- Since:
- 1.3
-
setProviderClassNameEnvName
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.
- Parameters:
providerClassNameEnvName- the name of the environment variable- Since:
- 1.3
-
getProviderClassNameSysPropertyName
Retrieve the name of the JVM system property which value has been loaded as the provider class name.- Returns:
- the name of the property
- Since:
- 1.3
-
setProviderClassNameSysPropertyName
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.
- Parameters:
providerClassNameSysPropertyName- the name of the property- Since:
- 1.3
-
getPoolSizeEnvName
Retrieve the name of the environment variable which value has been loaded as the value for the poolSize property.- Returns:
- the name of the variable
- Since:
- 1.7
-
setPoolSizeEnvName
Set the config object to use the specified environment variable to load the value for the poolSize property.
- Parameters:
poolSizeEnvName- the name of the environment variable- Since:
- 1.7
-
getPoolSizeSysPropertyName
Retrieve the name of the JVM system property which value has been loaded as the value for the poolSize property.- Returns:
- the name of the property
- Since:
- 1.7
-
setPoolSizeSysPropertyName
Set the config object to use the specified JVM system property to load the value for the useLenientSaltSizeCheck property.
- Parameters:
poolSizeSysPropertyName- the name of the property- Since:
- 1.7
-
setAlgorithm
Description copied from class:SimplePBEConfigSets 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()- Overrides:
setAlgorithmin classSimplePBEConfig- Parameters:
algorithm- the name of the algorithm to be used
-
setKeyObtentionIterations
Description copied from class:SimplePBEConfigSets the number of hashing iterations applied to obtain the encryption key.Determines the result of:
SimplePBEConfig.getKeyObtentionIterations()- Overrides:
setKeyObtentionIterationsin classSimplePBEConfig- Parameters:
keyObtentionIterations- the number of iterations.
-
setKeyObtentionIterations
Description copied from class:SimplePBEConfigSets the number of hashing iterations applied to obtain the encryption key.Determines the result of:
SimplePBEConfig.getKeyObtentionIterations()- Overrides:
setKeyObtentionIterationsin classSimplePBEConfig- Parameters:
keyObtentionIterations- the number of iterations.
-
setPassword
Description copied from class:SimplePBEConfigSets the password to be used for encryption.Determines the result of:
SimplePBEConfig.getPassword()andSimplePBEConfig.getPasswordCharArray().- Overrides:
setPasswordin classSimplePBEConfig- Parameters:
password- the password to be used.
-
setPasswordCharArray
public void setPasswordCharArray(char[] password) Description copied from class:SimplePBEConfigSets the password to be used for encryption, as a char[].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()andSimplePBEConfig.getPasswordCharArray().- Overrides:
setPasswordCharArrayin classSimplePBEConfig- Parameters:
password- the password to be used.
-
setSaltGenerator
Description copied from class:SimplePBEConfigSets the salt generator.
If not set, null will returned.
Determines the result of:
SimplePBEConfig.getSaltGenerator()- Overrides:
setSaltGeneratorin classSimplePBEConfig- Parameters:
saltGenerator- the salt generator.
-
setSaltGeneratorClassName
Description copied from class:SimplePBEConfigSets the salt generator.
If not set, null will returned.
Determines the result of:
SimplePBEConfig.getSaltGenerator()- Overrides:
setSaltGeneratorClassNamein classSimplePBEConfig- Parameters:
saltGeneratorClassName- the name of the salt generator class.
-
setIvGenerator
Description copied from class:SimplePBEConfigSets the IV generator.
If not set, null will returned.
Determines the result of:
SimplePBEConfig.getIvGenerator()- Overrides:
setIvGeneratorin classSimplePBEConfig- Parameters:
ivGenerator- the IV generator.
-
setIvGeneratorClassName
Description copied from class:SimplePBEConfigSets the IV generator.
If not set, null will returned.
Determines the result of:
SimplePBEConfig.getIvGenerator()- Overrides:
setIvGeneratorClassNamein classSimplePBEConfig- Parameters:
ivGeneratorClassName- the name of the IV generator class.
-
setProviderName
Description copied from class:SimplePBEConfigSets 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()- Overrides:
setProviderNamein classSimplePBEConfig- Parameters:
providerName- the name of the security provider.
-
setProvider
Description copied from class:SimplePBEConfigSets the security provider to be used for obtaining the encryption algorithm. This method is an alternative to both
SimplePBEConfig.setProviderName(String)andSimplePBEConfig.setProviderClassName(String)and they should not be used altogether. The provider specified withSimplePBEConfig.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()- Overrides:
setProviderin classSimplePBEConfig- Parameters:
provider- the security provider object.
-
setProviderClassName
Description copied from class:SimplePBEConfigSets the security provider to be used for obtaining the encryption algorithm. This method is an alternative to both
SimplePBEConfig.setProviderName(String)andSimplePBEConfig.setProvider(Provider)and they should not be used altogether. The provider specified withSimplePBEConfig.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()- Overrides:
setProviderClassNamein classSimplePBEConfig- Parameters:
providerClassName- the name of the security provider class.
-
setPoolSize
Description copied from class:SimplePBEConfigSets 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()- Overrides:
setPoolSizein classSimplePBEConfig- Parameters:
poolSize- the size of the pool to be used if this configuration is used with a pooled encryptor
-
setPoolSize
Description copied from class:SimplePBEConfigSets 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()- Overrides:
setPoolSizein classSimplePBEConfig- Parameters:
poolSize- the size of the pool to be used if this configuration is used with a pooled encryptor
-