com.ibm.security.cert
Class X509V1CertImpl

java.lang.Object
  |
  +--javax.security.cert.Certificate
        |
        +--javax.security.cert.X509Certificate
              |
              +--com.ibm.security.cert.X509V1CertImpl

public final class X509V1CertImpl
extends X509Certificate
implements java.io.Serializable

The X509V1CertImpl class is used as a conversion wrapper around sun.security.x509.X509Cert certificates when running under JDK1.1.x.

Version:
1.13
Author:
Jeff Nisewanger
See Also:
Serialized Form

Constructor Summary
X509V1CertImpl()
          Default constructor.
X509V1CertImpl(byte[] certData)
          Unmarshals a certificate from its encoded form, parsing the encoded bytes.
X509V1CertImpl(java.io.InputStream in)
          unmarshals an X.509 certificate from an input stream.
 
Method Summary
 void checkValidity()
          Checks that the certificate is currently valid, i.e.
 void checkValidity(java.util.Date date)
          Checks that the specified date is within the certificate's validity period, or basically if the certificate would be valid at the specified date/time.
 byte[] getEncoded()
          Returns the encoded form of this certificate.
 java.security.Principal getIssuerDN()
          Gets the issuer distinguished name from the certificate.
 java.util.Date getNotAfter()
          Gets the notAfter date from the validity period of the certificate.
 java.util.Date getNotBefore()
          Gets the notBefore date from the validity period of the certificate.
 java.security.PublicKey getPublicKey()
          Gets the publickey from this certificate.
 java.math.BigInteger getSerialNumber()
          Gets the serial number from the certificate.
 java.lang.String getSigAlgName()
          Gets the signature algorithm name for the certificate signature algorithm.
 java.lang.String getSigAlgOID()
          Gets the signature algorithm OID string from the certificate.
 byte[] getSigAlgParams()
          Gets the DER encoded signature algorithm parameters from this certificate's signature algorithm.
 java.security.Principal getSubjectDN()
          Gets the subject distinguished name from the certificate.
 int getVersion()
          Gets the version (version number) value from the certificate.
 java.security.cert.X509Certificate getX509Certificate()
           
 java.lang.String toString()
          Returns a printable representation of the certificate.
 void verify(java.security.PublicKey key)
          Throws an exception if the certificate was not signed using the verification key provided.
 void verify(java.security.PublicKey key, java.lang.String sigProvider)
          Throws an exception if the certificate was not signed using the verification key provided.
 
Methods inherited from class javax.security.cert.X509Certificate
getInstance, getInstance
 
Methods inherited from class javax.security.cert.Certificate
equals, hashCode
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

X509V1CertImpl

public X509V1CertImpl()
Default constructor.

X509V1CertImpl

public X509V1CertImpl(byte[] certData)
               throws CertificateException
Unmarshals a certificate from its encoded form, parsing the encoded bytes. This form of constructor is used by agents which need to examine and use certificate contents. That is, this is one of the more commonly used constructors. Note that the buffer must include only a certificate, and no "garbage" may be left at the end. If you need to ignore data at the end of a certificate, use another constructor.
Parameters:
certData - the encoded bytes, with no trailing padding.
Throws:
CertificateException - on parsing errors.

X509V1CertImpl

public X509V1CertImpl(java.io.InputStream in)
               throws CertificateException
unmarshals an X.509 certificate from an input stream.
Parameters:
in - an input stream holding at least one certificate
Throws:
CertificateException - on parsing errors.
Method Detail

getEncoded

public byte[] getEncoded()
                  throws CertificateEncodingException
Returns the encoded form of this certificate. It is assumed that each certificate type would have only a single form of encoding; for example, X.509 certificates would be encoded as ASN.1 DER.
Overrides:
getEncoded in class Certificate
Tags copied from class: Certificate
Throws:
CertificateEncodingException - on internal certificate encoding failure

verify

public void verify(java.security.PublicKey key)
            throws CertificateException,
                   java.security.NoSuchAlgorithmException,
                   java.security.InvalidKeyException,
                   java.security.NoSuchProviderException,
                   java.security.SignatureException
Throws an exception if the certificate was not signed using the verification key provided. Successfully verifying a certificate does not indicate that one should trust the entity which it represents.
Overrides:
verify in class Certificate
Parameters:
key - the public key used for verification.

verify

public void verify(java.security.PublicKey key,
                   java.lang.String sigProvider)
            throws CertificateException,
                   java.security.NoSuchAlgorithmException,
                   java.security.InvalidKeyException,
                   java.security.NoSuchProviderException,
                   java.security.SignatureException
Throws an exception if the certificate was not signed using the verification key provided. Successfully verifying a certificate does not indicate that one should trust the entity which it represents.
Overrides:
verify in class Certificate
Parameters:
key - the public key used for verification.
sigProvider - the name of the provider.

checkValidity

public void checkValidity()
                   throws CertificateExpiredException,
                          CertificateNotYetValidException
Checks that the certificate is currently valid, i.e. the current time is within the specified validity period.
Overrides:
checkValidity in class X509Certificate
Tags copied from class: X509Certificate
Throws:
CertificateExpiredException - if the certificate has expired.
CertificateNotYetValidException - if the certificate is not yet valid.

checkValidity

public void checkValidity(java.util.Date date)
                   throws CertificateExpiredException,
                          CertificateNotYetValidException
Checks that the specified date is within the certificate's validity period, or basically if the certificate would be valid at the specified date/time.
Overrides:
checkValidity in class X509Certificate
Parameters:
date - the Date to check against to see if this certificate is valid at that date/time.

toString

public java.lang.String toString()
Returns a printable representation of the certificate. This does not contain all the information available to distinguish this from any other certificate. The certificate must be fully constructed before this function may be called.
Overrides:
toString in class Certificate
Tags copied from class: Certificate
Returns:
a string representation of this certificate.

getPublicKey

public java.security.PublicKey getPublicKey()
Gets the publickey from this certificate.
Overrides:
getPublicKey in class Certificate
Returns:
the publickey.

getVersion

public int getVersion()
Description copied from class: X509Certificate
Gets the version (version number) value from the certificate. The ASN.1 definition for this is:
 version         [0]  EXPLICIT Version DEFAULT v1

Version ::= INTEGER { v1(0), v2(1), v3(2) }

Overrides:
getVersion in class X509Certificate
Tags copied from class: X509Certificate
Returns:
the version number.

getSerialNumber

public java.math.BigInteger getSerialNumber()
Gets the serial number from the certificate.
Overrides:
getSerialNumber in class X509Certificate
Returns:
the serial number.

getSubjectDN

public java.security.Principal getSubjectDN()
Gets the subject distinguished name from the certificate.
Overrides:
getSubjectDN in class X509Certificate
Returns:
the subject name.

getIssuerDN

public java.security.Principal getIssuerDN()
Gets the issuer distinguished name from the certificate.
Overrides:
getIssuerDN in class X509Certificate
Returns:
the issuer name.

getNotBefore

public java.util.Date getNotBefore()
Gets the notBefore date from the validity period of the certificate.
Overrides:
getNotBefore in class X509Certificate
Returns:
the start date of the validity period.

getNotAfter

public java.util.Date getNotAfter()
Gets the notAfter date from the validity period of the certificate.
Overrides:
getNotAfter in class X509Certificate
Returns:
the end date of the validity period.

getSigAlgName

public java.lang.String getSigAlgName()
Gets the signature algorithm name for the certificate signature algorithm. For example, the string "SHA1/DSA".
Overrides:
getSigAlgName in class X509Certificate
Returns:
the signature algorithm name.

getSigAlgOID

public java.lang.String getSigAlgOID()
Gets the signature algorithm OID string from the certificate. For example, the string "1.2.840.10040.4.3"
Overrides:
getSigAlgOID in class X509Certificate
Returns:
the signature algorithm oid string.

getSigAlgParams

public byte[] getSigAlgParams()
Gets the DER encoded signature algorithm parameters from this certificate's signature algorithm.
Overrides:
getSigAlgParams in class X509Certificate
Returns:
the DER encoded signature algorithm parameters, or null if no parameters are present.

getX509Certificate

public java.security.cert.X509Certificate getX509Certificate()