For the latest news and information visit
The GNU Crypto project

gnu.crypto.pki
Class X509CertificateImpl

java.lang.Object
  extended byjava.security.cert.Certificate
      extended byjava.security.cert.X509Certificate
          extended bygnu.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 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
           
 
Fields inherited from class java.security.cert.X509Certificate
 
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
Throws:
CertificateExpiredException
CertificateNotYetValidException

checkValidity

public void checkValidity(Date date)
                   throws CertificateExpiredException,
                          CertificateNotYetValidException
Throws:
CertificateExpiredException
CertificateNotYetValidException

getVersion

public int getVersion()

getSerialNumber

public BigInteger getSerialNumber()

getIssuerDN

public Principal getIssuerDN()

getIssuerX500Principal

public X500Principal getIssuerX500Principal()

getSubjectDN

public Principal getSubjectDN()

getSubjectX500Principal

public X500Principal getSubjectX500Principal()

getNotBefore

public Date getNotBefore()

getNotAfter

public Date getNotAfter()

getTBSCertificate

public byte[] getTBSCertificate()
                         throws CertificateEncodingException
Throws:
CertificateEncodingException

getSignature

public byte[] getSignature()

getSigAlgName

public String getSigAlgName()

getSigAlgOID

public String getSigAlgOID()

getSigAlgParams

public byte[] getSigAlgParams()

getIssuerUniqueID

public boolean[] getIssuerUniqueID()

getSubjectUniqueID

public boolean[] getSubjectUniqueID()

getKeyUsage

public boolean[] getKeyUsage()

getExtendedKeyUsage

public List getExtendedKeyUsage()
                         throws CertificateParsingException
Throws:
CertificateParsingException

getBasicConstraints

public int getBasicConstraints()

getSubjectAlternativeNames

public Collection getSubjectAlternativeNames()
                                      throws CertificateParsingException
Throws:
CertificateParsingException

getIssuerAlternativeNames

public Collection getIssuerAlternativeNames()
                                     throws CertificateParsingException
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
Throws:
CertificateEncodingException

verify

public void verify(PublicKey key)
            throws CertificateException,
                   NoSuchAlgorithmException,
                   InvalidKeyException,
                   NoSuchProviderException,
                   SignatureException
Throws:
CertificateException
NoSuchAlgorithmException
InvalidKeyException
NoSuchProviderException
SignatureException

verify

public void verify(PublicKey key,
                   String provider)
            throws CertificateException,
                   NoSuchAlgorithmException,
                   InvalidKeyException,
                   NoSuchProviderException,
                   SignatureException
Throws:
CertificateException
NoSuchAlgorithmException
InvalidKeyException
NoSuchProviderException
SignatureException

toString

public String toString()

getPublicKey

public PublicKey getPublicKey()

equals

public boolean equals(Object other)

For the latest news and information visit
The GNU Crypto project

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