cryptix.pgp
Class KeyRingEntry

java.lang.Object
  |
  +--cryptix.pgp.KeyRingEntry

public final class KeyRingEntry
extends java.lang.Object

Stores all the information about a user in a keyring - their key certificate, usernames, trust packet(s) and any signatures.

This is used by the KeyRing classes to read in keys, and the KeyClient classes to convert retrieved key blocks.


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:
Ian Brown

Constructor Summary
KeyRingEntry(Certificate certificate, KeyRingTrust certificateTrust)
          Creates a new KeyRingEntry with these parameters.
KeyRingEntry(Certificate certificate, KeyRingTrust certificateTrust, java.util.Vector userCerts)
          Creates a new KeyRingEntry with these parameters.
KeyRingEntry(PacketInputStream reader, KeyRingTrust defaultTrust)
          Reads in a KeyRingEntry from reader.
 
Method Summary
 void addNameAndSignatures(UserId userName, KeyRingTrust utrust, java.util.Vector signatures, java.util.Vector trusts)
          Adds these names, trust packets and signatures to this entry.
 Certificate certificate()
          Returns the certificate contained in this entry.
 boolean checkSignatures(KeyStore store)
          Checks the signatures on this entry using the keys in store.
 UserIdCertificate[] getUserIdCertificates()
          Returns an array containing all the user ID certificates contained in this entry.
 java.lang.String primaryName()
          Keys may be associated with more than one name and e-mail address, but PGP assumes the first user ID certificate after the key is the most important one.
 PublicKey publicKey()
          Returns the public key contained in this entry.
 java.lang.String toString()
          Converts the entry to a String which contains the certificate, user names and their associated trust and signature packets.
 int trustValue()
          How well is the key trusted overall?
 void write(java.io.DataOutput out)
          Writes out this entry as a series of PGP packets to out.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

KeyRingEntry

public KeyRingEntry(Certificate certificate,
                    KeyRingTrust certificateTrust)
Creates a new KeyRingEntry with these parameters.

KeyRingEntry

public KeyRingEntry(Certificate certificate,
                    KeyRingTrust certificateTrust,
                    java.util.Vector userCerts)
Creates a new KeyRingEntry with these parameters.

KeyRingEntry

public KeyRingEntry(PacketInputStream reader,
                    KeyRingTrust defaultTrust)
             throws java.io.IOException
Reads in a KeyRingEntry from reader.

If the entry does not contain any trust information (i.e. is from a secret keyring or a keyserver) assign the entry defaultTrust.

Method Detail

addNameAndSignatures

public void addNameAndSignatures(UserId userName,
                                 KeyRingTrust utrust,
                                 java.util.Vector signatures,
                                 java.util.Vector trusts)
                          throws FormatException
Adds these names, trust packets and signatures to this entry.

trustValue

public int trustValue()
How well is the key trusted overall?

certificate

public Certificate certificate()
Returns the certificate contained in this entry.

publicKey

public PublicKey publicKey()
Returns the public key contained in this entry.

If the entry contains a secret key, null is returned.


getUserIdCertificates

public UserIdCertificate[] getUserIdCertificates()
Returns an array containing all the user ID certificates contained in this entry.

primaryName

public java.lang.String primaryName()
Keys may be associated with more than one name and e-mail address, but PGP assumes the first user ID certificate after the key is the most important one. This method returns that name.

toString

public java.lang.String toString()
Converts the entry to a String which contains the certificate, user names and their associated trust and signature packets.
Overrides:
toString in class java.lang.Object

checkSignatures

public boolean checkSignatures(KeyStore store)
Checks the signatures on this entry using the keys in store.
Parameters:
store - where to retrieve public keys from

write

public void write(java.io.DataOutput out)
           throws java.io.IOException
Writes out this entry as a series of PGP packets to out.