All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class IS.hi.logir.cryptonite.KeyRing

java.lang.Object
   |
   +----IS.hi.logir.cryptonite.KeyRing

public final class KeyRing
extends Object
implements Serializable
This class holds a collection of public keys the user has collected, along with his private keys.

It contains methods to find keys given the name and/or e-mail address of the owner, and various key-validation and management routines.

Author:
Logi Ragnarsson (logir@hi.is)
See Also:
Key, KeyPair

Variable Index

 o lastCheck
 o priKeys
 o pubKeys
 o trustKeys

Constructor Index

 o KeyRing()
Create a new empty KeyRing.

Method Index

 o addPair(Key, Key)
Add a public/private Key-pair to the KeyRing.
 o addPair(KeyPair)
Add a public/private Key-pair to the KeyRing.
 o addPub(Key)
Add a public Key to the KeyRing.
 o addTrusted(Key)
Add a trusted Key to the KeyRing.
 o addTrustedPair(Key, Key)
Add a trusted public/private Key-pair to the KeyRing.
 o addTrustedPair(KeyPair)
Add a trusted public/private Key-pair to the KeyRing.
 o find(String, String, Hashtable)
 o findList(String, String, Hashtable)
 o findListPri(String, String)
Find all private keys partially matching a name/e-mail pair.
 o findListPub(String, String)
Find all public keys partially matching a name/e-mail pair.
 o findPri(String, String)
Find a private key partially matching a name/e-mail pair.
 o findPub(String, String)
Find a public key partially matching a name/e-mail pair.
 o getPri(Fingerprint)
Return the private key with the specified fingerprint.
 o getPub(Fingerprint)
Return the public key with the specified fingerprint.
 o getTrusted(Fingerprint)
Return the trusted key with the specified fingerprint.
 o isTrusted(Key)
Returns true if a signature with the Key k is accepted as a key validation.
 o isValid(Key)
Returns true if the Key k has a signature from a trusted party.
 o remove(Key)
Remove a key from the KeyRing.
 o testFingerprints()

Variables

 o lastCheck
 private transient Date lastCheck
 o pubKeys
 private Hashtable pubKeys
 o trustKeys
 private Hashtable trustKeys
 o priKeys
 private Hashtable priKeys

Constructors

 o KeyRing
 public KeyRing()
Create a new empty KeyRing.

Methods

 o addPub
 public void addPub(Key k)
Add a public Key to the KeyRing.

 o addTrusted
 public void addTrusted(Key k)
Add a trusted Key to the KeyRing.

 o addPair
 public void addPair(Key pub,
                     Key pri)
Add a public/private Key-pair to the KeyRing.

 o addPair
 public void addPair(KeyPair kp)
Add a public/private Key-pair to the KeyRing.

 o addTrustedPair
 public void addTrustedPair(Key pub,
                            Key pri)
Add a trusted public/private Key-pair to the KeyRing.

 o addTrustedPair
 public void addTrustedPair(KeyPair kp)
Add a trusted public/private Key-pair to the KeyRing.

 o getPub
 public Key getPub(Fingerprint fingerprint) throws KeyRingCorruptException
Return the public key with the specified fingerprint. If it does not exist, null is returned instead.

 o getPri
 public Key getPri(Fingerprint fingerprint)
Return the private key with the specified fingerprint. If it does not exist, null is returned instead.

 o getTrusted
 public Key getTrusted(Fingerprint fingerprint)
Return the trusted key with the specified fingerprint. If it does not exist, null is returned instead.

 o isTrusted
 public boolean isTrusted(Key k)
Returns true if a signature with the Key k is accepted as a key validation.

 o isValid
 public boolean isValid(Key k) throws KeyRingCorruptException
Returns true if the Key k has a signature from a trusted party. This code is dependant on the Fingerprint class which has not been implemented.

 o testFingerprints
 private void testFingerprints() throws KeyRingCorruptException
 o remove
 public void remove(Key k)
Remove a key from the KeyRing.

 o find
 private static Key find(String name,
                         String mail,
                         Hashtable keys)
 o findPub
 public Key findPub(String name,
                    String mail)
Find a public key partially matching a name/e-mail pair. If name is not null, then it will be a sub-string of the name of the owner of the key. If mail is not null, then it will be a sub-string of the e-mail address of the owner of the key.

If no such key exists, null is returned.

If more than one key mathces the criteria, the first one found is returned.

 o findPri
 public Key findPri(String name,
                    String mail)
Find a private key partially matching a name/e-mail pair. If name is not null, then it will be a sub-string of the name of the owner of the key. If mail is not null, then it will be a sub-string of the e-mail address of the owner of the key.

If no such key exists, null is returned.

If more than one key mathces the criteria, the first one found is returned.

 o findList
 private static Key[] findList(String name,
                               String mail,
                               Hashtable keys)
 o findListPub
 public Key[] findListPub(String name,
                          String mail)
Find all public keys partially matching a name/e-mail pair. If name is not null, then it will be a sub-string of the name of the owner of the keys. If mail is not null, then it will be a sub-string of the e-mail address of the owner of the keys.

 o findListPri
 public Key[] findListPri(String name,
                          String mail)
Find all private keys partially matching a name/e-mail pair. If name is not null, then it will be a sub-string of the name of the owner of the keys. If mail is not null, then it will be a sub-string of the e-mail address of the owner of the keys.


All Packages  Class Hierarchy  This Package  Previous  Next  Index