org.jboss.seam.security.crypto
Class PBKDF2Parameters

java.lang.Object
  extended by org.jboss.seam.security.crypto.PBKDF2Parameters

public class PBKDF2Parameters
extends Object

Copied from Matthias Gartner's PKCS#5 implementation - see http://rtner.de/software/PBKDF2.html

Parameter data holder for PBKDF2 configuration.


A free Java implementation of Password Based Key Derivation Function 2 as defined by RFC 2898. Copyright (c) 2007 Matthias Gärtner

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

For Details, see http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.

Version:
1.0
Author:
Matthias Gärtner

Field Summary
protected  byte[] derivedKey
          The derived key is actually only a convenience to store a reference derived key.
protected  String hashAlgorithm
           
protected  String hashCharset
           
protected  int iterationCount
           
protected  byte[] salt
           
 
Constructor Summary
PBKDF2Parameters()
          Constructor.
PBKDF2Parameters(String hashAlgorithm, String hashCharset, byte[] salt, int iterationCount)
          Constructor.
PBKDF2Parameters(String hashAlgorithm, String hashCharset, byte[] salt, int iterationCount, byte[] derivedKey)
          Constructor.
 
Method Summary
 byte[] getDerivedKey()
           
 String getHashAlgorithm()
           
 String getHashCharset()
           
 int getIterationCount()
           
 byte[] getSalt()
           
 void setDerivedKey(byte[] derivedKey)
           
 void setHashAlgorithm(String hashAlgorithm)
           
 void setHashCharset(String hashCharset)
           
 void setIterationCount(int iterationCount)
           
 void setSalt(byte[] salt)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

salt

protected byte[] salt

iterationCount

protected int iterationCount

hashAlgorithm

protected String hashAlgorithm

hashCharset

protected String hashCharset

derivedKey

protected byte[] derivedKey
The derived key is actually only a convenience to store a reference derived key. It is not used during computation.

Constructor Detail

PBKDF2Parameters

public PBKDF2Parameters()
Constructor. Defaults to null for byte arrays, UTF-8 as character set and 1000 for iteration count.


PBKDF2Parameters

public PBKDF2Parameters(String hashAlgorithm,
                        String hashCharset,
                        byte[] salt,
                        int iterationCount)
Constructor.

Parameters:
hashAlgorithm - for example HMacSHA1 or HMacMD5
hashCharset - for example UTF-8
salt - Salt as byte array, may be null (not recommended)
iterationCount - Number of iterations to execute. Recommended value 1000.

PBKDF2Parameters

public PBKDF2Parameters(String hashAlgorithm,
                        String hashCharset,
                        byte[] salt,
                        int iterationCount,
                        byte[] derivedKey)
Constructor.

Parameters:
hashAlgorithm - for example HMacSHA1 or HMacMD5
hashCharset - for example UTF-8
salt - Salt as byte array, may be null (not recommended)
iterationCount - Number of iterations to execute. Recommended value 1000.
derivedKey - Convenience data holder, not used during computation.
Method Detail

getIterationCount

public int getIterationCount()

setIterationCount

public void setIterationCount(int iterationCount)

getSalt

public byte[] getSalt()

setSalt

public void setSalt(byte[] salt)

getDerivedKey

public byte[] getDerivedKey()

setDerivedKey

public void setDerivedKey(byte[] derivedKey)

getHashAlgorithm

public String getHashAlgorithm()

setHashAlgorithm

public void setHashAlgorithm(String hashAlgorithm)

getHashCharset

public String getHashCharset()

setHashCharset

public void setHashCharset(String hashCharset)