uk.ac.cam.ucs.webauth
Class Keystore

java.lang.Object
  extended byjava.security.KeyStoreSpi
      extended byuk.ac.cam.ucs.webauth.Keystore

public class Keystore
extends KeyStoreSpi

Implements an extremly simple in memory keystore. This is intended as a simple way to make authentication system public keys available to WebauthValidator if you want to manage the storage of the keys yourself. In many cases you would do better to use one of the keystores provided by your run-time enviromnent.

Version:
$Revision: 1.1 $ $Date: 2005/03/15 17:47:58 $

Constructor Summary
Keystore()
          Default constructor
 
Method Summary
 Enumeration engineAliases()
          Lists all the alias names of this keystore.
 boolean engineContainsAlias(String alias)
          Checks if the given alias exists in this keystore.
 void engineDeleteEntry(String alias)
          Deletes the entry identified by the given alias from this keystore.
 Certificate engineGetCertificate(String alias)
          Returns the certificate associated with the given alias.
 String engineGetCertificateAlias(Certificate cert)
          Returns the (alias) name of the first keystore entry whose certificate matches the given certificate.
 Certificate[] engineGetCertificateChain(String alias)
          Returns the certificate chain associated with the given alias.
 Date engineGetCreationDate(String alias)
          Returns the creation date of the entry identified by the given alias.
 Key engineGetKey(String alias, char[] password)
          Returns the key associated with the given alias, using the given password to recover it.
 boolean engineIsCertificateEntry(String alias)
          Returns true if the entry identified by the given alias is a trusted certificate entry, and false otherwise.
 boolean engineIsKeyEntry(String alias)
          Returns true if the entry identified by the given alias is a key entry, and false otherwise.
 void engineLoad(InputStream stream, char[] password)
          Loads the keystore from the given input stream.
 void engineSetCertificateEntry(String alias, Certificate cert)
          Assigns the given certificate to the given alias.
 void engineSetKeyEntry(String alias, byte[] key, Certificate[] chain)
          Assigns the given key (that has already been protected) to the given alias.
 void engineSetKeyEntry(String alias, Key key, char[] password, Certificate[] chain)
          Assigns the given key to the given alias, protecting it with the given password.
 int engineSize()
          Retrieves the number of entries in this keystore
 void engineStore(OutputStream stream, char[] password)
          Stores this keystore to the given output stream, and protects its integrity with the given password.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Keystore

public Keystore()
Default constructor

Method Detail

engineAliases

public Enumeration engineAliases()
Lists all the alias names of this keystore.


engineContainsAlias

public boolean engineContainsAlias(String alias)
Checks if the given alias exists in this keystore.


engineDeleteEntry

public void engineDeleteEntry(String alias)
                       throws KeyStoreException
Deletes the entry identified by the given alias from this keystore.

Throws:
KeyStoreException

engineGetCertificate

public Certificate engineGetCertificate(String alias)
Returns the certificate associated with the given alias.


engineGetCertificateAlias

public String engineGetCertificateAlias(Certificate cert)
Returns the (alias) name of the first keystore entry whose certificate matches the given certificate.


engineGetCertificateChain

public Certificate[] engineGetCertificateChain(String alias)
Returns the certificate chain associated with the given alias.


engineGetCreationDate

public Date engineGetCreationDate(String alias)
Returns the creation date of the entry identified by the given alias.


engineGetKey

public Key engineGetKey(String alias,
                        char[] password)
Returns the key associated with the given alias, using the given password to recover it.


engineIsCertificateEntry

public boolean engineIsCertificateEntry(String alias)
Returns true if the entry identified by the given alias is a trusted certificate entry, and false otherwise.


engineIsKeyEntry

public boolean engineIsKeyEntry(String alias)
Returns true if the entry identified by the given alias is a key entry, and false otherwise.


engineLoad

public void engineLoad(InputStream stream,
                       char[] password)
Loads the keystore from the given input stream.


engineSetCertificateEntry

public void engineSetCertificateEntry(String alias,
                                      Certificate cert)
Assigns the given certificate to the given alias.


engineSetKeyEntry

public void engineSetKeyEntry(String alias,
                              byte[] key,
                              Certificate[] chain)
                       throws KeyStoreException
Assigns the given key (that has already been protected) to the given alias.

Throws:
KeyStoreException

engineSetKeyEntry

public void engineSetKeyEntry(String alias,
                              Key key,
                              char[] password,
                              Certificate[] chain)
                       throws KeyStoreException
Assigns the given key to the given alias, protecting it with the given password.

Throws:
KeyStoreException

engineSize

public int engineSize()
Retrieves the number of entries in this keystore


engineStore

public void engineStore(OutputStream stream,
                        char[] password)
Stores this keystore to the given output stream, and protects its integrity with the given password.