|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Objectorg.jasypt.encryption.pbe.config.SimplePBEConfig
public class SimplePBEConfig
Bean implementation for PBEConfig
. This class allows
the values for the configuration parameters to be set
via "standard" setX methods.
For any of the configuration parameters, if its setX method is not called, a null value will be returned by the corresponding getX method.
Note that there is not an exact correspondence between setX() and getX() methods, as sometimes two methods like setProvider() and setProviderClassName() will affect the same configuration parameter (getProvider()). This means that several combinations of setX() methods collide, and should not be called together (a call to setProviderClassName() will override any previous call to setProvider()).
Constructor Summary | |
---|---|
SimplePBEConfig()
Creates a new SimplePBEConfig instance. |
Method Summary | |
---|---|
String |
getAlgorithm()
Returns the algorithm to be used for encryption, like PBEWithMD5AndDES. |
Integer |
getKeyObtentionIterations()
Returns the number of hashing iterations applied to obtain the encryption key. |
String |
getPassword()
Returns the password to be used. |
java.security.Provider |
getProvider()
Returns the java.security.Provider implementation object to be used by the encryptor for obtaining the encryption algorithm. |
String |
getProviderName()
Returns the name of the java.security.Provider implementation to be used by the encryptor for obtaining the encryption algorithm. |
SaltGenerator |
getSaltGenerator()
Returns a SaltGenerator implementation to be used by the
encryptor. |
void |
setAlgorithm(String algorithm)
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. |
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 |
setPassword(String password)
Sets the password to be used for encryption. |
void |
setProvider(java.security.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 |
setProviderName(String providerName)
Sets the name of the security provider to be asked for the encryption algorithm. |
void |
setSaltGenerator(SaltGenerator saltGenerator)
Sets the salt generator. |
void |
setSaltGeneratorClassName(String saltGeneratorClassName)
Sets the salt generator. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SimplePBEConfig()
Creates a new SimplePBEConfig instance.
Method Detail |
---|
public void setAlgorithm(String algorithm)
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: getAlgorithm()
algorithm
- the name of the algorithm to be usedpublic void setPassword(String password)
Determines the result of: getPassword()
password
- the password to be used.public void setKeyObtentionIterations(Integer keyObtentionIterations)
Determines the result of: getKeyObtentionIterations()
keyObtentionIterations
- the number of iterations.public void setKeyObtentionIterations(String keyObtentionIterations)
Determines the result of: getKeyObtentionIterations()
keyObtentionIterations
- the number of iterations.public void setSaltGenerator(SaltGenerator saltGenerator)
Sets the salt generator.
If not set, null will returned.
Determines the result of: getSaltGenerator()
saltGenerator
- the salt generator.public void setSaltGeneratorClassName(String saltGeneratorClassName)
Sets the salt generator.
If not set, null will returned.
Determines the result of: getSaltGenerator()
saltGeneratorClassName
- the name of the salt generator class.public void setProviderName(String providerName)
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: getProviderName()
providerName
- the name of the security provider.public void setProvider(java.security.Provider provider)
Sets the security provider to be used for obtaining the encryption
algorithm. This method is an alternative to
both setProviderName(String)
and
setProviderClassName(String)
and they should not be used
altogether.
The provider specified with 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: getProvider()
provider
- the security provider object.public void setProviderClassName(String providerClassName)
Sets the security provider to be used for obtaining the encryption
algorithm. This method is an alternative to
both setProviderName(String)
and setProvider(Provider)
and they should not be used altogether.
The provider specified with 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: getProvider()
providerClassName
- the name of the security provider class.public String getAlgorithm()
PBEConfig
Returns the algorithm to be used for encryption, like PBEWithMD5AndDES.
This algorithm has to be supported by the specified JCE provider (or the default one if no provider has been specified) and, if the provider supports it, you can also specify mode and padding for it, like ALGORITHM/MODE/PADDING.
getAlgorithm
in interface PBEConfig
public String getPassword()
PBEConfig
Returns the password to be used.
There is no default value for password, so not setting
this parameter either from a
PBEConfig
object or from
a call to setPassword will result in an
EncryptionInitializationException being thrown during initialization.
getPassword
in interface PBEConfig
public Integer getKeyObtentionIterations()
PBEConfig
Returns the number of hashing iterations applied to obtain the encryption key.
This mechanism is explained in PKCS #5: Password-Based Cryptography Standard.
getKeyObtentionIterations
in interface PBEConfig
public SaltGenerator getSaltGenerator()
PBEConfig
Returns a SaltGenerator
implementation to be used by the
encryptor.
If this method returns null, the encryptor will ignore the config object when deciding the salt generator to be used.
getSaltGenerator
in interface PBEConfig
public String getProviderName()
PBEConfig
Returns the name of the java.security.Provider implementation to be used by the encryptor for obtaining the encryption algorithm. This provider must have been registered beforehand.
If this method returns null, the encryptor 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 PBEConfig.getProvider()
,
providerName will be ignored, and the provider object returned
by getProvider() will be used.
getProviderName
in interface PBEConfig
public java.security.Provider getProvider()
PBEConfig
Returns the java.security.Provider implementation object to be used by the encryptor for obtaining the encryption algorithm.
If this method returns null, the encryptor will ignore this parameter when deciding the security provider object to be used.
If this method does not return null, and neither does PBEConfig.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.
getProvider
in interface PBEConfig
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |