Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

gnu.javax.crypto.prng
Class PBKDF2  view PBKDF2 download PBKDF2.java

java.lang.Object
  extended bygnu.java.security.prng.BasePRNG
      extended bygnu.javax.crypto.prng.PBKDF2
All Implemented Interfaces:
java.lang.Cloneable, gnu.java.security.prng.IRandom

public class PBKDF2
extends gnu.java.security.prng.BasePRNG
implements java.lang.Cloneable

An implementation of the key derivation function KDF2 from PKCS #5: Password-Based Cryptography (PBE). This KDF is essentially a way to transform a password and a salt into a stream of random bytes, which may then be used to initialize a cipher or a MAC.

This version uses a MAC as its pseudo-random function, and the password is used as the key.

References:

  1. B. Kaliski, RFC 2898: Password-Based Cryptography Specification, Version 2.0


Field Summary
private  long count
          The number of hLen-sized blocks generated.
private  byte[] in
          The bytes fed into the MAC.
private  int iterationCount
          The iteration count.
private  gnu.javax.crypto.mac.IMac mac
          The MAC (the pseudo-random function we use).
private  byte[] salt
          The salt.
 
Fields inherited from class gnu.java.security.prng.BasePRNG
buffer, initialised, name, ndx
 
Constructor Summary
PBKDF2(gnu.javax.crypto.mac.IMac mac)
          Creates a new PBKDF2 object.
 
Method Summary
 void fillBlock()
           
 void setup(java.util.Map attributes)
           
 
Methods inherited from class gnu.java.security.prng.BasePRNG
addRandomByte, addRandomBytes, addRandomBytes, clone, init, isInitialised, name, nextByte, nextBytes, nextBytes
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

in

private byte[] in
The bytes fed into the MAC. This is initially the concatenation of the salt and the block number.


iterationCount

private int iterationCount
The iteration count.


salt

private byte[] salt
The salt.


mac

private gnu.javax.crypto.mac.IMac mac
The MAC (the pseudo-random function we use).


count

private long count
The number of hLen-sized blocks generated.

Constructor Detail

PBKDF2

public PBKDF2(gnu.javax.crypto.mac.IMac mac)

Creates a new PBKDF2 object. The argument is the MAC that will serve as the pseudo-random function. The MAC does not need to be initialized.

Method Detail

setup

public void setup(java.util.Map attributes)

fillBlock

public void fillBlock()
               throws gnu.java.security.prng.LimitReachedException