com.rsa.certj.xml

Class X509Data

java.lang.Object
  |
  +--com.rsa.certj.xml.KeyInfo
        |
        +--com.rsa.certj.xml.X509Data
All Implemented Interfaces:
Cloneable, Serializable

public class X509Data
extends KeyInfo
implements Cloneable, Serializable

This class stores one or more identifiers of X.509 certificates such as subject name, issuer serial number, and so on, that can be useful for validation. These identifiers map to the same certificate. There are five types of X509Data: X509IssuerSerial, X509SubjectName, X509SKI, X509Certificate, and X509CRL.

Note: If the verification side uses the IBM toolkit, the DSA certificates stored in an X509Certificate element should be in X957 format.

Copyright © RSA Security Inc., 2001-2002. All rights reserved.

See Also

Serialized Form

Fields inherited from class com.rsa.certj.xml.KeyInfo
KEYNAME_KEYINFO, KEYVALUE_KEYINFO, MGMTDATA_KEYINFO, MGMTDATA_TYPE, PGPDATA_KEYINFO, PGPDATA_TYPE, RETRIEVALMETHOD_KEYINFO, SPKIDATA_KEYINFO, SPKIDATA_TYPE, X509CERTIFICATE_TYPE, X509DATA_KEYINFO, X509DATA_TYPE
 

Constructor Summary

X509Data()

Creates an empty X509Data object.

X509Data(X500Name issuerName, byte[] serialNum, X500Name subjectName, SubjectKeyID subjectKeyID, X509Certificate[] certificates, X509CRL crl)

Creates an X509Data object and initializes it with the given values.

 

Method Summary

 Object

clone()

Overrides the default clone method to get a deeper clone.

 org.w3c.dom.Element

generateKeyInfo(org.w3c.dom.Document document, String xmlNamespace, String prefix)

This method takes the contents of this KeyInfo and creates a DOM Element object.

 Certificate[]

getCertificates(CertJ certj)

Returns the certificates stored in this keyInfo object.

 com.rsa.jsafe.JSAFE_PublicKey

getKey()

Returns the public key stored in this KeyInfo object.

 String

getKeyInfoName()

Returns the KeyInfo name, which is always "X509Data".

 int

getKeyInfoType()

Returns the KeyInfo type, which is always the type X509Data.

 byte[]

getSerialNum()

Returns the serial number of this X509Data object, if there is one.

 X509CRL

getX509CRL()

Returns the X.509 v3 certificate revocation list (CRL).

 X500Name

getX509IssuerName()

Returns the X.509 issuer distinguished name of this X509Data object, if there is one.

 SubjectKeyID

getX509SKI()

Returns the subject-key identifier value of this X509Data object, if there is one.

 X500Name

getX509SubjectName()

Returns the X.509 subject name of this X509Data object, if there is one.

 boolean

hasCertificate()

Returns true if this KeyInfo object contains certificates; returns false otherwise.

 boolean

hasKey()

Determines whether the KeyInfo to which this X509Data refers contains a public key.

 void

parseKeyInfo(org.w3c.dom.Element keyInfoNode, String xmlNamespace)

This method processes the keyInfoNode and retrieves the certificates, or related information such as subject name.

 void

setCertificates(Certificate[] certificates)

Sets the certificates of this X509Data object to certificates.

 void

setKey(com.rsa.jsafe.JSAFE_PublicKey key)

Sets the key of this X509Data object to key.

 void

setX509CRL(X509CRL crl)

Sets the X509CRL attribute of this X509Data object.

 void

setX509IssuerSerial(X500Name issuerName, byte[] serialNum)

Sets the issuer name and serial number of this X509Data object by assigning them to issuerName and serialNum.

 void

setX509SKI(SubjectKeyID subjectKeyID)

Sets the subjectKeyID of this X509Data object.

 void

setX509SubjectName(X500Name subjectName)

Sets the X.509 subject distinguished name.

 
Methods inherited from class com.rsa.certj.xml.KeyInfo
getInstance
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

X509Data

public X509Data()
Creates an empty X509Data object.

X509Data

public X509Data(X500Name issuerName,
                byte[] serialNum,
                X500Name subjectName,
                SubjectKeyID subjectKeyID,
                X509Certificate[] certificates,
                X509CRL crl)
Creates an X509Data object and initializes it with the given values.

Parameters

         issuerName  

An X500Name object containing the issuer name of an X.509 certificate.

         serialNum  

The serial number of the certificate specified by issuerName.

         subjectName  

An X500Name object containing the subject name of an X.509 certificate.

         subjectKeyID  

A SubjectKeyID object the contains an X.509 subject key.

         certificates  

An X509Certificate object array containing the certificate list of this X509Data object to set.

         crl  

An X509CRL object containing the crl of this X509Data object to set.

Method Detail

getKeyInfoType

public int getKeyInfoType()
Returns the KeyInfo type, which is always the type X509Data.

Overrides

getKeyInfoType in class KeyInfo

Returns

The KeyInfo type as an integer. This method always returns X509DATA_KEYINFO.

getKeyInfoName

public String getKeyInfoName()
Returns the KeyInfo name, which is always "X509Data".

Overrides

getKeyInfoName in class KeyInfo

Returns

The KeyInfo name of this KeyInfo object as the String "X509Data".

generateKeyInfo

public org.w3c.dom.Element generateKeyInfo(org.w3c.dom.Document document,
                                           String xmlNamespace,
                                           String prefix)
                                    throws XMLException
This method takes the contents of this KeyInfo and creates a DOM Element object. This element will be attached to document.

Overrides

generateKeyInfo in class KeyInfo

Parameters

         document  

A DOM Document object which is the root of the resulting KeyInfo element.

         xmlNamespace  

A String object that stores the namespace.

         prefix  

A String object that stores the prefix.

Returns

The DOM Element object that stores all the information of this KeyInfo.

Throws

XMLException - If an error occured while generating the KeyInfo as an Element.

parseKeyInfo

public void parseKeyInfo(org.w3c.dom.Element keyInfoNode,
                         String xmlNamespace)
                  throws XMLException
This method processes the keyInfoNode and retrieves the certificates, or related information such as subject name.

Overrides

parseKeyInfo in class KeyInfo

Parameters

         keyInfoNode  

A DOM Element object that stores the information of this KeyInfo object.

         xmlNamespace  

A String object that stores the namespace.

Throws

XMLException - If an error occured while processing the keyInfo Element.

setX509SubjectName

public void setX509SubjectName(X500Name subjectName)
Sets the X.509 subject distinguished name.

Parameters

         subjectName  

An X500Name object.


setX509IssuerSerial

public void setX509IssuerSerial(X500Name issuerName,
                                byte[] serialNum)
Sets the issuer name and serial number of this X509Data object by assigning them to issuerName and serialNum.

Parameters

         issuerName  

An X500Name object that is the issuer name of an X.509 certificate.

         serialNum  

The serial number of the certificate specified by issuerName.


setX509SKI

public void setX509SKI(SubjectKeyID subjectKeyID)
Sets the subjectKeyID of this X509Data object.

Parameters

         subjectKeyID  

A SubjectKeyID object.


setX509CRL

public void setX509CRL(X509CRL crl)
Sets the X509CRL attribute of this X509Data object. It is used for certificate validation.

Parameters

         crl  

An X509CRL object used to set the CRL of this X509Data object.


setKey

public void setKey(com.rsa.jsafe.JSAFE_PublicKey key)
            throws XMLException
Sets the key of this X509Data object to key. Because X509Data does not store a key directly, do not call this method on an X509Data object.

Overrides

setKey in class KeyInfo

Parameters

         key  

A JSAFE_PublicKey object.

Throws

XMLException - Always throws an XMLException, because X509Data does not store a key directly.

setCertificates

public void setCertificates(Certificate[] certificates)
Sets the certificates of this X509Data object to certificates. If the verification side uses an IBM toolkit, the DSA certificates stored in the X509Certificate element should be in X957 format.

Overrides

setCertificates in class KeyInfo

Parameters

         certificates  

A Certificate array containing the certificates to set.


getCertificates

public Certificate[] getCertificates(CertJ certj)
                              throws XMLException
Returns the certificates stored in this keyInfo object. The subject name, issuer serial, and subject-key identifier grouped in this X509Data object should map to the same certificate.

Overrides

getCertificates in class KeyInfo

Parameters

         certj  

A CertJ object containing the certificates to get.

Returns

The certificates stored in this KeyInfo object.

Throws

XMLException - If an error occured in retrieving the certificates stored in this KeyInfo object.

getX509CRL

public X509CRL getX509CRL()
Returns the X.509 v3 certificate revocation list (CRL).

Returns

The X509CRL data stored in this X509Data object.

getX509SKI

public SubjectKeyID getX509SKI()
Returns the subject-key identifier value of this X509Data object, if there is one.

Returns

The SubjectKeyID data stored in this X509Data object.

getX509SubjectName

public X500Name getX509SubjectName()
Returns the X.509 subject name of this X509Data object, if there is one.

Returns

The subject name of this X509Data object as an X500Name.

getX509IssuerName

public X500Name getX509IssuerName()
Returns the X.509 issuer distinguished name of this X509Data object, if there is one.

Returns

The issuerName of this X509Data object as an X500Name.

getSerialNum

public byte[] getSerialNum()
Returns the serial number of this X509Data object, if there is one.

Returns

The serial number that is associated with the issuer name, as a byte array.

hasKey

public boolean hasKey()
Determines whether the KeyInfo to which this X509Data refers contains a public key.

Overrides

hasKey in class KeyInfo

Returns

true if this KeyInfo object contains a key; false, otherwise. Because X509Data does not store a key directly, this method always returns false.

getKey

public com.rsa.jsafe.JSAFE_PublicKey getKey()
Returns the public key stored in this KeyInfo object.

Overrides

getKey in class KeyInfo

Returns

The JSAFE_PublicKey object stored in this X509Data object. Because X509Data objects do not store key information directly, this method always returns null.

hasCertificate

public boolean hasCertificate()
Returns true if this KeyInfo object contains certificates; returns false otherwise.

Overrides

hasCertificate in class KeyInfo

Returns

true if this KeyInfo object contains certificates or other information for retrieving certificates from the database; false, otherwise.

clone

public Object clone()
             throws CloneNotSupportedException
Overrides the default clone method to get a deeper clone.

Returns

A new X509Data object, a copy of this object.

Throws

CloneNotSupportedException - If the cloning operation is not successful.


RSA BSAFE ® Cert-J 2.1.1 001-047007-211-001-000