Skip navigation links

Oracle Security Developer Tools JCE Java API Reference
11g (11.1.1)

E10697-02


oracle.security.crypto.jce.cert
Class X509Impl

java.lang.Object
  extended by java.security.cert.Certificate
      extended by java.security.cert.X509Certificate
          extended by oracle.security.crypto.jce.cert.X509Impl

All Implemented Interfaces:
java.io.Serializable, java.security.cert.X509Extension, oracle.security.crypto.asn1.ASN1Object, oracle.security.crypto.util.Streamable

public class X509Impl
extends java.security.cert.X509Certificate
implements oracle.security.crypto.asn1.ASN1Object

This class encapsulates X.509 Version 3 certificates.

Both RSA and DSA certificates are supported. This class provides the methods for reading and writing X509 Version 1 fields of the certificate.

Any X509 v3 extension can be handled through X509Extension. A subset of the standard extensions defined in RFC 2459 are conveniently implemented as subclasses of X509Extension, in the oracle.security.crypto.cert.ext package.

See Also:
X509Attributes, X509Extension, X509ExtensionSet, Serialized Form

Nested Class Summary

 

Nested classes/interfaces inherited from class java.security.cert.Certificate
java.security.cert.Certificate.CertificateRep

 

Constructor Summary
X509Impl()
           
X509Impl(java.io.InputStream is)
          Construct from the specified input stream.

 

Method Summary
 void checkValidity()
          Verify the date of the certificate.
 void checkValidity(java.util.Date date)
          Verify the date of the certificate.
 boolean equals(java.lang.Object o)
          Compare this certificate to the specified object.
 int getBasicConstraints()
           
 java.util.Set getCriticalExtensionOIDs()
           
 byte[] getEncoded()
          Returns the ASN.1 encoding.
 byte[] getExtensionValue(java.lang.String oid)
           
 java.security.Principal getIssuerDN()
          Returns the name of the issuer.
 boolean[] getIssuerUniqueID()
           
 boolean[] getKeyUsage()
           
 java.util.Set getNonCriticalExtensionOIDs()
           
 java.util.Date getNotAfter()
          Get the not after date.
 java.util.Date getNotBefore()
          Get the not before date.
 java.security.PublicKey getPublicKey()
          Gets the public key.
 java.math.BigInteger getSerialNumber()
          Get the serial number.
 java.lang.String getSigAlgName()
           
 java.lang.String getSigAlgOID()
          Get the string representation of the signature algorithm used to sign this certificate.
 byte[] getSigAlgParams()
           
 byte[] getSignature()
          Returns the signature bytes, signing the certificate first if needed.
 java.security.Principal getSubjectDN()
          Get the sbjectDN of the certificate.
 boolean[] getSubjectUniqueID()
           
 byte[] getTBSCertificate()
           
 int getVersion()
           
 int hashCode()
           
 boolean hasUnsupportedCriticalExtension()
           
 void input(java.io.InputStream is)
           
 int length()
          Returns length of DER encoding of this certificate.
 void output(java.io.OutputStream os)
          Output to the specified output stream.
 java.lang.String toString()
          Returns a verbose humanly readable representation of this certificate.
 void verify(java.security.PublicKey key)
          Verifies this certificate.
 void verify(java.security.PublicKey key, java.lang.String sigProvider)
          Verifies this certificate.

 

Methods inherited from class java.security.cert.X509Certificate
getExtendedKeyUsage, getIssuerAlternativeNames, getIssuerX500Principal, getSubjectAlternativeNames, getSubjectX500Principal

 

Methods inherited from class java.security.cert.Certificate
getType, writeReplace

 

Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait

 

Constructor Detail

X509Impl

public X509Impl()

X509Impl

public X509Impl(java.io.InputStream is)
         throws java.io.IOException
Construct from the specified input stream.
Throws:
java.io.IOException

Method Detail

input

public void input(java.io.InputStream is)
           throws java.io.IOException
Specified by:
input in interface oracle.security.crypto.util.Streamable
Throws:
java.io.IOException

output

public void output(java.io.OutputStream os)
            throws java.io.IOException
Output to the specified output stream.
Specified by:
output in interface oracle.security.crypto.util.Streamable
Throws:
java.io.IOException

length

public int length()
Returns length of DER encoding of this certificate.

Throws a StreamableOutputException if an error occurs while generating the DER encoding.

Specified by:
length in interface oracle.security.crypto.util.Streamable

getEncoded

public byte[] getEncoded()
Returns the ASN.1 encoding.

Throws a StreamableOutputException if an error occurs while generating the encoded bytes.

Specified by:
getEncoded in class java.security.cert.Certificate

getTBSCertificate

public byte[] getTBSCertificate()
Specified by:
getTBSCertificate in class java.security.cert.X509Certificate

getSignature

public byte[] getSignature()
Returns the signature bytes, signing the certificate first if needed.
Specified by:
getSignature in class java.security.cert.X509Certificate

verify

public void verify(java.security.PublicKey key,
                   java.lang.String sigProvider)
            throws java.security.cert.CertificateException,
                   java.security.NoSuchAlgorithmException,
                   java.security.InvalidKeyException,
                   java.security.NoSuchProviderException,
                   java.security.SignatureException
Verifies this certificate.
Specified by:
verify in class java.security.cert.Certificate
Throws:
java.security.cert.CertificateException
java.security.NoSuchAlgorithmException
java.security.InvalidKeyException
java.security.NoSuchProviderException
java.security.SignatureException

verify

public void verify(java.security.PublicKey key)
            throws java.security.cert.CertificateException,
                   java.security.NoSuchAlgorithmException,
                   java.security.InvalidKeyException,
                   java.security.NoSuchProviderException,
                   java.security.SignatureException
Verifies this certificate.
Specified by:
verify in class java.security.cert.Certificate
Throws:
java.security.cert.CertificateException
java.security.NoSuchAlgorithmException
java.security.InvalidKeyException
java.security.NoSuchProviderException
java.security.SignatureException

checkValidity

public void checkValidity()
                   throws java.security.cert.CertificateExpiredException,
                          java.security.cert.CertificateNotYetValidException
Verify the date of the certificate.
Specified by:
checkValidity in class java.security.cert.X509Certificate
Throws:
java.security.cert.CertificateExpiredException
java.security.cert.CertificateNotYetValidException

checkValidity

public void checkValidity(java.util.Date date)
                   throws java.security.cert.CertificateExpiredException,
                          java.security.cert.CertificateNotYetValidException
Verify the date of the certificate.
Specified by:
checkValidity in class java.security.cert.X509Certificate
Throws:
java.security.cert.CertificateExpiredException
java.security.cert.CertificateNotYetValidException

getSubjectDN

public java.security.Principal getSubjectDN()
Get the sbjectDN of the certificate.
Specified by:
getSubjectDN in class java.security.cert.X509Certificate

getSubjectUniqueID

public boolean[] getSubjectUniqueID()
Specified by:
getSubjectUniqueID in class java.security.cert.X509Certificate

getPublicKey

public java.security.PublicKey getPublicKey()
Gets the public key.
Specified by:
getPublicKey in class java.security.cert.Certificate

getNotBefore

public java.util.Date getNotBefore()
Get the not before date.
Specified by:
getNotBefore in class java.security.cert.X509Certificate

getNotAfter

public java.util.Date getNotAfter()
Get the not after date.
Specified by:
getNotAfter in class java.security.cert.X509Certificate

getIssuerDN

public java.security.Principal getIssuerDN()
Returns the name of the issuer.
Specified by:
getIssuerDN in class java.security.cert.X509Certificate

getIssuerUniqueID

public boolean[] getIssuerUniqueID()
Specified by:
getIssuerUniqueID in class java.security.cert.X509Certificate

getSerialNumber

public java.math.BigInteger getSerialNumber()
Get the serial number.
Specified by:
getSerialNumber in class java.security.cert.X509Certificate

getSigAlgOID

public java.lang.String getSigAlgOID()
Get the string representation of the signature algorithm used to sign this certificate.
Specified by:
getSigAlgOID in class java.security.cert.X509Certificate

getSigAlgName

public java.lang.String getSigAlgName()
Specified by:
getSigAlgName in class java.security.cert.X509Certificate

getSigAlgParams

public byte[] getSigAlgParams()
Specified by:
getSigAlgParams in class java.security.cert.X509Certificate

getVersion

public int getVersion()
Specified by:
getVersion in class java.security.cert.X509Certificate

getCriticalExtensionOIDs

public java.util.Set getCriticalExtensionOIDs()
Specified by:
getCriticalExtensionOIDs in interface java.security.cert.X509Extension

getNonCriticalExtensionOIDs

public java.util.Set getNonCriticalExtensionOIDs()
Specified by:
getNonCriticalExtensionOIDs in interface java.security.cert.X509Extension

getExtensionValue

public byte[] getExtensionValue(java.lang.String oid)
Specified by:
getExtensionValue in interface java.security.cert.X509Extension

hasUnsupportedCriticalExtension

public boolean hasUnsupportedCriticalExtension()
Specified by:
hasUnsupportedCriticalExtension in interface java.security.cert.X509Extension

getBasicConstraints

public int getBasicConstraints()
Specified by:
getBasicConstraints in class java.security.cert.X509Certificate

getKeyUsage

public boolean[] getKeyUsage()
Specified by:
getKeyUsage in class java.security.cert.X509Certificate

equals

public boolean equals(java.lang.Object o)
Compare this certificate to the specified object. Returns true if and only if the argument is not null and is an X509 object which has the same DER encoding as this object.
Overrides:
equals in class java.security.cert.Certificate

hashCode

public int hashCode()
Overrides:
hashCode in class java.security.cert.Certificate

toString

public java.lang.String toString()
Returns a verbose humanly readable representation of this certificate. This method is recommended to be used only for debugging.
Specified by:
toString in class java.security.cert.Certificate

Skip navigation links

Oracle Security Developer Tools JCE Java API Reference
11g (11.1.1)

E10697-02


Copyright © 2005, 2009, Oracle. All rights reserved.