cryptix.pgp
Class SecretKeyRing

java.lang.Object
  extended bycryptix.pgp.KeyStore
      extended bycryptix.pgp.KeyRing
          extended bycryptix.pgp.SecretKeyRing

public final class SecretKeyRing
extends KeyRing

Represents a secret keyring. Use the getKey() functions to retrieve a key.

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:
Mike Wynn, Ian Brown

Field Summary
 
Fields inherited from class cryptix.pgp.KeyRing
addresses, entriesById, users
 
Constructor Summary
protected SecretKeyRing()
          Creates an empty secret keyring object.
  SecretKeyRing(java.io.InputStream in)
          Creates a new secret keyring object from in.
  SecretKeyRing(java.lang.String filename)
          Create a new secret keyring object from the file filename.
 
Method Summary
 SecretKey getKey(EmailAddress address, Passphrase passphrase)
          Retrieves a key by any of the e-mail addresses on it.
 PublicKey getKey(KeyID keyID)
          DON'T USE THIS - it's only here to allow SecretKeyRing to fit into this class hierarchy.
 SecretKey getKey(KeyID keyID, Passphrase passphrase)
          Retrieves a key by its ID.
 PublicKey getKey(java.lang.String username)
          DON'T USE THIS - it's only here to allow SecretKeyRing to fit into this class hierarchy.
 SecretKey getKey(java.lang.String username, Passphrase passphrase)
          Retrieves a key by any of the user names on it.
 int getKeyTrust(KeyID keyId)
          How much is the key with ID keyId trusted by this user?
protected  void init(PacketInputStream reader)
          Subclasses should override this method to read entries from an InputStream.
 
Methods inherited from class cryptix.pgp.KeyRing
add, checkSignatures, checkSignatures, dump, getFullNameList, getFullUserNameList, getIfBegins, getPublicKey, getPublicKey, getSecretKey, getSecretKey, getUserName, list, write
 
Methods inherited from class cryptix.pgp.KeyStore
checkSignature, checkSignature, checkSignature
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SecretKeyRing

protected SecretKeyRing()
Creates an empty secret keyring object. Use the add method to add new entries.


SecretKeyRing

public SecretKeyRing(java.io.InputStream in)
              throws java.io.IOException
Creates a new secret keyring object from in.

Throws:
java.io.IOException - if there was an I/O error

SecretKeyRing

public SecretKeyRing(java.lang.String filename)
              throws java.io.FileNotFoundException,
                     java.io.IOException
Create a new secret keyring object from the file filename.

Throws:
java.io.FileNotFoundException - if filename was not found
java.io.IOException - if there was an I/O error
Method Detail

getKey

public final PublicKey getKey(java.lang.String username)
                       throws FormatException
DON'T USE THIS - it's only here to allow SecretKeyRing to fit into this class hierarchy. null is always returned as a passphrase is needed to decrypt the key first.

Specified by:
getKey in class KeyStore
Throws:
FormatException

getKey

public final SecretKey getKey(java.lang.String username,
                              Passphrase passphrase)
                       throws java.io.IOException,
                              DecryptException
Retrieves a key by any of the user names on it.

Throws:
java.io.IOException - if there was an I/O error
DecryptException - if the key could not be decrypted

getKey

public final PublicKey getKey(KeyID keyID)
DON'T USE THIS - it's only here to allow SecretKeyRing to fit into this class hierarchy. null is always returned as a passphrase is needed to decrypt the key first.

Specified by:
getKey in class KeyStore

getKey

public final SecretKey getKey(KeyID keyID,
                              Passphrase passphrase)
                       throws DecryptException
Retrieves a key by its ID.

Throws:
DecryptException - if the key could not be decrypted

getKey

public final SecretKey getKey(EmailAddress address,
                              Passphrase passphrase)
                       throws DecryptException
Retrieves a key by any of the e-mail addresses on it.

Throws:
DecryptException - if the key could not be decrypted

getKeyTrust

public final int getKeyTrust(KeyID keyId)
Description copied from class: KeyRing
How much is the key with ID keyId trusted by this user?

Overrides:
getKeyTrust in class KeyRing

init

protected final void init(PacketInputStream reader)
                   throws java.io.IOException
Description copied from class: KeyRing
Subclasses should override this method to read entries from an InputStream.

Specified by:
init in class KeyRing
Throws:
java.io.IOException