1 17 package com.sun.org.apache.xml.internal.security.keys.content; 18 19 20 21 22 import com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException; 23 import com.sun.org.apache.xml.internal.security.signature.XMLSignatureException; 24 import com.sun.org.apache.xml.internal.security.transforms.Transforms; 25 import com.sun.org.apache.xml.internal.security.utils.Constants; 26 import com.sun.org.apache.xml.internal.security.utils.SignatureElementProxy; 27 import com.sun.org.apache.xml.internal.security.utils.XMLUtils; 28 import org.w3c.dom.Attr ; 29 import org.w3c.dom.Document ; 30 import org.w3c.dom.Element ; 31 32 33 37 public class RetrievalMethod extends SignatureElementProxy 38 implements KeyInfoContent { 39 40 41 static java.util.logging.Logger log = 42 java.util.logging.Logger.getLogger(RetrievalMethod.class.getName()); 43 45 public static final String TYPE_DSA = Constants.SignatureSpecNS + "DSAKeyValue"; 46 47 public static final String TYPE_RSA = Constants.SignatureSpecNS + "RSAKeyValue"; 48 49 public static final String TYPE_PGP = Constants.SignatureSpecNS + "PGPData"; 50 51 public static final String TYPE_SPKI = Constants.SignatureSpecNS + "SPKIData"; 52 53 public static final String TYPE_MGMT = Constants.SignatureSpecNS + "MgmtData"; 54 55 public static final String TYPE_X509 = Constants.SignatureSpecNS + "X509Data"; 56 57 public static final String TYPE_RAWX509 = Constants.SignatureSpecNS + "rawX509Certificate"; 58 60 67 public RetrievalMethod(Element element, String BaseURI) 68 throws XMLSecurityException { 69 super(element, BaseURI); 70 } 71 72 80 public RetrievalMethod(Document doc, String URI, Transforms transforms, 81 String Type) { 82 83 super(doc); 84 85 this._constructionElement.setAttributeNS(null, Constants._ATT_URI, URI); 86 87 if (Type != null) { 88 this._constructionElement.setAttributeNS(null, Constants._ATT_TYPE, Type); 89 } 90 91 if (transforms != null) { 92 this._constructionElement.appendChild(transforms.getElement()); 93 XMLUtils.addReturnToElement(this._constructionElement); 94 } 95 } 96 97 102 public Attr getURIAttr() { 103 return this._constructionElement.getAttributeNodeNS(null, Constants._ATT_URI); 104 } 105 106 112 public String getURI() { 113 return this.getURIAttr().getNodeValue(); 114 } 115 116 117 public String getType() { 118 return this._constructionElement.getAttributeNS(null, Constants._ATT_TYPE); 119 } 120 121 128 public Transforms getTransforms() throws XMLSecurityException { 129 130 try { 131 Element transformsElem = 132 XMLUtils.selectDsNode(this._constructionElement, 133 Constants 134 ._TAG_TRANSFORMS, 0); 135 136 if (transformsElem != null) { 137 return new Transforms(transformsElem, this._baseURI); 138 } 139 140 return null; 141 } catch (XMLSignatureException ex) { 142 throw new XMLSecurityException("empty", ex); 143 } 144 } 145 146 147 public String getBaseLocalName() { 148 return Constants._TAG_RETRIEVALMETHOD; 149 } 150 } 151 | Popular Tags |