com.rsa.certj.xml

Class KeyInfo

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

public abstract class KeyInfo
extends Object
implements Cloneable, Serializable

This class builds and stores a KeyInfo element. It stores keys, names, certificates, and other public-key management information, such as in-band key distribution or key-agreement data. It is the base class for all types of KeyInfo. There are several kinds of KeyInfo, including: KeyName, KeyValue, X509Data, RetrievalMethod, PGPData, SPKIData, and MgmtData. This class is an abstract class; the subclasses implement the details.

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

See Also

Serialized Form

Field Summary

static int

KEYNAME_KEYINFO

Specifies the KeyInfo as a KeyName that contains a String value to be used by the signer to communicate a key identifier to the recipient.

static int

KEYVALUE_KEYINFO

Specifies the KeyInfo as a KeyValue that contains one or more public keys that might be useful in validating the signature.

static int

MGMTDATA_KEYINFO

Specifies the KeyInfo as a MgmtData that is used to convey in-band key distribution or agreement data.

static String

MGMTDATA_TYPE

A URL defining the type value of MGMTData.

static int

PGPDATA_KEYINFO

Specifies the KeyInfo as a PGPData that is used to convey information to PGP public-key pairs and signatures on such keys.

static String

PGPDATA_TYPE

A URL defining the type value of PGPData.

static int

RETRIEVALMETHOD_KEYINFO

Specifies the KeyInfo as a RetrievalMethod that is used to convey a pointer to KeyInfo-like information that is stored at a remote location.

static int

SPKIDATA_KEYINFO

Specifies the KeyInfo as a SPKIData that is used to convey information related to SPKI public-key pairs, certificates, and other SPKI data.

static String

SPKIDATA_TYPE

A URL defining the type value of SPKIData.

static String

X509CERTIFICATE_TYPE

A URL defining the KeyInfo type as a binary X.509 certificate.

static int

X509DATA_KEYINFO

Specifies the KeyInfo as an X509Data that contains one or more identifiers of keys or X509 certificates that might be useful for validation.

static String

X509DATA_TYPE

A URL defining the type value of X509Data.

 

Constructor Summary

KeyInfo()

 

 

Method Summary

abstract  org.w3c.dom.Element

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

Creates a DOM Element object using the contents of the KeyInfo object.

abstract  Certificate[]

getCertificates(CertJ certj)

Returns the certificates stored in this KeyInfo object.

static KeyInfo

getInstance(String keyInfoName)

Instantiates a particular KeyInfo object.

abstract  com.rsa.jsafe.JSAFE_PublicKey

getKey()

Returns the public key.

abstract  String

getKeyInfoName()

Returns the keyInfo name.

abstract  int

getKeyInfoType()

Returns the keyInfo type.

abstract  boolean

hasCertificate()

Determines whether keyInfo contains certificates.

abstract  boolean

hasKey()

Determines whether this keyInfo contains a public key.

abstract  void

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

Processes the keyInfoNode and retrieves the key or certificates stored in the keyInfoData.

abstract  void

setCertificates(Certificate[] certificates)

Sets the certificates of this KeyInfo object to certificates.

abstract  void

setKey(com.rsa.jsafe.JSAFE_PublicKey key)

Sets the key of this KeyInfo object to the passed-in value.

 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEYNAME_KEYINFO

public static final int KEYNAME_KEYINFO
Specifies the KeyInfo as a KeyName that contains a String value to be used by the signer to communicate a key identifier to the recipient. Typically, KeyName contains an identifier related to the key pair used to sign the message, but it may contain other protocol-related information that indirectly identifies a key pair.

KEYVALUE_KEYINFO

public static final int KEYVALUE_KEYINFO
Specifies the KeyInfo as a KeyValue that contains one or more public keys that might be useful in validating the signature.

X509DATA_KEYINFO

public static final int X509DATA_KEYINFO
Specifies the KeyInfo as an X509Data that contains one or more identifiers of keys or X509 certificates that might be useful for validation.

RETRIEVALMETHOD_KEYINFO

public static final int RETRIEVALMETHOD_KEYINFO
Specifies the KeyInfo as a RetrievalMethod that is used to convey a pointer to KeyInfo-like information that is stored at a remote location.

PGPDATA_KEYINFO

public static final int PGPDATA_KEYINFO
Specifies the KeyInfo as a PGPData that is used to convey information to PGP public-key pairs and signatures on such keys.

SPKIDATA_KEYINFO

public static final int SPKIDATA_KEYINFO
Specifies the KeyInfo as a SPKIData that is used to convey information related to SPKI public-key pairs, certificates, and other SPKI data.

MGMTDATA_KEYINFO

public static final int MGMTDATA_KEYINFO
Specifies the KeyInfo as a MgmtData that is used to convey in-band key distribution or agreement data.

X509DATA_TYPE

public static final String X509DATA_TYPE
A URL defining the type value of X509Data.

PGPDATA_TYPE

public static final String PGPDATA_TYPE
A URL defining the type value of PGPData.

SPKIDATA_TYPE

public static final String SPKIDATA_TYPE
A URL defining the type value of SPKIData.

MGMTDATA_TYPE

public static final String MGMTDATA_TYPE
A URL defining the type value of MGMTData.

X509CERTIFICATE_TYPE

public static final String X509CERTIFICATE_TYPE
A URL defining the KeyInfo type as a binary X.509 certificate.
Constructor Detail

KeyInfo

public KeyInfo()
Method Detail

getInstance

public static KeyInfo getInstance(String keyInfoName)
                           throws XMLException
Instantiates a particular KeyInfo object.

Parameters

         keyInfoName  

The keyInfo name associated with a KeyInfo object.

Returns

The KeyInfo object stored in the internal hash table that contains all the supported KeyInfo types that have keyInfoName as the key.

Throws

XMLException - If an error occurs while creating the KeyInfo object.

getKeyInfoType

public abstract int getKeyInfoType()
Returns the keyInfo type.

Returns

The keyInfo type as an integer such as KEYVALUE_KEYINFO or PGPDATA_KEYINFO.

getKeyInfoName

public abstract String getKeyInfoName()
Returns the keyInfo name.

Returns

The keyInfo name of this KeyInfo object as a String

generateKeyInfo

public abstract org.w3c.dom.Element generateKeyInfo(org.w3c.dom.Document document,
                                                    String xmlNamespace,
                                                    String prefix)
                                             throws XMLException
Creates a DOM Element object using the contents of the KeyInfo object. The element will be attached to the document.

Parameters

         document  

The DOM Document object to be used as the root to store the generated keyInfo as an Element.

         xmlNamespace  

A String object that stores the namespace.

         prefix  

A String object that stores the prefix on which the generated keyInfo element is based.

Returns

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

Throws

XMLException - If an error occurs while generating the keyInfo as an Element.

parseKeyInfo

public abstract void parseKeyInfo(org.w3c.dom.Element keyInfoNode,
                                  String xmlNamespace)
                           throws XMLException
Processes the keyInfoNode and retrieves the key or certificates stored in the keyInfoData.

Parameters

         keyInfoNode  

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

         xmlNamespace  

A String object that stores the namespace.

Throws

XMLException - If an error occurs while processing the keyInfo Element object.

hasKey

public abstract boolean hasKey()
                        throws XMLException
Determines whether this keyInfo contains a public key.

Returns

true if this KeyInfo object contains a key; false, otherwise.

Throws

XMLException - If an error occurs while checking for a public key.

hasCertificate

public abstract boolean hasCertificate()
                                throws XMLException
Determines whether keyInfo contains certificates.

Returns

true if this KeyInfo object contains certificates; false otherwise.

Throws

XMLException - If an error occurs while checking the availability of the certificates.

getCertificates

public abstract Certificate[] getCertificates(CertJ certj)
                                       throws XMLException
Returns the certificates stored in this KeyInfo object.

Parameters

         certj  

A CertJ object containing the certificates.

Returns

The certificates stored in this KeyInfo object.

Throws

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

getKey

public abstract com.rsa.jsafe.JSAFE_PublicKey getKey()
                                              throws XMLException
Returns the public key.

Returns

The JSAFE_PublicKey object stored in this KeyInfo object.

Throws

XMLException - If an error occurs while retrieving the key.

setKey

public abstract void setKey(com.rsa.jsafe.JSAFE_PublicKey key)
                     throws XMLException
Sets the key of this KeyInfo object to the passed-in value.

Parameters

         key  

A JSAFE_PublicKey object to be used for setting.

Throws

XMLException - If an error occurs while setting the key.

setCertificates

public abstract void setCertificates(Certificate[] certificates)
                              throws XMLException
Sets the certificates of this KeyInfo object to certificates.

Parameters

         certificates  

A list of Certificate objects to use to retrieve the key for validation.

Throws

XMLException - If an error occurs while setting the certificates.


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