com.rsa.certj.xml

Class KeyValue

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

public class KeyValue
extends KeyInfo
implements Cloneable, Serializable

This class builds and stores a KeyValue element in KeyInfo. It contains the key that can be used to validate the signature.

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

KeyValue()

Creates an empty KeyValue object.

KeyValue(com.rsa.jsafe.JSAFE_PublicKey publicKey)

Creates a KeyValue object and initializes the key to publicKey.

 

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)

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

 Certificate[]

getCertificates(CertJ certj)

Returns the certificates stored in this KeyInfo.

 com.rsa.jsafe.JSAFE_PublicKey

getKey()

Returns the public key.

 String

getKeyInfoName()

Returns the keyInfo name as a String.

 int

getKeyInfoType()

Returns an integer specifying the keyInfo type.

 boolean

hasCertificate()

Returns a Boolean variable indicating whether this KeyValue contains certificates.

 boolean

hasKey()

Returns a Boolean variable indicating whether this KeyValue contains a public key.

 void

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

Parses the keyInfo element and sets the key with the retrieved data.

 void

setCertificates(Certificate[] certificates)

Sets the certificates of this KeyInfo object to certificates.

 void

setKey(com.rsa.jsafe.JSAFE_PublicKey publicKey)

Sets the public-key values of this KeyValue object.

 
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

KeyValue

public KeyValue()
Creates an empty KeyValue object.

KeyValue

public KeyValue(com.rsa.jsafe.JSAFE_PublicKey publicKey)
Creates a KeyValue object and initializes the key to publicKey.

Parameters

         publicKey  

A JSAFE_PublicKey object that contains the key to use.

Method Detail

getKeyInfoType

public int getKeyInfoType()
Returns an integer specifying the keyInfo type. For a KeyValue object, it is always KEYVALUE_KEYINFO.

Overrides

getKeyInfoType in class KeyInfo

Returns

The keyInfo type as an integer.

getKeyInfoName

public String getKeyInfoName()
Returns the keyInfo name as a String.

Overrides

getKeyInfoName in class KeyInfo

Returns

The keyInfo name of this KeyValue object as a String value.

generateKeyInfo

public 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. This element will be attached to the document.

Overrides

generateKeyInfo in class KeyInfo

Parameters

         document  

A DOM Document object that 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 the Base64-encoded data of the public key stored in this KeyInfo object.

Throws

XMLException - If an error occurs in generating the KeyInfo object as an Element.

parseKeyInfo

public void parseKeyInfo(org.w3c.dom.Element keyInfoNode,
                         String xmlNamespace)
                  throws XMLException
Parses the keyInfo element and sets the key with the retrieved data.

Overrides

parseKeyInfo in class KeyInfo

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.

setKey

public void setKey(com.rsa.jsafe.JSAFE_PublicKey publicKey)
Sets the public-key values of this KeyValue object.

Overrides

setKey in class KeyInfo

Parameters

         publicKey  

The public key used to validate the signature as a JSAFE_PublicKey object.


setCertificates

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

Do not call this method on a KeyValue object.

Overrides

setCertificates in class KeyInfo

Parameters

         certificates  

A list of Certificate objects.

Throws

XMLException - Always throws an XMLException, since a KeyValue does not store certificates.

getKey

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

Overrides

getKey in class KeyInfo

Returns

The key used to validate the signature, as a JSAFE_PublicKey.

hasCertificate

public boolean hasCertificate()
Returns a Boolean variable indicating whether this KeyValue contains certificates.

Overrides

hasCertificate in class KeyInfo

Returns

true if this KeyInfo object contains certificates; false otherwise. A KeyValue does not store certificates, so this method always returns false.

hasKey

public boolean hasKey()
Returns a Boolean variable indicating whether this KeyValue contains a public key.

Overrides

hasKey in class KeyInfo

Returns

For a KeyValue object, this method always returns true.

getCertificates

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

Overrides

getCertificates in class KeyInfo

Parameters

         certj  

A CertJ object to search for certificates.

Returns

For a KeyValue object, this method always returns null, because KeyValue does not store certificates.

clone

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

Returns

A new KeyValue 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