All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class cryptix.pgp.KeyRing

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

public abstract 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 that it wishes to keep.

KeyRing is unlikely to be useful for any other subclasses. 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

A remove() function may be added.

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

$Revision: 1.1.1.1 $

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

Variable Index

 o addresses
 o entriesById
 o users

Constructor Index

 o KeyRing()
Creates an empty keyring object.
 o KeyRing(InputStream)
Creates a new keyring object from in.
 o KeyRing(String)
This constructor used to create a new keyring object from the file filename. Deprecated.

Method Index

 o add(KeyRingEntry)
Adds a key to this keyring.
 o checkSignatures()
Checks the signatures assuming all the keys are in this ring.
 o checkSignatures(KeyStore)
Checks the signatures assuming that the KeyStore contains all the necessary keys.
 o dump(PrintStream)
Debug dump of key ring.
 o getFullNameList(KeyID)
Gets a list of all the names on the key with ID keyID.
 o getFullUserNameList()
Gets 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.
 o init(PacketInputStream)
Subclasses should override this method to read entries from an InputStream.
 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 entriesById
 protected Hashtable entriesById

Constructors

 o KeyRing
 protected KeyRing()
Creates an empty keyring object.

 o KeyRing
 protected KeyRing(InputStream in) throws IOException
Creates a new keyring object from in.

Throws: IOException
if there was an I/O error
 o KeyRing
 protected KeyRing(String filename) throws FileNotFoundException, IOException
Note: KeyRing() is deprecated.

This constructor used to create a new keyring object from the file filename. It is no longer supported for security reasons.

Throws: NoSuchMethodError
always thrown.

Methods

 o init
 protected abstract void init(PacketInputStream reader) throws IOException
Subclasses should override this method to read entries from an InputStream.

 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)
Gets a list of all the names on the key with ID keyID.

 o getFullUserNameList
 public final String[] getFullUserNameList()
Gets a list of all the usernames of keys on this keyring.

 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()
Checks the signatures assuming all the keys are in this ring.

 o checkSignatures
 public boolean checkSignatures(KeyStore store)
Checks the signatures assuming that the KeyStore contains all the necessary 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