com.rsa.certj.xml

Class RetrievalMethod

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

public class RetrievalMethod
extends KeyInfo
implements Cloneable, Serializable

This class builds and stores the RetrievalMethod element in KeyInfo. It is used to convey a reference to KeyInfo information that is stored at another location. It contains a URI that points to the real KeyInfo information and an optional field type that specifies the KeyInfo type.

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

RetrievalMethod()

Creates an empty RetrievalMethod object.

RetrievalMethod(String uri)

Creates a RetrievalMethod object by setting the URI to uri.

RetrievalMethod(String uri, String type)

Creates a RetrievalMethod object by setting uri and type to the given String 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 whatever this KeyInfo object contains and creates a DOM Element object.

 Certificate[]

getCertificates(CertJ certj)

Returns the certificates stored in this RetrievalMethod object.

 com.rsa.jsafe.JSAFE_PublicKey

getKey()

Returns the public key to be used for signature validation, if the keyInfo to which this RetrievalMethod refers contains a public key.

 String

getKeyInfoName()

Returns the keyInfo name.

 int

getKeyInfoType()

Returns the keyInfo type as an integer.

 boolean

hasCertificate()

Determines whether the KeyInfo to which this RetrievalMethod refers contains certificates.

 boolean

hasKey()

Determines whether the keyInfo to which this retrievalMethod refers contains a public key.

 void

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

This method processes the keyInfoNode, and retrieves the key or certificates referred to by this RetrievalMethod object.

 void

setCertificates(Certificate[] certificates)

Sets the certificates of this RetrievalMethod object to certificates.

 void

setKey(com.rsa.jsafe.JSAFE_PublicKey key)

Sets the key of this RetrievalMethod object to key.

 void

setType(String type)

Sets the KeyInfo type of this RetrievalMethod instance to type.

 void

setURI(String uri)

Sets the URI of this RetrievalMethod object to uri.

 
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

RetrievalMethod

public RetrievalMethod()
Creates an empty RetrievalMethod object.

RetrievalMethod

public RetrievalMethod(String uri)
Creates a RetrievalMethod object by setting the URI to uri.

Parameters

         uri  

A String object containing the URI in this RetrievalMethod object.


RetrievalMethod

public RetrievalMethod(String uri,
                       String type)
Creates a RetrievalMethod object by setting uri and type to the given String values.

Parameters

         uri  

A String object used for setting the URI in this RetrievalMethod object.

         type  

An optional identifier for the type of data to retrieve.

Method Detail

getKeyInfoType

public int getKeyInfoType()
Returns the keyInfo type as an integer.

Overrides

getKeyInfoType in class KeyInfo

Returns

The keyInfo type as an integer.

getKeyInfoName

public String getKeyInfoName()
Returns the keyInfo name.

Overrides

getKeyInfoName in class KeyInfo

Returns

The keyInfo name of this RetrievalMethod object as a String. The return value is always "RetrievalMethod."

generateKeyInfo

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

Overrides

generateKeyInfo in class KeyInfo

Parameters

         document  

A DOM Document object that the generated RetrievalMethod element will be attached to; it is the root of the XML signature.

         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 in 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 key or certificates referred to by this RetrievalMethod object.

Overrides

parseKeyInfo in class KeyInfo

Parameters

         keyInfoNode  

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

         xmlNamespace  

A String object that stores the namespace.

Throws

XMLException - If an error occured during processing the keyInfo Element object.

setURI

public void setURI(String uri)
Sets the URI of this RetrievalMethod object to uri.

Parameters

         uri  

A String value containing the URI to set.


setType

public void setType(String type)
Sets the KeyInfo type of this RetrievalMethod instance to type. This method does not check the validity of the type value. The type value is checked during signing and when generating the reference digest value.

Parameters

         type  

The identifier data type as a String value. This parameter is optional for RetrieveMethod.


getCertificates

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

Overrides

getCertificates in class KeyInfo

Parameters

         certj  

A CertJ object containing the certificates to get.

Returns

The certificates stored in this RetrievalMethod object.

Throws

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

getKey

public com.rsa.jsafe.JSAFE_PublicKey getKey()
                                     throws XMLException
Returns the public key to be used for signature validation, if the keyInfo to which this RetrievalMethod refers contains a public key.

Overrides

getKey in class KeyInfo

Returns

The key as a JSAFE_PublicKey used to validate the signature.

Throws

XMLException - If an error occurs during the retrieval of the key.

hasKey

public boolean hasKey()
               throws XMLException
Determines whether the keyInfo to which this retrievalMethod refers contains a public key.

Overrides

hasKey in class KeyInfo

Returns

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

hasCertificate

public boolean hasCertificate()
                       throws XMLException
Determines whether the KeyInfo to which this RetrievalMethod refers contains certificates.

Overrides

hasCertificate in class KeyInfo

Returns

true if this RetrievalMethod object contains certificates; false, otherwise.

Throws

XMLException - If an error occurs while determining whether the keyInfo for this RetrievalMethod contains certificates.

setKey

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

Overrides

setKey in class KeyInfo

Parameters

         key  

A JSAFE_PublicKey object.

Throws

XMLException - Always throws an XMLException, because RetrievalMethod does not store a key or certificates directly.

setCertificates

public void setCertificates(Certificate[] certificates)
                     throws XMLException
Sets the certificates of this RetrievalMethod object to certificates. RetrievalMethod does not store a key or certificates directly, so do not call this method on a RetrievalMethod object.

Overrides

setCertificates in class KeyInfo

Parameters

         certificates  

A list of Certificate objects.

Throws

XMLException - Always throws an XMLException, because a RetrievalMethod does not store a key or certificates directly.

clone

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

Returns

A new RetrievalMethod object, a copy of this object.

Throws

CloneNotSupportedException - If the cloning operation failed.


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