Class cryptix.pgp.KeyRing
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class cryptix.pgp.KeyRing

java.lang.Object
   |
   +----cryptix.pgp.KeyStore
           |
           +----cryptix.pgp.KeyRing

public class KeyRing
extends KeyStore
KeyRing is an abstract superclass for keyring objects - stores of keys (public and private) held in a file. PublicKeyRing, KeyCache and SecretKeyRing implement the specific behaviour of these different kinds of keyring files.

Note that a keyring is not automatically written out when it is destroyed. The application must call write() itself if it has added keys which is wishes to keep.

KeyRing is unlikely to be useful for any other superclasses. If you wish to implement a general key retrieval class, use KeyStore instead. If you wish to add file-specific behaviour, use PublicKeyRing or SecretKeyRing.

Future changes The next release will use a File object rather than a String to specify a filename in the constructor.

A remove() function may also be added.


Copyright © 1995, 1996, 1997 Systemics Ltd on behalf of the Cryptix Development Team. All rights reserved.

Author:
Systemics Ltd, Ian Brown, Jill Baker
See Also:
PublicKeyRing, KeyCache, SecretKeyRing

Variable Index

 o addresses
 o entrysById
 o users

Constructor Index

 o KeyRing()
 o KeyRing(InputStream)
 o KeyRing(String)

Method Index

 o add(KeyRingEntry)
Adds a key to this keyring.

You can't just add a Certificate - you need at least a UserId and KeyRingTrust packet, and possibly signatures and further UserIds as well.

KeyRingEntry contains all of this.

 o checkSignatures()
this will check the signatures assuming all the keys are in this ring
 o checkSignatures(KeyStore)
this will check the signature assuming that the KeyStore contains all the nec keys
 o dump(PrintStream)
debug dump of key ring
 o getFullNameList(KeyID)
Get a list of all the names on the key with ID keyID.
 o getFullUserNameList()
Get a list of all the usernames of keys on this keyring.
 o getIfBegins(Enumeration, String)
 o getKeyTrust(KeyID)
How much is the key with ID keyId trusted by this user?
 o getPublicKey(EmailAddress)
 o getPublicKey(KeyID)
 o getSecretKey(EmailAddress, Passphrase)
 o getSecretKey(KeyID, Passphrase)
 o getUserName(KeyID)
Returns the primary name of the user who owns the key referenced by keyID.

If their key is not available, the keyID is returned as a String.

 o init(PacketInputStream)
 o list(PrintStream)
debug list of signatures etc
 o write(OutputStream)
Writes out all KeyRingEntries contained in this keyring to outputStream.

Variables

 o users
  protected Hashtable users
 o addresses
  protected Hashtable addresses
 o entrysById
  protected Hashtable entrysById

Constructors

 o KeyRing
  protected KeyRing()
 o KeyRing
  protected KeyRing(InputStream in) throws IOException
 o KeyRing
  protected KeyRing(String filename) throws FileNotFoundException, IOException

Methods

 o getUserName
  public final String getUserName(KeyID keyID)
Returns the primary name of the user who owns the key referenced by keyID.

If their key is not available, the keyID is returned as a String. This mimics PGP's behaviour.

 o add
  public final void add(KeyRingEntry entry) throws FormatException
Adds a key to this keyring.

You can't just add a Certificate - you need at least a UserId and KeyRingTrust packet, and possibly signatures and further UserIds as well.

KeyRingEntry contains all of this.

 o getFullNameList
  public final String[] getFullNameList(KeyID keyID)
Get a list of all the names on the key with ID keyID.
 o getFullUserNameList
  public final String[] getFullUserNameList()
Get a list of all the usernames of keys on this keyring.
 o init
  protected abstract void init(PacketInputStream reader) throws IOException
 o getPublicKey
  protected final PublicKey getPublicKey(KeyID id)
 o getPublicKey
  protected final PublicKey getPublicKey(EmailAddress address)
 o getSecretKey
  protected final SecretKey getSecretKey(KeyID id,
                                         Passphrase passphrase) throws DecryptException
 o getSecretKey
  protected final SecretKey getSecretKey(EmailAddress address,
                                         Passphrase passphrase) throws DecryptException
 o getIfBegins
  protected final PublicKey getIfBegins(Enumeration e,
                                        String username) throws IOException
 o write
  public void write(OutputStream outputStream) throws IOException
Writes out all KeyRingEntries contained in this keyring to outputStream.
 o checkSignatures
  public boolean checkSignatures()
this will check the signatures assuming all the keys are in this ring
 o checkSignatures
  public boolean checkSignatures(KeyStore store)
this will check the signature assuming that the KeyStore contains all the nec keys
 o dump
  public final void dump(PrintStream out)
debug dump of key ring
 o list
  public final void list(PrintStream out)
debug list of signatures etc
 o getKeyTrust
  public int getKeyTrust(KeyID keyId)
How much is the key with ID keyId trusted by this user?

All Packages  Class Hierarchy  This Package  Previous  Next  Index