webfunds.openpgp.cert
Class SimpleOpenPGPCertificate

java.lang.Object
  |
  +--java.security.cert.Certificate
        |
        +--webfunds.openpgp.cert.SimpleOpenPGPCertificate

public class SimpleOpenPGPCertificate
extends java.security.cert.Certificate

Simple OpenPGP Certificate class.

Warning: this class is a hack, which will most likely disappear in favour of a proper implementation.


Method Summary
 byte[] getEncoded()
          Returns the encoded publickey
 java.security.PublicKey getPublicKey()
          Return the public key that is contained in this certificate
 java.lang.String toString()
          Returns a human-readable string that is descriptive for this certificate.
 void verify(java.security.PublicKey key)
          Verify that this certificate was signed with the given key
 void verify(java.security.PublicKey key, java.lang.String sigProvider)
          Braindamaged unsupported method
 
Methods inherited from class java.security.cert.Certificate
equals, getType, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

verify

public void verify(java.security.PublicKey key)
            throws java.security.cert.CertificateException,
                   java.security.NoSuchAlgorithmException,
                   java.security.InvalidKeyException,
                   java.security.NoSuchProviderException,
                   java.security.SignatureException
Verify that this certificate was signed with the given key

In case of multiple userID's, this method only succeeds if all userID's are signed using the given key.

Overrides:
verify in class java.security.cert.Certificate
Parameters:
key - the key to use for verification
Throws:
java.security.cert.CertificateException - if the certificate contains an invalid signature.
java.security.NoSuchAlgorithmException - this method does currently not throw this exception (a runtime exception is thrown instead if an algorithm is not found), but it may do so in the future.
java.security.InvalidKeyException - is the given public key is not a cryptix.openpgp.PGPPublicKey
java.security.NoSuchProviderException - this method does not throw this exception.
java.security.SignatureException - if the verification fails.

verify

public void verify(java.security.PublicKey key,
                   java.lang.String sigProvider)
            throws java.security.cert.CertificateException,
                   java.security.NoSuchAlgorithmException,
                   java.security.InvalidKeyException,
                   java.security.NoSuchProviderException,
                   java.security.SignatureException
Braindamaged unsupported method

Multiple OpenPGP providers, yeah right!

Overrides:
verify in class java.security.cert.Certificate

getEncoded

public byte[] getEncoded()
                  throws java.security.cert.CertificateEncodingException
Returns the encoded publickey

This class uses the binary OpenPGP representation of it's public key

Overrides:
getEncoded in class java.security.cert.Certificate
Returns:
the binary encoded representation of the contained OpenPGP public key.
Throws:
java.security.cert.CertificateEncodingException - this method does not throw this exception.

getPublicKey

public java.security.PublicKey getPublicKey()
Return the public key that is contained in this certificate

This always returns a cryptix.openpgp.PGPPublicKey

Overrides:
getPublicKey in class java.security.cert.Certificate

toString

public java.lang.String toString()
Returns a human-readable string that is descriptive for this certificate.

For a certificate with one userID, this simply returns the userID. For multiple userID's, all userID's are concatenated in a special way.

Overrides:
toString in class java.security.cert.Certificate