iaik.security.cipher
Class PBEKey

java.lang.Object
  |
  +--iaik.security.cipher.PBEKey
All Implemented Interfaces:
Key, SecretKey, Serializable

public class PBEKey
extends Object
implements SecretKey

A secret key for PBE (Password Based Encryption).

Password based encryption as defined in PKCS#5 encrypts the given message with the DES algorithm in CBC mode using a secret key which is derived from a password with the MD2 or MD5 message digest algorithm. PKCS#5 recommends, that the password should consist of printable ASCII characters.

This class uses UTF8 for encoding the password. For password consisting of ASCII characters only this will give the default ASCII encoding.

E.g.: "Beavis" gives the following string of 6 bytes:

0x42 0x65 0x61 0x76 0x69 0x73

Version:
File Revision 16
See Also:
Serialized Form

Fields inherited from interface java.security.Key
serialVersionUID
 
Constructor Summary
PBEKey(char[] password)
          Creates a new PBEKey from a char array.
PBEKey(PBEKeySpec keySpec)
          Creates a new PBEKey from a PBEKeySpec.
PBEKey(String password)
          Creates a new PBEKey from a String.
 
Method Summary
 String getAlgorithm()
          Returns the algorithm name.
 byte[] getEncoded()
          Returns the password as byte array.
 String getFormat()
          Returns the format name.
 char[] getKey()
          Returns the password as char array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PBEKey

public PBEKey(String password)
Creates a new PBEKey from a String.
Parameters:
password - the password as a String

PBEKey

public PBEKey(PBEKeySpec keySpec)
Creates a new PBEKey from a PBEKeySpec.
Parameters:
keySpec - the password as KeySpec

PBEKey

public PBEKey(char[] password)
Creates a new PBEKey from a char array.
Parameters:
password - the password as a char array
Method Detail

getEncoded

public byte[] getEncoded()
Returns the password as byte array.
Specified by:
getEncoded in interface Key
Returns:
the password as byte array representing an UTF8 encoding of the password

getKey

public char[] getKey()
Returns the password as char array.
Returns:
the password as char array

getAlgorithm

public String getAlgorithm()
Returns the algorithm name.
Specified by:
getAlgorithm in interface Key
Returns:
"PBE"

getFormat

public String getFormat()
Returns the format name.
Specified by:
getFormat in interface Key
Returns:
"RAW"

This Javadoc may contain text parts from Internet Standard specifications (RFC 2459, 3280, 3039, 2560, 1521, 821, 822, 2253, 1319, 1321, ,2630, 2631, 2268, 3058, 2984, 2104, 2144, 2040, 2311, 2279, see copyright note) and RSA Data Security Public-Key Cryptography Standards (PKCS#1,3,5,7,8,9,10,12, see copyright note).

IAIK-JCE 3.1 with IAIK-JCE CC Core 3.1, (c) 1997-2004 IAIK