|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Objectorg.jasypt.digest.config.SimpleDigesterConfig
public class SimpleDigesterConfig
Bean implementation for DigesterConfig
. 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 | |
---|---|
SimpleDigesterConfig()
Creates a new SimpleDigesterConfig instance. |
Method Summary | |
---|---|
String |
getAlgorithm()
Returns the name of an algorithm to be used for hashing, like "MD5" or "SHA-1". |
Integer |
getIterations()
Returns the number of times the hash function will be applied recursively. |
java.security.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. |
void |
setAlgorithm(String algorithm)
Sets the name of the algorithm. |
void |
setIterations(Integer iterations)
Sets the number of hashing iterations. |
void |
setIterations(String iterations)
Sets the number of hashing iterations. |
void |
setProvider(java.security.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 |
setProviderName(String providerName)
Sets the name of the security provider to be asked for the digest algorithm. |
void |
setSaltGenerator(SaltGenerator saltGenerator)
Sets the salt generator. |
void |
setSaltGeneratorClassName(String saltGeneratorClassName)
Sets the class name of the salt generator. |
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. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SimpleDigesterConfig()
Creates a new SimpleDigesterConfig instance.
Method Detail |
---|
public void setAlgorithm(String algorithm)
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 setProvider(Provider)
or
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: getAlgorithm()
algorithm
- the name of the algorithm.public void setIterations(Integer iterations)
Sets the number of hashing iterations.
If not set, null will be returned.
Determines the result of: getIterations()
iterations
- the number of iterations.public void setIterations(String iterations)
Sets the number of hashing iterations.
If not set, null will be returned.
Determines the result of: getIterations()
iterations
- the number of iterations.public void setSaltSizeBytes(Integer saltSizeBytes)
Size in bytes of the salt to be used.
If not set, null will be returned.
Determines the result of: getSaltSizeBytes()
saltSizeBytes
- the size of the salt, in bytes.public void setSaltSizeBytes(String saltSizeBytes)
Size in bytes of the salt to be used.
If not set, null will be returned.
Determines the result of: getSaltSizeBytes()
saltSizeBytes
- the size of the salt, in bytes.public void setSaltGenerator(SaltGenerator saltGenerator)
Sets the salt generator.
If not set, null will be returned.
Determines the result of: getSaltGenerator()
saltGenerator
- the salt generator.public void setSaltGeneratorClassName(String saltGeneratorClassName)
Sets the class name of the salt generator.
If not set, null will be 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 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: 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 digest
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 digester 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 class name for the security provider to be used for
obtaining the digest algorithm. This method is an alternative to
both setProviderName(String)
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 digester object.
If not set, null will be returned.
Determines the result of: getProvider()
providerClassName
- the name of the security provider class.public String getAlgorithm()
DigesterConfig
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.
getAlgorithm
in interface DigesterConfig
public Integer getIterations()
DigesterConfig
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.
getIterations
in interface DigesterConfig
public Integer getSaltSizeBytes()
DigesterConfig
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.
getSaltSizeBytes
in interface DigesterConfig
public SaltGenerator getSaltGenerator()
DigesterConfig
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.
getSaltGenerator
in interface DigesterConfig
public String getProviderName()
DigesterConfig
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 DigesterConfig.getProvider()
,
providerName will be ignored, and the provider object returned
by getProvider() will be used.
getProviderName
in interface DigesterConfig
public java.security.Provider getProvider()
DigesterConfig
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 DigesterConfig.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 DigesterConfig
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |