FileDocCategorySizeDatePackage
KeyValue.javaAPI DocJava SE 6 API4993Tue Jun 10 00:23:02 BST 2008com.sun.org.apache.xml.internal.security.keys.content

KeyValue

public class KeyValue extends SignatureElementProxy implements KeyInfoContent
The KeyValue element contains a single public key that may be useful in validating the signature. Structured formats for defining DSA (REQUIRED) and RSA (RECOMMENDED) public keys are defined in Signature Algorithms (section 6.4). The KeyValue element may include externally defined public keys values represented as PCDATA or element types from an external namespace.
author
$Author: vishal $

Fields Summary
static Logger
log
{@link java.util.logging} logging facility
Constructors Summary
public KeyValue(Document doc, DSAKeyValue dsaKeyValue)
Constructor KeyValue

param
doc
param
dsaKeyValue


             
        

      super(doc);

      XMLUtils.addReturnToElement(this._constructionElement);
      this._constructionElement.appendChild(dsaKeyValue.getElement());
      XMLUtils.addReturnToElement(this._constructionElement);
   
public KeyValue(Document doc, RSAKeyValue rsaKeyValue)
Constructor KeyValue

param
doc
param
rsaKeyValue


      super(doc);

      XMLUtils.addReturnToElement(this._constructionElement);
      this._constructionElement.appendChild(rsaKeyValue.getElement());
      XMLUtils.addReturnToElement(this._constructionElement);
   
public KeyValue(Document doc, Element unknownKeyValue)
Constructor KeyValue

param
doc
param
unknownKeyValue


      super(doc);

      XMLUtils.addReturnToElement(this._constructionElement);
      this._constructionElement.appendChild(unknownKeyValue);
      XMLUtils.addReturnToElement(this._constructionElement);
   
public KeyValue(Document doc, PublicKey pk)
Constructor KeyValue

param
doc
param
pk


      super(doc);

      XMLUtils.addReturnToElement(this._constructionElement);

      if (pk instanceof java.security.interfaces.DSAPublicKey) {
         DSAKeyValue dsa = new DSAKeyValue(this._doc, pk);

         this._constructionElement.appendChild(dsa.getElement());
         XMLUtils.addReturnToElement(this._constructionElement);
      } else if (pk instanceof java.security.interfaces.RSAPublicKey) {
         RSAKeyValue rsa = new RSAKeyValue(this._doc, pk);

         this._constructionElement.appendChild(rsa.getElement());
         XMLUtils.addReturnToElement(this._constructionElement);
      }
   
public KeyValue(Element element, String BaseURI)
Constructor KeyValue

param
element
param
BaseURI
throws
XMLSecurityException

      super(element, BaseURI);
   
Methods Summary
public java.lang.StringgetBaseLocalName()

inheritDoc

      return Constants._TAG_KEYVALUE;
   
public java.security.PublicKeygetPublicKey()
Method getPublicKey

return
the public key
throws
XMLSecurityException


      
         Element rsa = XMLUtils.selectDsNode(this._constructionElement.getFirstChild(),
         				Constants._TAG_RSAKEYVALUE,0);
         
         if (rsa != null) {
            RSAKeyValue kv = new RSAKeyValue(rsa,
                                             this._baseURI);

            return kv.getPublicKey();
         }

         Element dsa = XMLUtils.selectDsNode(this._constructionElement,
         		 Constants._TAG_DSAKEYVALUE,0);
            

         if (dsa != null) {
            DSAKeyValue kv = new DSAKeyValue(dsa,
                                             this._baseURI);

            return kv.getPublicKey();
         }
      

      return null;