Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Cryptix OpenPGP
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## cryptix.pki
Class KeyBundle

    java.lang.Object
      cryptix.pki.KeyBundle

Direct Known Subclasses:
  PGPKeyBundle

public abstract class KeyBundle
extends java.lang.Object

A KeyBundle is a collection of keys, principals and certificates, which all logically belong together.

Here are a few suggestions on how to implement this class for existing public key structures:

X.509 - an X.509 KeyBundle consists of just one certificate, together with the publickey and principal as returned by the getSubjectDN() method on X509Certificate.

OpenPGP - an OpenPGP KeyBundle consists of one 'PGP key', which means: - one key object, the signing key.
- one or more principal objects, which correspond to UserID's in OpenPGP (potentially also PhotoID objects).
- one or more certificates, which is basically a certification signature by someone on a principal/userid.
- the subkeys (encryption keys) are exposed trough the OpenPGPKeyBundle class.

Version:
  $Revision: 1.2 $
Author:
  Edwin Woudt , Ingo Luetkebohle

Constructor Summary
`protected` | `KeyBundle(java.lang.String type)` Create a new KeyBundle object with the given type.

Method Summary
`abstract boolean` | `addCertificate(java.security.cert.Certificate cert)` Adds a certificate It is assumed that the certificate contains the right pointers to the public key and the principal, so that the implementation of the keybundle can add these automatically when needed.
`abstract boolean` | `addPrincipal(java.security.Principal princ)` Adds a principal.
`abstract boolean` | `addPrivateKey(java.security.PrivateKey privkey, java.security.PublicKey pubkey)` Adds a private key, without encrypting it.
`abstract boolean` | `addPrivateKey(java.security.PrivateKey privkey, java.security.PublicKey pubkey, char[] passphrase, java.security.SecureRandom sr)` Adds a private key, encrypting it with a passphrase.
`abstract boolean` | `addPublicKey(java.security.PublicKey pubkey)` Adds a public key.
`abstract java.lang.Object` | `clone()` Return a clone for this KeyBundle
`boolean` | `equals(java.lang.Object other)` Do equality comparison based on equality of the byte[]s returned by getEncoded().
`abstract java.util.Iterator` | `getCertificates()` Return an iterator over all certificate contained within this bundle.
`abstract java.util.Iterator` | `getCertificates(java.security.PublicKey key, java.security.Principal principal)` Return an iterator over the certificates contained within this bundle that belong to a certain key and principal.
`abstract byte[]` | `getEncoded()` Returns the keybundle in encoded format.
`abstract java.util.Iterator` | `getPrincipals()` Return an iterator over all principals contained within this bundle The objects returned by the iterator will all be instances of java.security.Principal
`abstract java.security.PrivateKey` | `getPrivateKey(java.security.PublicKey key, char[] passphrase)` Return an the private key belonging to the given public key, decryptin it with the given passphrase.
`abstract java.util.Iterator` | `getPublicKeys()` Return an iterator over all keys contained within this bundle The objects returned by the iterator will all be instances of java.security.Key
`java.lang.String` | `getType()` Returns the type of this keybundle.
`int` | `hashCode()` Returns a hashCode for this object based on the encoded form.
`abstract boolean` | `removeCertificate(java.security.cert.Certificate cert)` Remove a certificate and all related keys and principals.
`abstract boolean` | `removePrincipal(java.security.Principal subject)` Remove a principal and all related keys and certificates.
`abstract boolean` | `removePrivateKey(java.security.PublicKey key)` Remove the private key belonging to the given public key.
`abstract boolean` | `removePublicKey(java.security.PublicKey key)` Remove a public key and all related principals and certificates.

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### KeyBundle

    protected KeyBundle(java.lang.String type)

  Create a new KeyBundle object with the given type.

Method Detail

### equals

    public boolean equals(java.lang.Object other)

  Do equality comparison based on equality of the byte[]s returned by getEncoded().

### hashCode

    public int hashCode()

  Returns a hashCode for this object based on the encoded form.

### getType

    public final java.lang.String getType()

  Returns the type of this keybundle.

### getEncoded

    public abstract byte[] getEncoded()
                               throws KeyBundleException

  Returns the keybundle in encoded format.

  Throws:
    `KeyBundleException` - on a variety of format specific problems.

### clone

    public abstract java.lang.Object clone()

  Return a clone for this KeyBundle

### addCertificate

    public abstract boolean addCertificate(java.security.cert.Certificate cert)
                                    throws KeyBundleException

  Adds a certificate

  It is assumed that the certificate contains the right pointers to the public key and the principal, so that the implementation of the keybundle can add these automatically when needed.

  Throws:
    `KeyBundleException`

### addPrincipal

    public abstract boolean addPrincipal(java.security.Principal princ)
                                  throws KeyBundleException

  Adds a principal.

  Note: there is no need to call this method explicitly when addCertificate is used.

  Throws:
    `KeyBundleException`

### addPublicKey

    public abstract boolean addPublicKey(java.security.PublicKey pubkey)
                                  throws KeyBundleException

  Adds a public key.

  Note: there is no need to call this method explicitly when addCertificate is used.

  Throws:
    `KeyBundleException`

### addPrivateKey

    public abstract boolean addPrivateKey(java.security.PrivateKey privkey,
                                          java.security.PublicKey pubkey,
                                          char[] passphrase,
                                          java.security.SecureRandom sr)
                                   throws KeyBundleException

  Adds a private key, encrypting it with a passphrase.

  Throws:
    `KeyBundleException`

### addPrivateKey

    public abstract boolean addPrivateKey(java.security.PrivateKey privkey,
                                          java.security.PublicKey pubkey)
                                   throws KeyBundleException

  Adds a private key, without encrypting it.

  Throws:
    `KeyBundleException`

### removePublicKey

    public abstract boolean removePublicKey(java.security.PublicKey key)
                                     throws KeyBundleException

  Remove a public key and all related principals and certificates.

  The definition of 'related' is somewhat loose and left up to the implementation. The only thing an implementation has to make sure is that after removing one object it removes enough other objects in order to maintain a valid state according to the particular type.

  Throws:
    `KeyBundleException`

### removePrivateKey

    public abstract boolean removePrivateKey(java.security.PublicKey key)
                                      throws KeyBundleException

  Remove the private key belonging to the given public key.

  Throws:
    `KeyBundleException`

### removePrincipal

    public abstract boolean removePrincipal(java.security.Principal subject)
                                     throws KeyBundleException

  Remove a principal and all related keys and certificates.

  The definition of 'related' is somewhat loose and left up to the implementation. The only thing an implementation has to make sure is that after removing one object it removes enough other objects in order to maintain a valid state according to the particular type.

  Throws:
    `KeyBundleException`

### removeCertificate

    public abstract boolean removeCertificate(java.security.cert.Certificate cert)
                                       throws KeyBundleException

  Remove a certificate and all related keys and principals.

  The definition of 'related' is somewhat loose and left up to the implementation. The only thing an implementation has to make sure is that after removing one object it removes enough other objects in order to maintain a valid state according to the particular type.

  Throws:
    `KeyBundleException`

### getPublicKeys

    public abstract java.util.Iterator getPublicKeys()

  Return an iterator over all keys contained within this bundle

  The objects returned by the iterator will all be instances of java.security.Key

### getPrivateKey

    public abstract java.security.PrivateKey getPrivateKey(java.security.PublicKey key,
                                                           char[] passphrase)
                                                    throws java.security.UnrecoverableKeyException

  Return an the private key belonging to the given public key, decryptin it with the given passphrase.

  Returns null if no private key is available

  Throws:
    `java.security.UnrecoverableKeyException`

### getPrincipals

    public abstract java.util.Iterator getPrincipals()

  Return an iterator over all principals contained within this bundle

  The objects returned by the iterator will all be instances of java.security.Principal

### getCertificates

    public abstract java.util.Iterator getCertificates()

  Return an iterator over all certificate contained within this bundle.

  The objects returned by the iterator will all be instances of java.security.cert.Certificate

### getCertificates

    public abstract java.util.Iterator getCertificates(java.security.PublicKey key,
                                                       java.security.Principal principal)

  Return an iterator over the certificates contained within this bundle that belong to a certain key and principal.

  The objects returned by the iterator will all be instances of java.security.cert.Certificate

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Cryptix OpenPGP
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (C) 1999-2003 The Cryptix Foundation Ltd.