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

Quick Search    Search Deep

javax.crypto.spec
Class PBEKeySpec  view PBEKeySpec download PBEKeySpec.java

java.lang.Object
  extended byjavax.crypto.spec.PBEKeySpec
All Implemented Interfaces:
java.security.spec.KeySpec

public class PBEKeySpec
extends java.lang.Object
implements java.security.spec.KeySpec

A wrapper for a password-based key, used for password-based encryption (PBE).

Examples of password-based encryption algorithms include:

Since:
1.4

Field Summary
private  int iterationCount
          The iteration count.
private  int keyLength
          The generated key length.
private  char[] password
          The password.
private  byte[] salt
          The salt.
 
Constructor Summary
PBEKeySpec(char[] password)
          Create a new PBE key spec with just a password.
PBEKeySpec(char[] password, byte[] salt, int iterationCount)
          Create a PBE key spec with a password, salt, and iteration count.
PBEKeySpec(char[] password, byte[] salt, int iterationCount, int keyLength)
          Create a PBE key spec with a password, salt, iteration count, and key length.
 
Method Summary
 void clearPassword()
          Clear the password array by filling it with null characters.
 int getIterationCount()
          Get the iteration count, or 0 if it has not been specified.
 int getKeyLength()
          Get the generated key length, or 0 if it has not been specified.
 char[] getPassword()
          Get the password character array.
 byte[] getSalt()
          Get the salt bytes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

iterationCount

private int iterationCount
The iteration count.


keyLength

private int keyLength
The generated key length.


password

private char[] password
The password.


salt

private byte[] salt
The salt.

Constructor Detail

PBEKeySpec

public PBEKeySpec(char[] password)
Create a new PBE key spec with just a password.


PBEKeySpec

public PBEKeySpec(char[] password,
                  byte[] salt,
                  int iterationCount)
Create a PBE key spec with a password, salt, and iteration count.


PBEKeySpec

public PBEKeySpec(char[] password,
                  byte[] salt,
                  int iterationCount,
                  int keyLength)
Create a PBE key spec with a password, salt, iteration count, and key length.

Method Detail

clearPassword

public final void clearPassword()
Clear the password array by filling it with null characters.


getIterationCount

public final int getIterationCount()
Get the iteration count, or 0 if it has not been specified.


getKeyLength

public final int getKeyLength()
Get the generated key length, or 0 if it has not been specified.


getPassword

public final char[] getPassword()
Get the password character array.


getSalt

public final byte[] getSalt()
Get the salt bytes.