org.jasypt.digest.config
Interface DigesterConfig

All Known Subinterfaces:
StringDigesterConfig
All Known Implementing Classes:
EnvironmentDigesterConfig, EnvironmentStringDigesterConfig, SimpleDigesterConfig, SimpleStringDigesterConfig

public interface DigesterConfig

Common interface for config classes applicable to StandardByteDigester or StandardStringDigester objects.

Objects of classes implementing this interface will provide values for:

Providing this interface lets the user create new DigesterConfig classes which retrieve values for this parameters from different (and maybe more secure) sources (remote servers, LDAP, other databases...), and do this transparently for the digester object.

The config objects passed to a digester will only be queried once for each configuration parameter, and this will happen during the initialization of the digester object.

For a default implementation, see SimpleDigesterConfig.

Since:
1.0
Author:
Daniel Fernández Garrido

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.
 

Method Detail

getAlgorithm

String getAlgorithm()

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.

Returns:
the name of the algorithm to be used, or null if this object will not want to set an algorithm. See Appendix A in the Java Cryptography Architecture API Specification & Reference for information about standard algorithm names.

getSaltSizeBytes

Integer getSaltSizeBytes()

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.

Returns:
the size of the salt to be used, in bytes, or null if this object will not want to set a size for salt.

getIterations

Integer getIterations()

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.

Returns:
the number of iterations, or null if this object will not want to set the number of iterations.

getSaltGenerator

SaltGenerator getSaltGenerator()

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.

Returns:
the salt generator, or null if this object will not want to set a specific SaltGenerator implementation.
Since:
1.2

getProviderName

String getProviderName()

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 getProvider(), providerName will be ignored, and the provider object returned by getProvider() will be used.

Returns:
the name of the security provider to be used.
Since:
1.3

getProvider

java.security.Provider getProvider()

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 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.

Returns:
the security provider object to be asked for the digest algorithm.
Since:
1.3


Copyright © 2008 The JASYPT team. All Rights Reserved.