COM.claymoresystems.cert
Class X509Cert

java.lang.Object
  extended by COM.claymoresystems.cert.X509Cert
All Implemented Interfaces:
Certificate

public class X509Cert
extends java.lang.Object
implements Certificate

A single X509 Certificate.

The interface here does not match Sun's certificate interface, and even though that interface is pretty useless, we should still probably implement it.


Constructor Summary
X509Cert(byte[] ber_)
          Create an X509Cert from an encoded value
 
Method Summary
 byte[] getDER()
          Get the encoded form of this certificate
 java.util.Vector getExtensions()
          Get the vector of extensions (if any)
 byte[] getIssuerDER()
          Get the encoded form of the issuerName
 DistinguishedName getIssuerName()
          Get the issuer name as an X509Name
 java.security.PublicKey getPublicKey()
          Get the publicKey associated with this certificate
 java.math.BigInteger getSerial()
          Get the serial number
 byte[] getSubjectDER()
          Get the encoded form of the subjectName
 DistinguishedName getSubjectName()
          Get the subject name as an X509Name
 java.util.Date getValidityNotAfter()
          Get the end of the validity window
 java.util.Date getValidityNotBefore()
          Get the beginning of the validity window
 boolean verify(java.security.PublicKey key)
          Check a certificate signature using the specified public key
static java.util.Vector verifyCertChain(CertContext ctx, java.util.Vector certs, CertVerifyPolicyInt policy)
          Verify a certificate chain.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

X509Cert

public X509Cert(byte[] ber_)
         throws CertificateException
Create an X509Cert from an encoded value

Parameters:
ber_ - the encoded certificate as a byte[]

Currently this chokes if the cert is poorly encoded. We have to fix that to throw an IOException. TODO

Throws:
CertificateException
Method Detail

getPublicKey

public java.security.PublicKey getPublicKey()
Get the publicKey associated with this certificate

Returns:
the public key

getDER

public byte[] getDER()
Get the encoded form of this certificate

Specified by:
getDER in interface Certificate
Returns:
the encoded form

getIssuerDER

public byte[] getIssuerDER()
Get the encoded form of the issuerName

Specified by:
getIssuerDER in interface Certificate
Returns:
the DER encoded issuerName

getSubjectDER

public byte[] getSubjectDER()
Get the encoded form of the subjectName

Specified by:
getSubjectDER in interface Certificate
Returns:
the DER encoded subjectName

getSubjectName

public DistinguishedName getSubjectName()
Get the subject name as an X509Name

Specified by:
getSubjectName in interface Certificate
Returns:
an object representing the subjectName

getIssuerName

public DistinguishedName getIssuerName()
Get the issuer name as an X509Name

Specified by:
getIssuerName in interface Certificate
Returns:
an object representing the issuerName

getValidityNotBefore

public java.util.Date getValidityNotBefore()
Get the beginning of the validity window

Specified by:
getValidityNotBefore in interface Certificate
Returns:
the beginning of the certificate validity period

getValidityNotAfter

public java.util.Date getValidityNotAfter()
Get the end of the validity window

Specified by:
getValidityNotAfter in interface Certificate
Returns:
the end of the certificate validity period

getExtensions

public java.util.Vector getExtensions()
Description copied from interface: Certificate
Get the vector of extensions (if any)

Specified by:
getExtensions in interface Certificate
Returns:
the extensions

getSerial

public java.math.BigInteger getSerial()
Get the serial number

Specified by:
getSerial in interface Certificate
Returns:
the serial number

verify

public boolean verify(java.security.PublicKey key)
               throws CertificateException
Check a certificate signature using the specified public key

Returns:
true if the signature checks, otherwise false
Throws:
CertificateException

verifyCertChain

public static java.util.Vector verifyCertChain(CertContext ctx,
                                               java.util.Vector certs,
                                               CertVerifyPolicyInt policy)
                                        throws CertificateException
Verify a certificate chain.

Parameters:
ctx - the cert context
certs - the certs to start with, ordered root first
Returns:
the canonicalized chain, with spurious certificates trimmed from the front and the root (if necessary) prepended
Throws:
CertificateException


Copyright (c) 1999-2001 Claymore Systems, Inc., All Rights Reserved.