net.sourceforge.jcetaglib.lib
Class Keystore

java.lang.Object
  extended bynet.sourceforge.jcetaglib.lib.Keystore

public class Keystore
extends java.lang.Object

Load & generate symmetric keystores

Version:
$Id: Keystore.java,v 1.3 2004/04/15 07:28:25 hamgert Exp $
Author:
Gert Van Ham, hamgert@users.sourceforge.net, http://jcetaglib.sourceforge.net

Constructor Summary
Keystore()
           
 
Method Summary
static void generateKey(java.lang.String algorithm, int strength, byte[] seed, java.lang.String file, java.lang.StringBuffer passphrase)
          Generates a secret (= symmetric) key object and store it in a file
static java.security.Key loadKey(java.lang.String algorithm, java.lang.String file, java.lang.StringBuffer passphrase)
          Load the secret (= symmetric) key object from the keystore
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Keystore

public Keystore()
Method Detail

generateKey

public static void generateKey(java.lang.String algorithm,
                               int strength,
                               byte[] seed,
                               java.lang.String file,
                               java.lang.StringBuffer passphrase)
                        throws KeystoreException
Generates a secret (= symmetric) key object and store it in a file

Parameters:
algorithm - encryption algorithm (e.g. "Rijndael")
strength - the keysize in bits (e.g. 128)
seed - seed for SecureRandom (optional)
file - the file(name) to store the key
passphrase - the passphrase for the keystore
Throws:
KeystoreException - for all errors

loadKey

public static java.security.Key loadKey(java.lang.String algorithm,
                                        java.lang.String file,
                                        java.lang.StringBuffer passphrase)
                                 throws KeystoreException
Load the secret (= symmetric) key object from the keystore

Parameters:
algorithm - String encryption algorithm (e.g. "Rijndael")
file - String the keystore file(name)
passphrase - StringBuffer the passphrase for the keystore
Returns:
Keystore secretkey object
Throws:
KeystoreException - for all errors