0N/A/*
553N/A * reserved comment block
0N/A * DO NOT REMOVE OR ALTER!
0N/A */
0N/A/*
0N/A * Copyright 1999-2004 The Apache Software Foundation.
553N/A *
0N/A * Licensed under the Apache License, Version 2.0 (the "License");
553N/A * you may not use this file except in compliance with the License.
0N/A * You may obtain a copy of the License at
0N/A *
0N/A * http://www.apache.org/licenses/LICENSE-2.0
0N/A *
0N/A * Unless required by applicable law or agreed to in writing, software
0N/A * distributed under the License is distributed on an "AS IS" BASIS,
0N/A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0N/A * See the License for the specific language governing permissions and
0N/A * limitations under the License.
0N/A *
0N/A */
553N/Apackage com.sun.org.apache.xml.internal.security.keys.content;
553N/A
553N/Aimport com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException;
0N/Aimport com.sun.org.apache.xml.internal.security.signature.XMLSignatureException;
0N/Aimport com.sun.org.apache.xml.internal.security.transforms.Transforms;
0N/Aimport com.sun.org.apache.xml.internal.security.utils.Constants;
0N/Aimport com.sun.org.apache.xml.internal.security.utils.SignatureElementProxy;
0N/Aimport com.sun.org.apache.xml.internal.security.utils.XMLUtils;
0N/Aimport org.w3c.dom.Attr;
0N/Aimport org.w3c.dom.Document;
0N/Aimport org.w3c.dom.Element;
0N/A
0N/A/**
0N/A *
0N/A * @author $Author: mullan $
0N/A */
0N/Apublic class RetrievalMethod extends SignatureElementProxy
0N/A implements KeyInfoContent {
0N/A
0N/A //J-
0N/A /** DSA retrieval */
0N/A public static final String TYPE_DSA = Constants.SignatureSpecNS + "DSAKeyValue";
0N/A /** RSA retrieval */
0N/A public static final String TYPE_RSA = Constants.SignatureSpecNS + "RSAKeyValue";
0N/A /** PGP retrieval */
0N/A public static final String TYPE_PGP = Constants.SignatureSpecNS + "PGPData";
0N/A /** SPKI retrieval */
0N/A public static final String TYPE_SPKI = Constants.SignatureSpecNS + "SPKIData";
0N/A /** MGMT retrieval */
0N/A public static final String TYPE_MGMT = Constants.SignatureSpecNS + "MgmtData";
0N/A /** X509 retrieval */
0N/A public static final String TYPE_X509 = Constants.SignatureSpecNS + "X509Data";
0N/A /** RAWX509 retrieval */
0N/A public static final String TYPE_RAWX509 = Constants.SignatureSpecNS + "rawX509Certificate";
0N/A //J+
0N/A
0N/A /**
0N/A * Constructor RetrievalMethod
0N/A *
0N/A * @param element
0N/A * @param BaseURI
0N/A * @throws XMLSecurityException
0N/A */
0N/A public RetrievalMethod(Element element, String BaseURI)
0N/A throws XMLSecurityException {
0N/A super(element, BaseURI);
0N/A }
0N/A
0N/A /**
0N/A * Constructor RetrievalMethod
0N/A *
0N/A * @param doc
0N/A * @param URI
0N/A * @param transforms
0N/A * @param Type
0N/A */
0N/A public RetrievalMethod(Document doc, String URI, Transforms transforms,
0N/A String Type) {
0N/A
0N/A super(doc);
0N/A
0N/A this._constructionElement.setAttributeNS(null, Constants._ATT_URI, URI);
0N/A
0N/A if (Type != null) {
0N/A this._constructionElement.setAttributeNS(null, Constants._ATT_TYPE, Type);
0N/A }
0N/A
0N/A if (transforms != null) {
0N/A this._constructionElement.appendChild(transforms.getElement());
0N/A XMLUtils.addReturnToElement(this._constructionElement);
0N/A }
0N/A }
0N/A
0N/A /**
0N/A * Method getURIAttr
0N/A *
0N/A * @return the URI attribute
0N/A */
0N/A public Attr getURIAttr() {
0N/A return this._constructionElement.getAttributeNodeNS(null, Constants._ATT_URI);
0N/A }
0N/A
0N/A /**
0N/A * Method getURI
0N/A *
0N/A *
0N/A * @return URI string
0N/A */
0N/A public String getURI() {
0N/A return this.getURIAttr().getNodeValue();
0N/A }
0N/A
0N/A /** @return the type*/
0N/A public String getType() {
0N/A return this._constructionElement.getAttributeNS(null, Constants._ATT_TYPE);
0N/A }
0N/A
0N/A /**
0N/A * Method getTransforms
0N/A *
0N/A *
0N/A * @throws XMLSecurityException
0N/A * @return the transforamitons
0N/A */
0N/A public Transforms getTransforms() throws XMLSecurityException {
0N/A
0N/A try {
0N/A Element transformsElem =
0N/A XMLUtils.selectDsNode(this._constructionElement.getFirstChild(),
Constants
._TAG_TRANSFORMS, 0);
if (transformsElem != null) {
return new Transforms(transformsElem, this._baseURI);
}
return null;
} catch (XMLSignatureException ex) {
throw new XMLSecurityException("empty", ex);
}
}
/** @inheritDoc */
public String getBaseLocalName() {
return Constants._TAG_RETRIEVALMETHOD;
}
}