All Packages Class Hierarchy This Package Previous Next Index
Class cryptix.pgp.KeyGlob
java.lang.Object
|
+----cryptix.pgp.KeyStore
|
+----cryptix.pgp.KeyGlob
- public final class KeyGlob
- extends KeyStore
Stores all of the key sources known to a program -
all public and secret keyrings, and a Web master keyserver.
If setKeyServer is not used, the object will not use one.
Can be passed to objects which decrypt and verify PGP messages
such as ArmouredMessage.
NB. Keyrings are searched in the order in which they are added.
Therefore, always add the most highly trusted keyrings first.
The master keyserver is only consulted if a key is not available locally.
Copyright © 1995-1997
Systemics Ltd on behalf of the
Cryptix Development Team.
All rights reserved.
$Revision: 1.1.1.1 $
- Author:
- Ian Brown, Jill Baker, Zoran Rajic
-
KeyGlob()
- Initializes an empty KeyGlob.
-
addKeyRing(PublicKeyRing)
- Adds publicKeyRing to the KeyGlob's collection.
-
addKeyRing(SecretKeyRing)
- Adds secretKeyRing to the KeyGlob's collection.
-
getKey(EmailAddress)
- Tries to find a public key for address.
-
getKey(KeyID)
- Tries to find a public key for id.
-
getKey(String)
- Tries to find a public key for name.
-
getKeyTrust(KeyID, boolean)
- Gets the trust value for a given key ID.
-
getSecretKey(KeyID, Passphrase)
- Tries to find a secret key for id, and decrypt it with
passphrase.
-
getSecretKey(String, Passphrase)
- Tries to find a secret key for name, and decrypt it with
passphrase.
-
getUserName(KeyID)
- Returns the name of a user whose key has ID keyID.
-
setKeyServer(KeyClient)
- Gives KeyGlob a keyclient object that it can use to fetch keys remotely.
KeyGlob
public KeyGlob()
- Initializes an empty KeyGlob. Use
addKeyRing
and
setKeyServer
to fill it up.
addKeyRing
public void addKeyRing(PublicKeyRing publicKeyRing)
- Adds publicKeyRing to the KeyGlob's collection.
addKeyRing
public void addKeyRing(SecretKeyRing secretKeyRing)
- Adds secretKeyRing to the KeyGlob's collection.
By allowing more than one secret keyring, users can keep a standard
secret key available, and have a high-security key stored on a floppy
disk which applications only access transparently through this class
when it's needed.
setKeyServer
public void setKeyServer(KeyClient client) throws IOException, UnknownHostException
- Gives KeyGlob a keyclient object that it can use to fetch keys remotely.
This will be searched for public keys if they are not available locally.
- Parameters:
- client - an instantiated KeyClient subclass object
- Throws: IOException
- if there was an I/O error
- Throws: UnknownHostException
- if the public key server was unreachable
getKeyTrust
public int getKeyTrust(KeyID keyID,
boolean publicRings)
- Gets the trust value for a given key ID.
- Parameters:
- keyID - the key ID you are interested in
- publicRings - search public rings (true), or secret rings (false)
- Returns:
- trust value, or -1 if key not present
getKey
public PublicKey getKey(String name) throws IOException
- Tries to find a public key for name.
- Parameters:
- name - the name of the user
- Returns:
- their public key, or null if one can't be found
- Throws: IOException
- if there was an I/O error
- Overrides:
- getKey in class KeyStore
getKey
public PublicKey getKey(KeyID id) throws IOException
- Tries to find a public key for id.
- Parameters:
- id - the key ID of the user (the low 8 bits of their key pair's
public modulus)
- Returns:
- their public key, or null if one can't be found
- Throws: IOException
- if there was an I/O error
- Overrides:
- getKey in class KeyStore
getKey
public PublicKey getKey(EmailAddress address) throws IOException
- Tries to find a public key for address.
- Parameters:
- address - the e-mail address of the user
- Returns:
- their public key, or null if one can't be found
- Throws: IOException
- if there was an I/O error
getSecretKey
public SecretKey getSecretKey(String name,
Passphrase passphrase) throws IOException, DecryptException
- Tries to find a secret key for name, and decrypt it with
passphrase.
- Parameters:
- name - the e-mail address of the user
- passphrase - the passphrase protecting their secret key
- Returns:
- their secret key, or null if one can't be found
- Throws: IOException
- if there was an I/O error
- Throws: DecryptException
- if the secret key could not be decrypted
getSecretKey
public SecretKey getSecretKey(KeyID id,
Passphrase passphrase) throws IOException, DecryptException
- Tries to find a secret key for id, and decrypt it with
passphrase.
- Parameters:
- id - the key ID of the user's key
- passphrase - the passphrase protecting their secret key
- Returns:
- their secret key, or null if one can't be found
- Throws: IOException
- if there was an I/O error
- Throws: DecryptException
- if the secret key could not be decrypted
getUserName
public String getUserName(KeyID keyID)
- Returns the name of a user whose key has ID keyID.
Only checks local keyrings.
All Packages Class Hierarchy This Package Previous Next Index