For the latest news and information visit
The GNU Crypto project

gnu.crypto.pki
Class X509CertificateImpl

java.lang.Object
  extended by java.security.cert.Certificate
      extended by java.security.cert.X509Certificate
          extended by gnu.crypto.pki.X509CertificateImpl
All Implemented Interfaces:
GnuPKIExtension, Serializable, X509Extension
Direct Known Subclasses:
X509CertificateBuilder

public class X509CertificateImpl
extends X509Certificate
implements Serializable, GnuPKIExtension

An implementation of X.509 certificates.

Author:
Casey Marshall (rsdio@metastatic.org)
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.security.cert.Certificate
Certificate.CertificateRep
 
Field Summary
protected  OID algId
           
protected  byte[] algVal
           
protected  byte[] encoded
           
protected  Map extensions
           
protected static OID ID_DSA
           
protected static OID ID_DSA_WITH_SHA1
           
protected static OID ID_ECDSA_WITH_SHA1
           
protected static OID ID_RSA
           
protected static OID ID_RSA_WITH_MD2
           
protected static OID ID_RSA_WITH_MD5
           
protected static OID ID_RSA_WITH_SHA1
           
protected  X500Name issuer
           
protected  BitString issuerUniqueId
           
protected  Date notAfter
           
protected  Date notBefore
           
protected  BigInteger serialNo
           
protected  OID sigAlgId
           
protected  byte[] sigAlgVal
           
protected  byte[] signature
           
protected  X500Name subject
           
protected  PublicKey subjectKey
           
protected  BitString subjectUniqueId
           
protected  byte[] tbsCertBytes
           
protected  int version
           
 
Constructor Summary
protected X509CertificateImpl()
           
  X509CertificateImpl(InputStream encoded)
          Create a new X.509 certificate from the encoded data.
 
Method Summary
 void checkValidity()
           
 void checkValidity(Date date)
           
 boolean equals(Object other)
           
 int getBasicConstraints()
           
 Set getCriticalExtensionOIDs()
           
 byte[] getEncoded()
           
 List getExtendedKeyUsage()
           
 Extension getExtension(OID oid)
          Returns the extension object for the given object identifier.
 Collection getExtensions()
           
 byte[] getExtensionValue(String oid)
           
 Collection getIssuerAlternativeNames()
           
 Principal getIssuerDN()
           
 boolean[] getIssuerUniqueID()
           
 X500Principal getIssuerX500Principal()
           
 boolean[] getKeyUsage()
           
 Set getNonCriticalExtensionOIDs()
           
 Date getNotAfter()
           
 Date getNotBefore()
           
 PublicKey getPublicKey()
           
 BigInteger getSerialNumber()
           
 String getSigAlgName()
           
 String getSigAlgOID()
           
 byte[] getSigAlgParams()
           
 byte[] getSignature()
           
 Collection getSubjectAlternativeNames()
           
 Principal getSubjectDN()
           
 boolean[] getSubjectUniqueID()
           
 X500Principal getSubjectX500Principal()
           
 byte[] getTBSCertificate()
           
 int getVersion()
           
 boolean hasUnsupportedCriticalExtension()
           
 String toString()
           
 void verify(PublicKey key)
           
 void verify(PublicKey key, String provider)
           
 
Methods inherited from class java.security.cert.Certificate
getType, hashCode, writeReplace
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ID_DSA

protected static final OID ID_DSA

ID_DSA_WITH_SHA1

protected static final OID ID_DSA_WITH_SHA1

ID_RSA

protected static final OID ID_RSA

ID_RSA_WITH_MD2

protected static final OID ID_RSA_WITH_MD2

ID_RSA_WITH_MD5

protected static final OID ID_RSA_WITH_MD5

ID_RSA_WITH_SHA1

protected static final OID ID_RSA_WITH_SHA1

ID_ECDSA_WITH_SHA1

protected static final OID ID_ECDSA_WITH_SHA1

encoded

protected transient byte[] encoded

tbsCertBytes

protected transient byte[] tbsCertBytes

version

protected transient int version

serialNo

protected transient BigInteger serialNo

algId

protected transient OID algId

algVal

protected transient byte[] algVal

issuer

protected transient X500Name issuer

notBefore

protected transient Date notBefore

notAfter

protected transient Date notAfter

subject

protected transient X500Name subject

subjectKey

protected transient PublicKey subjectKey

issuerUniqueId

protected transient BitString issuerUniqueId

subjectUniqueId

protected transient BitString subjectUniqueId

extensions

protected transient Map extensions

sigAlgId

protected transient OID sigAlgId

sigAlgVal

protected transient byte[] sigAlgVal

signature

protected transient byte[] signature
Constructor Detail

X509CertificateImpl

public X509CertificateImpl(InputStream encoded)
                    throws CertificateException,
                           IOException
Create a new X.509 certificate from the encoded data. The input data are expected to be the ASN.1 DER encoding of the certificate.

Parameters:
encoded - The encoded certificate data.
Throws:
IOException - If the certificate cannot be read, possibly from a formatting error.
CertificateException - If the data read is not an X.509 certificate.

X509CertificateImpl

protected X509CertificateImpl()
Method Detail

checkValidity

public void checkValidity()
                   throws CertificateExpiredException,
                          CertificateNotYetValidException
Specified by:
checkValidity in class X509Certificate
Throws:
CertificateExpiredException
CertificateNotYetValidException

checkValidity

public void checkValidity(Date date)
                   throws CertificateExpiredException,
                          CertificateNotYetValidException
Specified by:
checkValidity in class X509Certificate
Throws:
CertificateExpiredException
CertificateNotYetValidException

getVersion

public int getVersion()
Specified by:
getVersion in class X509Certificate

getSerialNumber

public BigInteger getSerialNumber()
Specified by:
getSerialNumber in class X509Certificate

getIssuerDN

public Principal getIssuerDN()
Specified by:
getIssuerDN in class X509Certificate

getIssuerX500Principal

public X500Principal getIssuerX500Principal()
Overrides:
getIssuerX500Principal in class X509Certificate

getSubjectDN

public Principal getSubjectDN()
Specified by:
getSubjectDN in class X509Certificate

getSubjectX500Principal

public X500Principal getSubjectX500Principal()
Overrides:
getSubjectX500Principal in class X509Certificate

getNotBefore

public Date getNotBefore()
Specified by:
getNotBefore in class X509Certificate

getNotAfter

public Date getNotAfter()
Specified by:
getNotAfter in class X509Certificate

getTBSCertificate

public byte[] getTBSCertificate()
                         throws CertificateEncodingException
Specified by:
getTBSCertificate in class X509Certificate
Throws:
CertificateEncodingException

getSignature

public byte[] getSignature()
Specified by:
getSignature in class X509Certificate

getSigAlgName

public String getSigAlgName()
Specified by:
getSigAlgName in class X509Certificate

getSigAlgOID

public String getSigAlgOID()
Specified by:
getSigAlgOID in class X509Certificate

getSigAlgParams

public byte[] getSigAlgParams()
Specified by:
getSigAlgParams in class X509Certificate

getIssuerUniqueID

public boolean[] getIssuerUniqueID()
Specified by:
getIssuerUniqueID in class X509Certificate

getSubjectUniqueID

public boolean[] getSubjectUniqueID()
Specified by:
getSubjectUniqueID in class X509Certificate

getKeyUsage

public boolean[] getKeyUsage()
Specified by:
getKeyUsage in class X509Certificate

getExtendedKeyUsage

public List getExtendedKeyUsage()
                         throws CertificateParsingException
Overrides:
getExtendedKeyUsage in class X509Certificate
Throws:
CertificateParsingException

getBasicConstraints

public int getBasicConstraints()
Specified by:
getBasicConstraints in class X509Certificate

getSubjectAlternativeNames

public Collection getSubjectAlternativeNames()
                                      throws CertificateParsingException
Overrides:
getSubjectAlternativeNames in class X509Certificate
Throws:
CertificateParsingException

getIssuerAlternativeNames

public Collection getIssuerAlternativeNames()
                                     throws CertificateParsingException
Overrides:
getIssuerAlternativeNames in class X509Certificate
Throws:
CertificateParsingException

hasUnsupportedCriticalExtension

public boolean hasUnsupportedCriticalExtension()
Specified by:
hasUnsupportedCriticalExtension in interface X509Extension

getCriticalExtensionOIDs

public Set getCriticalExtensionOIDs()
Specified by:
getCriticalExtensionOIDs in interface X509Extension

getNonCriticalExtensionOIDs

public Set getNonCriticalExtensionOIDs()
Specified by:
getNonCriticalExtensionOIDs in interface X509Extension

getExtensionValue

public byte[] getExtensionValue(String oid)
Specified by:
getExtensionValue in interface X509Extension

getExtension

public Extension getExtension(OID oid)
Description copied from interface: GnuPKIExtension
Returns the extension object for the given object identifier.

Specified by:
getExtension in interface GnuPKIExtension
Parameters:
oid - The OID of the extension to get.
Returns:
The extension, or null if there is no such extension.

getExtensions

public Collection getExtensions()
Specified by:
getExtensions in interface GnuPKIExtension

getEncoded

public byte[] getEncoded()
                  throws CertificateEncodingException
Specified by:
getEncoded in class Certificate
Throws:
CertificateEncodingException

verify

public void verify(PublicKey key)
            throws CertificateException,
                   NoSuchAlgorithmException,
                   InvalidKeyException,
                   NoSuchProviderException,
                   SignatureException
Specified by:
verify in class Certificate
Throws:
CertificateException
NoSuchAlgorithmException
InvalidKeyException
NoSuchProviderException
SignatureException

verify

public void verify(PublicKey key,
                   String provider)
            throws CertificateException,
                   NoSuchAlgorithmException,
                   InvalidKeyException,
                   NoSuchProviderException,
                   SignatureException
Specified by:
verify in class Certificate
Throws:
CertificateException
NoSuchAlgorithmException
InvalidKeyException
NoSuchProviderException
SignatureException

toString

public String toString()
Specified by:
toString in class Certificate

getPublicKey

public PublicKey getPublicKey()
Specified by:
getPublicKey in class Certificate

equals

public boolean equals(Object other)
Overrides:
equals in class Certificate

For the latest news and information visit
The GNU Crypto project

Copyright © 2001, 2002, 2003 Free Software Foundation, Inc. All Rights Reserved.