gnu.crypto.pki
Class X509CertificateImpl
java.lang.Object
java.security.cert.Certificate
java.security.cert.X509Certificate
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
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
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()
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)
Copyright © 2001, 2002, 2003
Free Software Foundation,
Inc. All Rights Reserved.