edu.nyu.cs.pdsg.util
Class ShadowKeyDirectory

java.lang.Object
  extended byedu.nyu.cs.pdsg.util.ShadowKeyDirectory
All Implemented Interfaces:
KeyDirectoryInterface

public class ShadowKeyDirectory
extends java.lang.Object
implements KeyDirectoryInterface

KeyDirectory is a temporary hack which will allow us to provide public and private keys.

You must call KeyDirectory.init() before using any of it's functions


Field Summary
private static java.util.HashMap keyList
           
private static Reservoir keyReserv
           
private static java.lang.String saveFile
           
 
Constructor Summary
ShadowKeyDirectory(java.lang.String file)
          Initialize KeyDirectory with a given set of key/name associations
 
Method Summary
protected  java.security.KeyPair genKeyPair(java.lang.String name)
          Returns a newly generated KeyPair and associates it with the given name
protected  java.security.KeyPair getKeyPair(java.lang.String keyName)
          Returns the public and private keys associated with a given name
 java.util.Iterator getNamesIterator()
           
 java.security.PrivateKey getPrivateKey(java.lang.String keyName)
          Returns the private key associated with a given name
 java.security.PublicKey getPublicKey(java.lang.String keyName)
          Returns the public key associated with a given name
 boolean providesPrivate()
           
 boolean providesPublic()
           
protected  void save()
          Save the key/name associations to the file KeyDirectory was initialized with
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

keyList

private static java.util.HashMap keyList

keyReserv

private static Reservoir keyReserv

saveFile

private static java.lang.String saveFile
Constructor Detail

ShadowKeyDirectory

public ShadowKeyDirectory(java.lang.String file)
Initialize KeyDirectory with a given set of key/name associations

Parameters:
file - the key/name association file
Method Detail

providesPublic

public boolean providesPublic()
Specified by:
providesPublic in interface KeyDirectoryInterface
Returns:
true if this implementation can provide public keys

providesPrivate

public boolean providesPrivate()
Specified by:
providesPrivate in interface KeyDirectoryInterface
Returns:
true if this implementation can provide privatekeys

getNamesIterator

public java.util.Iterator getNamesIterator()
Returns:
a list of the names that have been loaded from the shadow file

getPublicKey

public java.security.PublicKey getPublicKey(java.lang.String keyName)
Returns the public key associated with a given name

Specified by:
getPublicKey in interface KeyDirectoryInterface
Parameters:
keyName - the name of the key
Returns:
the PublicKey associated with the name

getPrivateKey

public java.security.PrivateKey getPrivateKey(java.lang.String keyName)
Returns the private key associated with a given name

Specified by:
getPrivateKey in interface KeyDirectoryInterface
Parameters:
keyName - the name of the key
Returns:
the PrivateKey associated with the name

getKeyPair

protected java.security.KeyPair getKeyPair(java.lang.String keyName)
Returns the public and private keys associated with a given name

Parameters:
keyName - the name of the key
Returns:
the KeyPair associated with the name

genKeyPair

protected java.security.KeyPair genKeyPair(java.lang.String name)
Returns a newly generated KeyPair and associates it with the given name

Returns:
the generated KeyPair

save

protected void save()
             throws java.io.IOException
Save the key/name associations to the file KeyDirectory was initialized with

Throws:
java.io.IOException


Copyright (c) 2002-2003 New York University RLAB