FileDocCategorySizeDatePackage
DSAKeyValueResolver.javaAPI DocJava SE 6 API3702Tue Jun 10 00:23:02 BST 2008com.sun.org.apache.xml.internal.security.keys.keyresolver.implementations

DSAKeyValueResolver

public class DSAKeyValueResolver extends KeyResolverSpi
author
$Author: raul $

Fields Summary
private Element
_dsaKeyElement
Field _dsaKeyElement
Constructors Summary
Methods Summary
public booleanengineCanResolve(org.w3c.dom.Element element, java.lang.String BaseURI, com.sun.org.apache.xml.internal.security.keys.storage.StorageResolver storage)

inheritDoc


     
        
                                     

      if (element == null) {
         return false;
      }

      boolean isKeyValue = XMLUtils.elementIsInSignatureSpace(element,
                              Constants._TAG_KEYVALUE);
      boolean isDSAKeyValue = XMLUtils.elementIsInSignatureSpace(element,
                                 Constants._TAG_DSAKEYVALUE);

      if (isKeyValue) {         
     
            this._dsaKeyElement =
            	XMLUtils.selectDsNode(element.getFirstChild(),Constants._TAG_DSAKEYVALUE,0);                    

            if (this._dsaKeyElement != null) {
               return true;
            }         
      } else if (isDSAKeyValue) {

         // this trick is needed to allow the RetrievalMethodResolver to eat a
         // ds:DSAKeyValue directly (without KeyValue)
         this._dsaKeyElement = element;

         return true;
      }

      return false;
   
public java.security.PublicKeyengineResolvePublicKey(org.w3c.dom.Element element, java.lang.String BaseURI, com.sun.org.apache.xml.internal.security.keys.storage.StorageResolver storage)
Method engineResolvePublicKey

param
element
param
BaseURI
param
storage
return
null if no {@link PublicKey} could be obtained


      if (this._dsaKeyElement == null) {
         boolean weCanResolve = this.engineCanResolve(element, BaseURI,
                                   storage);

         if (!weCanResolve || (this._dsaKeyElement == null)) {
            return null;
         }
      }

      try {
         DSAKeyValue dsaKeyValue = new DSAKeyValue(this._dsaKeyElement,
                                                   BaseURI);
         PublicKey pk = dsaKeyValue.getPublicKey();

         return pk;
      } catch (XMLSecurityException ex) {
		//do nothing
      }

      return null;
   
public javax.crypto.SecretKeyengineResolveSecretKey(org.w3c.dom.Element element, java.lang.String BaseURI, com.sun.org.apache.xml.internal.security.keys.storage.StorageResolver storage)

inheritDoc

      return null;
   
public java.security.cert.X509CertificateengineResolveX509Certificate(org.w3c.dom.Element element, java.lang.String BaseURI, com.sun.org.apache.xml.internal.security.keys.storage.StorageResolver storage)

inheritDoc

      return null;