Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * =============================================================================
   * 
   *   Copyright (c) 2007, The JASYPT team (http://www.jasypt.org)
   * 
   *   Licensed under the Apache License, Version 2.0 (the "License");
   *   you may not use this file except in compliance with the License.
   *   You may obtain a copy of the License at
   * 
  *       http://www.apache.org/licenses/LICENSE-2.0
  * 
  *   Unless required by applicable law or agreed to in writing, software
  *   distributed under the License is distributed on an "AS IS" BASIS,
  *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  *   See the License for the specific language governing permissions and
  *   limitations under the License.
  * 
  * =============================================================================
  */
 package org.jasypt.digest.config;
 
 

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

Objects of classes implementing this interface will provide values for:

  • Algorithm.
  • Salt size (in bytes).
  • Hashing iterations.
  • Salt generator.
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.

Author(s):
Daniel Fernández Garrido
Since:
1.0
 
 public interface DigesterConfig extends Serializable {

    

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.
 
     public String getAlgorithm();

    
    

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.
    public Integer getSaltSizeBytes();

    
    

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.
    public Integer getIterations();

    
    

Returns a org.jasypt.salt.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.
    
New to GrepCode? Check out our FAQ X