edu.vt.middleware.crypt.pbe
Class OpenSSLKeyGenerator

java.lang.Object
  extended by edu.vt.middleware.crypt.pbe.OpenSSLKeyGenerator
All Implemented Interfaces:
KeyGenerator

public class OpenSSLKeyGenerator
extends Object
implements KeyGenerator

Implements a password generation function compatible with the enc operation of OpenSSL in PBE mode. The function is based on a variant of the PBKDF1 key generation function described in PKCS#5v2, but uses an invariant MD5 hash and a fixed iteration count of 1.

Version:
$Revision: 2745 $
Author:
Middleware Services

Constructor Summary
OpenSSLKeyGenerator()
          Performs key generation without a salt value.
OpenSSLKeyGenerator(byte[] saltBytes)
          Creates a new key generator with the given salt bytes.
 
Method Summary
 byte[] generate(char[] password, int size)
          Generates a symmetric key from a password for use in password-based encryption schemes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OpenSSLKeyGenerator

public OpenSSLKeyGenerator()
Performs key generation without a salt value. This method is intended for compatibility with old OpenSSL versions or modern OpenSSL versions of the enc command with the -nosalt option.


OpenSSLKeyGenerator

public OpenSSLKeyGenerator(byte[] saltBytes)
Creates a new key generator with the given salt bytes.

Parameters:
saltBytes - Key generation function salt data.
Method Detail

generate

public byte[] generate(char[] password,
                       int size)
Generates a symmetric key from a password for use in password-based encryption schemes.

Specified by:
generate in interface KeyGenerator
Parameters:
password - Password used as basis for generated key.
size - Size of generated key in bits, unless otherwise noted.
Returns:
Secret key bytes.


Copyright © 2003-2013 Virginia Tech. All Rights Reserved.