COM.claymoresystems.cert

Class X509Cert

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
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
PublicKey
getPublicKey()
Get the publicKey associated with this certificate
BigInteger
getSerial()
Get the serial number
byte[]
getSubjectDER()
Get the encoded form of the subjectName
DistinguishedName
getSubjectName()
Get the subject name as an X509Name
Date
getValidityNotAfter()
Get the end of the validity window
Date
getValidityNotBefore()
Get the beginning of the validity window
boolean
verify(PublicKey key)
Check a certificate signature using the specified public key
static Vector
verifyCertChain(CertContext ctx, Vector certs, CertVerifyPolicyInt policy)
Verify a certificate chain.

Constructor Details

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

Method Details

getDER

public byte[] getDER()
Get the encoded form of this certificate
Specified by:
getDER in interface Certificate
Returns:
the encoded form

getExtensions

public Vector getExtensions()
Get the vector of extensions (if any)
Specified by:
getExtensions in interface Certificate
Returns:
the extensions

getIssuerDER

public byte[] getIssuerDER()
Get the encoded form of the issuerName
Specified by:
getIssuerDER in interface Certificate
Returns:
the DER encoded issuerName

getIssuerName

public DistinguishedName getIssuerName()
Get the issuer name as an X509Name
Specified by:
getIssuerName in interface Certificate
Returns:
an object representing the issuerName

getPublicKey

public PublicKey getPublicKey()
Get the publicKey associated with this certificate
Returns:
the public key

getSerial

public BigInteger getSerial()
Get the serial number
Specified by:
getSerial in interface Certificate
Returns:
the serial number

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

getValidityNotAfter

public Date getValidityNotAfter()
Get the end of the validity window
Specified by:
getValidityNotAfter in interface Certificate
Returns:
the end of the certificate validity period

getValidityNotBefore

public Date getValidityNotBefore()
Get the beginning of the validity window
Specified by:
getValidityNotBefore in interface Certificate
Returns:
the beginning of the certificate validity period

verify

public boolean verify(PublicKey key)
            throws CertificateException
Check a certificate signature using the specified public key
Returns:
true if the signature checks, otherwise false

verifyCertChain

public static Vector verifyCertChain(CertContext ctx,
                                     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

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