|
Cryptix OpenPGP | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcryptix.pki.KeyBundle
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.
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 |
protected KeyBundle(java.lang.String type)
Method Detail |
public boolean equals(java.lang.Object other)
public int hashCode()
public final java.lang.String getType()
public abstract byte[] getEncoded() throws KeyBundleException
KeyBundleException
- on a variety of format specific problems.public abstract java.lang.Object clone()
public abstract boolean addCertificate(java.security.cert.Certificate cert) throws KeyBundleException
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.
KeyBundleException
public abstract boolean addPrincipal(java.security.Principal princ) throws KeyBundleException
Note: there is no need to call this method explicitly when addCertificate is used.
KeyBundleException
public abstract boolean addPublicKey(java.security.PublicKey pubkey) throws KeyBundleException
Note: there is no need to call this method explicitly when addCertificate is used.
KeyBundleException
public abstract boolean addPrivateKey(java.security.PrivateKey privkey, java.security.PublicKey pubkey, char[] passphrase, java.security.SecureRandom sr) throws KeyBundleException
KeyBundleException
public abstract boolean addPrivateKey(java.security.PrivateKey privkey, java.security.PublicKey pubkey) throws KeyBundleException
KeyBundleException
public abstract boolean removePublicKey(java.security.PublicKey key) throws KeyBundleException
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.
KeyBundleException
public abstract boolean removePrivateKey(java.security.PublicKey key) throws KeyBundleException
KeyBundleException
public abstract boolean removePrincipal(java.security.Principal subject) throws KeyBundleException
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.
KeyBundleException
public abstract boolean removeCertificate(java.security.cert.Certificate cert) throws KeyBundleException
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.
KeyBundleException
public abstract java.util.Iterator getPublicKeys()
The objects returned by the iterator will all be instances of java.security.Key
public abstract java.security.PrivateKey getPrivateKey(java.security.PublicKey key, char[] passphrase) throws java.security.UnrecoverableKeyException
Returns null if no private key is available
java.security.UnrecoverableKeyException
public abstract java.util.Iterator getPrincipals()
The objects returned by the iterator will all be instances of java.security.Principal
public abstract java.util.Iterator getCertificates()
The objects returned by the iterator will all be instances of java.security.cert.Certificate
public abstract java.util.Iterator getCertificates(java.security.PublicKey key, java.security.Principal principal)
The objects returned by the iterator will all be instances of java.security.cert.Certificate
|
Cryptix OpenPGP | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |