spki.demo
Class KeyChainManager

java.lang.Object
  |
  +--spki.demo.KeyChainManager

public class KeyChainManager
extends Object

spki.demo KeyChainManager class.

Version:
$Id: KeyChainManager.java,v 1.6 2002/07/25 17:51:41 tep Exp $
Author:
Tep Narula <tep@win.trlabs.ca>

Field Summary
private static String __ME
          This class's full name.
private  HashDB authchain_db
          the authorization-chain database object.
private static String AUTHCHAIN_DBNAME
          the authorization-chain database filename suffix.
private  String db_id
           
private static String DBPATH
          databases's pathname prefix.
private  KeyChain keychain
           
private  int keypool_size
           
private  String passcode
           
 
Constructor Summary
protected KeyChainManager()
          Default constructor.
  KeyChainManager(KeyChain chain, String oldcode, String newcode, int keypool_size)
          Personalize an initialized key-chain.
  KeyChainManager(String chain_id, String passcode, int keypool_size)
          Restore a personalized key-chain.
 
Method Summary
 void addAuthChain(Sequence chain)
          act as the wrapper for KeyChain.addAuthChain() and also add the new authorization chain to the local look-up cache for quick discovery later.
private  String buildAuthChainDBIndex(Principal issuer, Tag capability)
          create a look-up cache database key for the given authorizaiton chain, by combining the hash value of the root issuer's principal with the capability.
private  String buildAuthChainDBIndex(Sequence chain)
          create a look-up database key for the given authorizaiton chain.
private  String buildDBname(String dbname)
           
private  void closeDB()
          to be used by the finalize() method only!
protected  void finalize()
           
 Sequence getChain(Principal root_issuer, Tag capability)
          act as the wrapper for KeyChain.getAuthChain(), using the look-up cache to minimize authorization chain discovery time.
private  void openDB()
           
static Capability5Tuple reduce(Sequence chain)
          reduce the given authorization chain into a single 5-tuple.
 Sequence register(RootIssuer issuer, Tag capability)
          register the key-chain with the given Issuer for the given capability.
 AuthorizationRequest request(Monitor monitor, Principal root_issuer, Tag capability)
          act as the wrapper for KeyChain.request() and shorten the authorization chain discovery using the authorization chain look-up cache.
 RegistrationRequest request(PublicKey issuer, Tag capability)
          act as the wrapper for KeyChain.register().
 Sequence transfer(Sequence chain, RegistrationRequest request)
          act as the wrapper for KeyChain.transfer().
 
Methods inherited from class java.lang.Object
, clone, equals, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

__ME

private static final String __ME
This class's full name.

keychain

private KeyChain keychain

passcode

private String passcode

keypool_size

private int keypool_size

DBPATH

private static final String DBPATH
databases's pathname prefix.

AUTHCHAIN_DBNAME

private static final String AUTHCHAIN_DBNAME
the authorization-chain database filename suffix.

authchain_db

private HashDB authchain_db
the authorization-chain database object.

db_id

private String db_id
Constructor Detail

KeyChainManager

protected KeyChainManager()
Default constructor.

KeyChainManager

public KeyChainManager(KeyChain chain,
                       String oldcode,
                       String newcode,
                       int keypool_size)
                throws SPKIException
Personalize an initialized key-chain.
Throws:
SPKIException - if some error occured during creation.

KeyChainManager

public KeyChainManager(String chain_id,
                       String passcode,
                       int keypool_size)
                throws SPKIException
Restore a personalized key-chain.
Throws:
SPKIException - if some error occured during creation.
Method Detail

finalize

protected void finalize()
Overrides:
finalize in class Object

addAuthChain

public void addAuthChain(Sequence chain)
                  throws SPKIException
act as the wrapper for KeyChain.addAuthChain() and also add the new authorization chain to the local look-up cache for quick discovery later.
See Also:
KeyChain.addAuthChain(String,Sequence), buildAuthChainDBIndex(Sequence)

request

public AuthorizationRequest request(Monitor monitor,
                                    Principal root_issuer,
                                    Tag capability)
                             throws SPKIException
act as the wrapper for KeyChain.request() and shorten the authorization chain discovery using the authorization chain look-up cache.
See Also:
KeyChain.request(String,Principal,String,Sexp,Principal,Tag), buildAuthChainDBIndex(Sequence)

request

public RegistrationRequest request(PublicKey issuer,
                                   Tag capability)
                            throws SPKIException
act as the wrapper for KeyChain.register().
See Also:
KeyChain.register(String,PublicKey,Sexp,Tag)

register

public Sequence register(RootIssuer issuer,
                         Tag capability)
                  throws SPKIException
register the key-chain with the given Issuer for the given capability. and also add the new authorization chain to the local look-up cache for quick discovery later.
See Also:
KeyChain.register(String,PublicKey,Sexp,Tag)

getChain

public Sequence getChain(Principal root_issuer,
                         Tag capability)
                  throws SPKIException
act as the wrapper for KeyChain.getAuthChain(), using the look-up cache to minimize authorization chain discovery time.
See Also:
KeyChain.getAuthChain(String,String)

transfer

public Sequence transfer(Sequence chain,
                         RegistrationRequest request)
                  throws SPKIException
act as the wrapper for KeyChain.transfer().
See Also:
KeyChain.transfer(String,String,RegistrationRequest)

reduce

public static Capability5Tuple reduce(Sequence chain)
                               throws SPKIException
reduce the given authorization chain into a single 5-tuple.

openDB

private void openDB()
             throws SPKIException

closeDB

private void closeDB()
              throws SPKIException
to be used by the finalize() method only!

buildDBname

private String buildDBname(String dbname)
                    throws SPKIException

buildAuthChainDBIndex

private String buildAuthChainDBIndex(Sequence chain)
                              throws SPKIException
create a look-up database key for the given authorizaiton chain. it's simply a front-end for buildAuthChainDBIndex(issuer, capablity).
See Also:
buildAuthChainDBIndex(Principal,Tag)

buildAuthChainDBIndex

private String buildAuthChainDBIndex(Principal issuer,
                                     Tag capability)
                              throws SPKIException
create a look-up cache database key for the given authorizaiton chain, by combining the hash value of the root issuer's principal with the capability.