PBKDF2KeyImpl(PBEKeySpec keySpec,String prfAlgo) throws InvalidKeySpecException {
  char[] passwd=keySpec.getPassword();
  if (passwd == null) {
    this.passwd=new char[0];
  }
 else {
    this.passwd=passwd.clone();
  }
  byte[] passwdBytes=getPasswordBytes(this.passwd);
  this.salt=keySpec.getSalt();
  if (salt == null) {
    throw new InvalidKeySpecException("Salt not found");
  }
  this.iterCount=keySpec.getIterationCount();
  if (iterCount == 0) {
    throw new InvalidKeySpecException("Iteration count not found");
  }
 else   if (iterCount < 0) {
    throw new InvalidKeySpecException("Iteration count is negative");
  }
  int keyLength=keySpec.getKeyLength();
  if (keyLength == 0) {
    throw new InvalidKeySpecException("Key length not found");
  }
 else   if (keyLength < 0) {
    throw new InvalidKeySpecException("Key length is negative");
  }
  try {
    this.prf=Mac.getInstance(prfAlgo,SunJCE.getInstance());
  }
 catch (  NoSuchAlgorithmException nsae) {
    InvalidKeySpecException ike=new InvalidKeySpecException();
    ike.initCause(nsae);
    throw ike;
  }
  this.key=deriveKey(prf,passwdBytes,salt,iterCount,keyLength);
}

PBKDF2KeyImpl ( PBEKeySpec keySpec , String prfAlgo ) throws InvalidKeySpecException { char [ ] passwd = keySpec . getPassword ( ) ; if ( passwd == null ) { this . passwd = new char [ 0 ] ; } else { this . passwd = passwd . clone ( ) ; } byte [ ] passwdBytes = getPasswordBytes ( this . passwd ) ; this . salt = keySpec . getSalt ( ) ; if ( salt == null ) { throw new InvalidKeySpecException ( "Salt not found" ) ; } this . iterCount = keySpec . getIterationCount ( ) ; if ( iterCount == 0 ) { throw new InvalidKeySpecException ( "Iteration count not found" ) ; } else if ( iterCount < 0 ) { throw new InvalidKeySpecException ( "Iteration count is negative" ) ; } int keyLength = keySpec . getKeyLength ( ) ; if ( keyLength == 0 ) { throw new InvalidKeySpecException ( "Key length not found" ) ; } else if ( keyLength < 0 ) { throw new InvalidKeySpecException ( "Key length is negative" ) ; } try { this . prf = Mac . getInstance ( prfAlgo , SunJCE . getInstance ( ) ) ; } catch ( NoSuchAlgorithmException nsae ) { InvalidKeySpecException ike = new InvalidKeySpecException ( ) ; ike . initCause ( nsae ) ; throw ike ; } this . key = deriveKey ( prf , passwdBytes , salt , iterCount , keyLength ) ; }
creates a pbe key from a given pbe key specification .
