spki.demo
Class Certifier

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

public class Certifier
extends Object

spki.demo Certifier class.

Version:
$Id: Certifier.java,v 1.9 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 cert_db
          the live master certificates database object.
private static String CERT_DBNAME
          the certificates database filename suffix.
static String CERTIFICATION_TAG_STRING
           
private  String db_id
           
private static String DBPATH
          databases's pathname prefix.
static int DEFAULT_KEY_LENGTH
           
static String DEFAULT_PUB_ALG
           
private  int key_length
          the key-length in bits.
private static String KEY_LENGTH_DBKEY
          the key-length's database index key.
private  String keyid
          the key-chain master key-pair's key-id.
private  HashDB main_db
          the main database object.
private static String MAIN_DBNAME
          the main database filename suffix.
private static String MASTER_KEYPAIR_DBKEY
          the certifier's key-pair's database index key.
private  PrivateKey privkey
          the certifider's private key.
private  String pub_alg
          the public-key algorithm-id.
private static String PUB_ALG_DBKEY
          the public-key algorithm-id's database index key.
private  PublicKey pubkey
          the certifier's public key.
private  int state
           
static int STATE_ALIVE
           
static int STATE_DEAD
           
static String[] STATES
           
 
Constructor Summary
Certifier()
          Create a brand new certifier, using the default algorithm and key-length.
Certifier(String db_id)
          Restore a live certifier with the specified database id.
Certifier(String pub_alg, int key_length)
          Create a brand new certifier, using the specified algorithm and key-length.
 
Method Summary
private  String buildDBname(String dbname)
           
 String certify(KeyChain chain)
          certify and initialize the given key-chain.
private  void closeDB()
          to be used by the finalize() method only!
private  void construct()
           
protected  void finalize()
           
 String getDBId()
          get this certifier's database id.
 PublicKey getMasterKey()
          get this certifier's public-key.
static KeyChain getNewKeyChain()
          generate a new key-chain.
 int getState()
          get the current state.
private  void openDB()
          to be used by construct() and restore() only!
 void restore(String db_id)
          restore a Certifier object from the database with the given db-id.
 
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.

DBPATH

private static final String DBPATH
databases's pathname prefix.

MAIN_DBNAME

private static final String MAIN_DBNAME
the main database filename suffix.

main_db

private HashDB main_db
the main database object.

CERT_DBNAME

private static final String CERT_DBNAME
the certificates database filename suffix.

cert_db

private HashDB cert_db
the live master certificates database object.

db_id

private String db_id

MASTER_KEYPAIR_DBKEY

private static final String MASTER_KEYPAIR_DBKEY
the certifier's key-pair's database index key.

PUB_ALG_DBKEY

private static final String PUB_ALG_DBKEY
the public-key algorithm-id's database index key.

KEY_LENGTH_DBKEY

private static final String KEY_LENGTH_DBKEY
the key-length's database index key.

pubkey

private PublicKey pubkey
the certifier's public key.

privkey

private PrivateKey privkey
the certifider's private key.

keyid

private String keyid
the key-chain master key-pair's key-id.

DEFAULT_PUB_ALG

public static final String DEFAULT_PUB_ALG

pub_alg

private String pub_alg
the public-key algorithm-id.

DEFAULT_KEY_LENGTH

public static final int DEFAULT_KEY_LENGTH

key_length

private int key_length
the key-length in bits.

STATE_DEAD

public static final int STATE_DEAD

STATE_ALIVE

public static final int STATE_ALIVE

state

private int state

STATES

public static final String[] STATES

CERTIFICATION_TAG_STRING

public static final String CERTIFICATION_TAG_STRING
Constructor Detail

Certifier

public Certifier()
          throws SPKIException
Create a brand new certifier, using the default algorithm and key-length. This constructor performs the following tasks:
  • generate and store the certifier's key-pair,
  • initialize all the databases used by the certifier.
    See Also:
    Certifier(String,int)

  • Certifier

    public Certifier(String pub_alg,
                     int key_length)
              throws SPKIException
    Create a brand new certifier, using the specified algorithm and key-length.
    See Also:
    Certifier()

    Certifier

    public Certifier(String db_id)
              throws SPKIException
    Restore a live certifier with the specified database id.
    See Also:
    Certifier(), Certifier(String,int)
    Method Detail

    finalize

    protected void finalize()
                     throws Throwable
    Overrides:
    finalize in class Object

    getState

    public int getState()
    get the current state.
    See Also:
    state, STATES

    getDBId

    public String getDBId()
    get this certifier's database id.

    getMasterKey

    public PublicKey getMasterKey()
    get this certifier's public-key.

    getNewKeyChain

    public static KeyChain getNewKeyChain()
                                   throws SPKIException
    generate a new key-chain.
    See Also:
    KeyChain

    certify

    public String certify(KeyChain chain)
                   throws SPKIException
    certify and initialize the given key-chain. this is done by issuing an attribute certificate that certify the key-chain's master public-key with the 'certified key-chain' tag.
    See Also:
    CERTIFICATION_TAG_STRING, KeyChain.initialize(PublicKey,Certificate)

    openDB

    private void openDB()
                 throws SPKIException
    to be used by construct() and restore() only!

    closeDB

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

    buildDBname

    private String buildDBname(String dbname)
                        throws SPKIException

    construct

    private void construct()
                    throws Exception

    restore

    public void restore(String db_id)
                 throws Exception
    restore a Certifier object from the database with the given db-id.