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 $
- Since:
- Cryptix 2.2 or earlier
- Author:
- Systemics Ltd, Ian Brown, Jill Baker
- See Also:
PublicKeyRing
,
KeyCache
,
SecretKeyRing
Field Summary |
protected java.util.Hashtable |
addresses
|
protected java.util.Hashtable |
entriesById
|
protected java.util.Hashtable |
users
|
Constructor Summary |
protected |
KeyRing()
Creates an empty keyring object. |
protected |
KeyRing(java.io.InputStream in)
Creates a new keyring object from in. |
protected |
KeyRing(java.lang.String filename)
Deprecated. |
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
users
protected java.util.Hashtable users
addresses
protected java.util.Hashtable addresses
entriesById
protected java.util.Hashtable entriesById
KeyRing
protected KeyRing()
- Creates an empty keyring object.
KeyRing
protected KeyRing(java.io.InputStream in)
throws java.io.IOException
- Creates a new keyring object from in.
- Throws:
java.io.IOException
- if there was an I/O error
KeyRing
protected KeyRing(java.lang.String filename)
throws java.io.FileNotFoundException,
java.io.IOException
- 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.
init
protected abstract void init(PacketInputStream reader)
throws java.io.IOException
- Subclasses should override this method to read entries from
an InputStream.
getUserName
public final java.lang.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.
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.
getFullNameList
public final java.lang.String[] getFullNameList(KeyID keyID)
- Gets a list of all the names on the key with ID keyID.
getFullUserNameList
public final java.lang.String[] getFullUserNameList()
- Gets a list of all the usernames of keys on this keyring.
getPublicKey
protected final PublicKey getPublicKey(KeyID id)
getPublicKey
protected final PublicKey getPublicKey(EmailAddress address)
getSecretKey
protected final SecretKey getSecretKey(KeyID id,
Passphrase passphrase)
throws DecryptException
getSecretKey
protected final SecretKey getSecretKey(EmailAddress address,
Passphrase passphrase)
throws DecryptException
getIfBegins
protected final PublicKey getIfBegins(java.util.Enumeration e,
java.lang.String username)
throws java.io.IOException
write
public void write(java.io.OutputStream outputStream)
throws java.io.IOException
- Writes out all KeyRingEntries contained in this keyring
to outputStream.
checkSignatures
public boolean checkSignatures()
- Checks the signatures assuming all the keys are in this ring.
checkSignatures
public boolean checkSignatures(KeyStore store)
- Checks the signatures assuming that the KeyStore contains all the
necessary keys.
dump
public final void dump(java.io.PrintStream out)
- Debug dump of key ring.
list
public final void list(java.io.PrintStream out)
- Debug list of signatures etc.
getKeyTrust
public int getKeyTrust(KeyID keyId)
- How much is the key with ID keyId trusted by this user?