当前位置: 首页>>代码示例>>Java>>正文


Java DOMStructure类代码示例

本文整理汇总了Java中javax.xml.crypto.dom.DOMStructure的典型用法代码示例。如果您正苦于以下问题:Java DOMStructure类的具体用法?Java DOMStructure怎么用?Java DOMStructure使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DOMStructure类属于javax.xml.crypto.dom包,在下文中一共展示了DOMStructure类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: get

import javax.xml.crypto.dom.DOMStructure; //导入依赖的package包/类
@Override
public Output get(Input input) throws Exception {

    Transform transform = input.getSignatureFactory().newTransform(CanonicalizationMethod.INCLUSIVE, (TransformParameterSpec) null);
    Reference ref = input.getSignatureFactory().newReference("#propertiesObject",
            input.getSignatureFactory().newDigestMethod(input.getContentDigestAlgorithm(), null), Collections.singletonList(transform),
            null, null);

    String doc2 = "<ts:timestamp xmlns:ts=\"http:/timestamp\">" + System.currentTimeMillis() + "</ts:timestamp>";
    InputStream is = new ByteArrayInputStream(doc2.getBytes("UTF-8"));
    Document doc = XmlSignatureHelper.newDocumentBuilder(Boolean.TRUE).parse(is);
    DOMStructure structure = new DOMStructure(doc.getDocumentElement());

    SignatureProperty prop = input.getSignatureFactory().newSignatureProperty(Collections.singletonList(structure),
            input.getSignatureId(), "property");
    SignatureProperties properties = input.getSignatureFactory().newSignatureProperties(Collections.singletonList(prop), "properties");
    XMLObject propertiesObject = input.getSignatureFactory().newXMLObject(Collections.singletonList(properties), "propertiesObject",
            null, null);

    XmlSignatureProperties.Output result = new Output();
    result.setReferences(Collections.singletonList(ref));
    result.setObjects(Collections.singletonList(propertiesObject));

    return result;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:26,代码来源:TimestampProperty.java

示例2: marshalParams

import javax.xml.crypto.dom.DOMStructure; //导入依赖的package包/类
@Override
public void marshalParams(XMLStructure parent, XMLCryptoContext context) throws MarshalException {
	LOG.debug("marshallParams(parent,context)");
	DOMStructure domParent = (DOMStructure) parent;
	Node parentNode = domParent.getNode();
	Element parentElement = (Element) parentNode;
	parentElement.setAttributeNS(Constants.NamespaceSpecNS, "xmlns:mdssi",
			"http://schemas.openxmlformats.org/package/2006/digital-signature");
	Document document = parentNode.getOwnerDocument();
	for (String sourceId : this.sourceIds) {
		Element relationshipReferenceElement = document.createElementNS(
				"http://schemas.openxmlformats.org/package/2006/digital-signature", "mdssi:RelationshipReference");
		relationshipReferenceElement.setAttribute("SourceId", sourceId);
		parentElement.appendChild(relationshipReferenceElement);
	}
	for (String sourceType : this.sourceTypes) {
		Element relationshipsGroupReferenceElement = document.createElementNS(
				"http://schemas.openxmlformats.org/package/2006/digital-signature",
				"mdssi:RelationshipsGroupReference");
		relationshipsGroupReferenceElement.setAttribute("SourceType", sourceType);
		parentElement.appendChild(relationshipsGroupReferenceElement);
	}
}
 
开发者ID:e-Contract,项目名称:eid-applet,代码行数:24,代码来源:RelationshipTransformService.java

示例3: main

import javax.xml.crypto.dom.DOMStructure; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    KeyInfoFactory fac = KeyInfoFactory.getInstance();
    KeyInfo ki = fac.newKeyInfo
        (Collections.singletonList(fac.newKeyName("foo")), "keyid");
    try {
        ki.marshal(null, null);
        throw new Exception("Should raise a NullPointerException");
    } catch (NullPointerException npe) {}

    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    dbf.setNamespaceAware(true);
    Document doc = dbf.newDocumentBuilder().newDocument();
    Element elem = doc.createElementNS("http://acme.org", "parent");
    doc.appendChild(elem);
    DOMStructure parent = new DOMStructure(elem);
    ki.marshal(parent, null);

    Element kiElem = DOMUtils.getFirstChildElement(elem);
    if (!kiElem.getLocalName().equals("KeyInfo")) {
        throw new Exception
            ("Should be KeyInfo element: " + kiElem.getLocalName());
    }
    Element knElem = DOMUtils.getFirstChildElement(kiElem);
    if (!knElem.getLocalName().equals("KeyName")) {
        throw new Exception
            ("Should be KeyName element: " + knElem.getLocalName());
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:29,代码来源:Marshal.java

示例4: testSignTemplateWithObjectNSDefs

import javax.xml.crypto.dom.DOMStructure; //导入依赖的package包/类
@org.junit.Test
public void testSignTemplateWithObjectNSDefs() throws Exception {
    String base = System.getProperty("basedir") == null ? "./"
                  : System.getProperty("basedir");

    File f = new File(base + "/src/test/resources/javax/xml/crypto/dsig/" +
        "signature-enveloping-rsa-template.xml");

    Document doc = XMLUtils.createDocumentBuilder(false).parse(new FileInputStream(f));

    // Find Signature element
    NodeList nl =
        doc.getElementsByTagNameNS(XMLSignature.XMLNS, "Signature");
    if (nl.getLength() == 0) {
        throw new Exception("Cannot find Signature element");
    }
    DOMStructure domSignature = new DOMStructure(nl.item(0));
    // unmarshal the XMLSignature
    XMLSignature signature = fac.unmarshalXMLSignature(domSignature);

    // create copy of Signature
    XMLSignature newSignature = fac.newXMLSignature
        (signature.getSignedInfo(), null, signature.getObjects(),
         signature.getId(), signature.getSignatureValue().getId());

    // Sign the template
    Node parent = domSignature.getNode().getParentNode();
    DOMSignContext signContext = new DOMSignContext(SIGN_KEYS[0], parent);
    // remove the signature node (since it will get recreated)
    parent.removeChild(domSignature.getNode());
    newSignature.sign(signContext);
    TestUtils.validateSecurityOrEncryptionElement(parent.getLastChild());

    // check that Object element retained namespace definitions
    Element objElem = (Element)parent.getFirstChild().getLastChild();
    Attr a = objElem.getAttributeNode("xmlns:test");
    if (!a.getValue().equals("http://www.example.org/ns")) {
        throw new Exception("Object namespace definition not retained");
    }
}
 
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:41,代码来源:XMLSignatureTest.java

示例5: testCreateSignatureWithEmptyId

import javax.xml.crypto.dom.DOMStructure; //导入依赖的package包/类
@org.junit.Test
public void testCreateSignatureWithEmptyId() throws Exception {
    // create references
    DigestMethod dm = fac.newDigestMethod(DigestMethod.SHA1, null);
    List<Reference> refs = Collections.singletonList
        (fac.newReference("#", dm));

    // create SignedInfo
    CanonicalizationMethod cm = fac.newCanonicalizationMethod
        (CanonicalizationMethod.INCLUSIVE, (C14NMethodParameterSpec) null);
    SignedInfo si = fac.newSignedInfo(cm, SIG_METHODS[1], refs);

    // create object with empty id
    Document doc = TestUtils.newDocument();
    XMLObject obj = fac.newXMLObject(Collections.singletonList
        (new DOMStructure(doc.createTextNode("I am the text."))),
        "", "text/plain", null);

    KeyInfo	ki = kifac.newKeyInfo(Collections.singletonList
                (kifac.newKeyValue((PublicKey) VALIDATE_KEYS[1])));

    // create XMLSignature
    XMLSignature sig = fac.newXMLSignature(si, ki,
                                           Collections.singletonList(obj),
                                           "signature", null);
    DOMSignContext dsc = new DOMSignContext(SIGN_KEYS[1], doc);
    sig.sign(dsc);
}
 
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:29,代码来源:XMLSignatureTest.java

示例6: test_create_signature_enveloping

import javax.xml.crypto.dom.DOMStructure; //导入依赖的package包/类
private void test_create_signature_enveloping(
    SignatureMethod sm, DigestMethod dm, KeyInfo ki, Key signingKey, KeySelector ks
) throws Exception {

    // create reference
    Reference ref = fac.newReference("#DSig.Object_1", dm, null,
                                     XMLObject.TYPE, null);

    // create SignedInfo
    SignedInfo si = fac.newSignedInfo(withoutComments, sm,
                                      Collections.singletonList(ref));

    Document doc = db.newDocument();
    // create Objects
    Element webElem = doc.createElementNS(null, "Web");
    Text text = doc.createTextNode("up up and away");
    webElem.appendChild(text);
    XMLObject obj = fac.newXMLObject(Collections.singletonList
                                     (new DOMStructure(webElem)), "DSig.Object_1", "text/xml", null);

    // create XMLSignature
    XMLSignature sig = fac.newXMLSignature
    (si, ki, Collections.singletonList(obj), null, null);

    DOMSignContext dsc = new DOMSignContext(signingKey, doc);
    dsc.setDefaultNamespacePrefix("dsig");

    sig.sign(dsc);
    TestUtils.validateSecurityOrEncryptionElement(doc.getDocumentElement());

    // XMLUtils.outputDOM(doc.getDocumentElement(), System.out);

    DOMValidateContext dvc = new DOMValidateContext
    (ks, doc.getDocumentElement());
    XMLSignature sig2 = fac.unmarshalXMLSignature(dvc);

    assertTrue(sig.equals(sig2));
    assertTrue(sig2.validate(dvc));
}
 
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:40,代码来源:HMACSignatureAlgorithmTest.java

示例7: getNodeForMessageBodyInEnvelopingCase

import javax.xml.crypto.dom.DOMStructure; //导入依赖的package包/类
protected Node getNodeForMessageBodyInEnvelopingCase(Input input) throws Exception { //NOPMD
    Node node;
    List<Reference> relevantReferences = getReferencesForMessageMapping(input);

    List<XMLObject> relevantObjects = getObjectsForMessageMapping(input);

    DOMStructure domStruc = getDomStructureForMessageBody(relevantReferences, relevantObjects);
    node = domStruc.getNode();
    return node;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:11,代码来源:DefaultXmlSignature2Message.java

示例8: getDomStructureForMessageBody

import javax.xml.crypto.dom.DOMStructure; //导入依赖的package包/类
/**
 * Returns the DOM structure which is transformed to a byte array and set to
 * the camel message body.
 * 
 * @param relevantReferences
 *            input from method
 *            {@link #getReferencesForMessageMapping(ReferencesAndObjects)}
 * @param relevantObjects
 *            input from method
 *            {@link #getObjectsForMessageMapping(ReferencesAndObjects)}
 * @return dom structure
 * @throws Exception
 *             if an error occurs
 */
protected DOMStructure getDomStructureForMessageBody(List<Reference> relevantReferences, List<XMLObject> relevantObjects)
    throws Exception { //NOPMD

    List<XMLObject> referencedObjects = getReferencedSameDocumentObjects(relevantReferences, relevantObjects);

    if (referencedObjects.isEmpty()) {
        throw new XmlSignatureException(
                String.format("Unsupported XML signature document: Content object not found in the enveloping XML signature."));
    }

    if (referencedObjects.size() > 1) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < referencedObjects.size(); i++) {
            XMLObject xmlOb = referencedObjects.get(i);
            sb.append(xmlOb.getId());
            if (i < referencedObjects.size() - 1) {
                sb.append(", ");
            }
        }
        throw new XmlSignatureException(String.format(
                "Unsupported XML signature document: More than one content objects found. Object IDs: %s", sb.toString()));
    }

    @SuppressWarnings("unchecked")
    List<XMLStructure> structures = referencedObjects.get(0).getContent();
    if (structures.size() == 0) {
        throw new XmlSignatureException(
                "Unsupported XML signature: XML signature is not enveloping; content not found in XML signature: structure list is empty.");
    }
    if (structures.size() > 1) {
        throw new XmlSignatureException("Unsupported XML signature: more than one structure elements in referenced content object.");
    }
    XMLStructure structure = structures.get(0);
    // only dom currently supported
    DOMStructure domStruc = (DOMStructure) structure;
    return domStruc;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:52,代码来源:DefaultXmlSignature2Message.java

示例9: getXslTranform

import javax.xml.crypto.dom.DOMStructure; //导入依赖的package包/类
/**
 * Returns a configuration for an XSL transformation.
 * 
 * @param is
 *            input stream of the XSL
 * @return XSL transform
 * @throws IllegalArgumentException
 *             if <tt>is</tt> is <code>null</code>
 * @throws Exception
 *             if an error during the reading of the XSL file occurs
 */
public static AlgorithmMethod getXslTranform(InputStream is) throws SAXException, IOException, ParserConfigurationException {
    if (is == null) {
        throw new IllegalArgumentException("is must not be null");
    }
    Document doc = parseInput(is);
    DOMStructure stylesheet = new DOMStructure(doc.getDocumentElement());
    XSLTTransformParameterSpec spec = new XSLTTransformParameterSpec(stylesheet);
    XmlSignatureTransform transformXslt = new XmlSignatureTransform();
    transformXslt.setAlgorithm(Transform.XSLT);
    transformXslt.setParameterSpec(spec);
    return transformXslt;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:24,代码来源:XmlSignatureHelper.java

示例10: preSign

import javax.xml.crypto.dom.DOMStructure; //导入依赖的package包/类
public void preSign(XMLSignatureFactory signatureFactory, Document document, String signatureId,
		List<X509Certificate> signingCertificateChain, List<Reference> references, List<XMLObject> objects)
				throws NoSuchAlgorithmException, InvalidAlgorithmParameterException {
	LOG.debug("pre sign");

	Element dateElement = document.createElementNS("", "dc:date");
	dateElement.setAttributeNS(Constants.NamespaceSpecNS, "xmlns:dc", "http://purl.org/dc/elements/1.1/");
	DateTime dateTime = new DateTime(DateTimeZone.UTC);
	DateTimeFormatter fmt = ISODateTimeFormat.dateTimeNoMillis();
	String now = fmt.print(dateTime);
	now = now.substring(0, now.indexOf("Z"));
	LOG.debug("now: " + now);
	dateElement.setTextContent(now);

	String signaturePropertyId = "sign-prop-" + UUID.randomUUID().toString();
	List<XMLStructure> signaturePropertyContent = new LinkedList<XMLStructure>();
	signaturePropertyContent.add(new DOMStructure(dateElement));
	SignatureProperty signatureProperty = signatureFactory.newSignatureProperty(signaturePropertyContent,
			"#" + signatureId, signaturePropertyId);

	List<XMLStructure> objectContent = new LinkedList<XMLStructure>();
	List<SignatureProperty> signaturePropertiesContent = new LinkedList<SignatureProperty>();
	signaturePropertiesContent.add(signatureProperty);
	SignatureProperties signatureProperties = signatureFactory.newSignatureProperties(signaturePropertiesContent,
			null);
	objectContent.add(signatureProperties);

	objects.add(signatureFactory.newXMLObject(objectContent, null, null, null));

	DigestMethod digestMethod = signatureFactory.newDigestMethod(this.digestAlgo.getXmlAlgoId(), null);
	Reference reference = signatureFactory.newReference("#" + signaturePropertyId, digestMethod);
	references.add(reference);
}
 
开发者ID:e-Contract,项目名称:eid-applet,代码行数:34,代码来源:OpenOfficeSignatureFacet.java

示例11: addSignatureTime

import javax.xml.crypto.dom.DOMStructure; //导入依赖的package包/类
private void addSignatureTime(XMLSignatureFactory signatureFactory, Document document, String signatureId,
		List<XMLStructure> objectContent) {
	/*
	 * SignatureTime
	 */
	Element signatureTimeElement = document.createElementNS(OOXML_DIGSIG_NS, "mdssi:SignatureTime");
	signatureTimeElement.setAttributeNS(Constants.NamespaceSpecNS, "xmlns:mdssi", OOXML_DIGSIG_NS);
	Element formatElement = document.createElementNS(OOXML_DIGSIG_NS, "mdssi:Format");
	formatElement.setTextContent("YYYY-MM-DDThh:mm:ssTZD");
	signatureTimeElement.appendChild(formatElement);
	Element valueElement = document.createElementNS(OOXML_DIGSIG_NS, "mdssi:Value");
	Date now = this.clock.getTime();
	DateTime dateTime = new DateTime(now.getTime(), DateTimeZone.UTC);
	DateTimeFormatter fmt = ISODateTimeFormat.dateTimeNoMillis();
	String nowStr = fmt.print(dateTime);
	LOG.debug("now: " + nowStr);
	valueElement.setTextContent(nowStr);
	signatureTimeElement.appendChild(valueElement);

	List<XMLStructure> signatureTimeContent = new LinkedList<XMLStructure>();
	signatureTimeContent.add(new DOMStructure(signatureTimeElement));
	SignatureProperty signatureTimeSignatureProperty = signatureFactory.newSignatureProperty(signatureTimeContent,
			"#" + signatureId, "idSignatureTime");
	List<SignatureProperty> signaturePropertyContent = new LinkedList<SignatureProperty>();
	signaturePropertyContent.add(signatureTimeSignatureProperty);
	SignatureProperties signatureProperties = signatureFactory.newSignatureProperties(signaturePropertyContent,
			"id-signature-time-" + UUID.randomUUID().toString());
	objectContent.add(signatureProperties);
}
 
开发者ID:e-Contract,项目名称:eid-applet,代码行数:30,代码来源:OOXMLSignatureFacet.java

示例12: addSignatureInfo

import javax.xml.crypto.dom.DOMStructure; //导入依赖的package包/类
private void addSignatureInfo(XMLSignatureFactory signatureFactory, Document document, String signatureId,
		List<Reference> references, List<XMLObject> objects)
				throws NoSuchAlgorithmException, InvalidAlgorithmParameterException {
	List<XMLStructure> objectContent = new LinkedList<XMLStructure>();

	Element signatureInfoElement = document.createElementNS(OFFICE_DIGSIG_NS, "SignatureInfoV1");
	signatureInfoElement.setAttributeNS(Constants.NamespaceSpecNS, "xmlns", OFFICE_DIGSIG_NS);

	Element manifestHashAlgorithmElement = document.createElementNS(OFFICE_DIGSIG_NS, "ManifestHashAlgorithm");
	manifestHashAlgorithmElement.setTextContent("http://www.w3.org/2000/09/xmldsig#sha1");
	signatureInfoElement.appendChild(manifestHashAlgorithmElement);

	List<XMLStructure> signatureInfoContent = new LinkedList<XMLStructure>();
	signatureInfoContent.add(new DOMStructure(signatureInfoElement));
	SignatureProperty signatureInfoSignatureProperty = signatureFactory.newSignatureProperty(signatureInfoContent,
			"#" + signatureId, "idOfficeV1Details");

	List<SignatureProperty> signaturePropertyContent = new LinkedList<SignatureProperty>();
	signaturePropertyContent.add(signatureInfoSignatureProperty);
	SignatureProperties signatureProperties = signatureFactory.newSignatureProperties(signaturePropertyContent,
			null);
	objectContent.add(signatureProperties);

	String objectId = "idOfficeObject";
	objects.add(signatureFactory.newXMLObject(objectContent, objectId, null, null));

	DigestMethod digestMethod = signatureFactory.newDigestMethod(this.digestAlgo.getXmlAlgoId(), null);
	Reference reference = signatureFactory.newReference("#" + objectId, digestMethod, null,
			"http://www.w3.org/2000/09/xmldsig#Object", null);
	references.add(reference);
}
 
开发者ID:e-Contract,项目名称:eid-applet,代码行数:32,代码来源:OOXMLSignatureFacet.java

示例13: marshalParams

import javax.xml.crypto.dom.DOMStructure; //导入依赖的package包/类
@Override
public void marshalParams(XMLStructure parent, XMLCryptoContext context) throws MarshalException {
	super.marshalParams(parent, context);
	
	Node node = ((DOMStructure) parent).getNode();
	Document doc = node.getOwnerDocument();
	Element tp = XMLHelper.constructElement(doc, WSSecurityConstants.WSSE_NS, "TransformationParameters", WSSecurityConstants.WSSE_PREFIX);
	Element cm = XMLHelper.constructElement(doc, XMLSignature.XMLNS, "CanonicalizationMethod", "ds");
	tp.appendChild(cm);
	cm.setAttributeNS(null, "Algorithm", "http://www.w3.org/2001/10/xml-exc-c14n#");
	node.appendChild(tp);
	
	log.debug("Marshall: " + XMLHelper.nodeToString(node));
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:15,代码来源:DOMSTRTransform.java

示例14: sign

import javax.xml.crypto.dom.DOMStructure; //导入依赖的package包/类
private static void sign(Document document, DigitalSignatureServiceSession session) throws NoSuchAlgorithmException,
		InvalidAlgorithmParameterException, MarshalException, XMLSignatureException {
	Key key = new SecretKeySpec(session.getKey(), "HMACSHA1");
	Node parentElement = document.getElementsByTagNameNS("urn:oasis:names:tc:dss:1.0:core:schema", "OptionalInputs")
			.item(0);
	DOMSignContext domSignContext = new DOMSignContext(key, parentElement);
	domSignContext.setDefaultNamespacePrefix("ds");
	// XMLDSigRI Websphere work-around
	XMLSignatureFactory xmlSignatureFactory = XMLSignatureFactory.getInstance("DOM", new XMLDSigRI());

	List<Transform> transforms = new LinkedList<Transform>();
	transforms.add(xmlSignatureFactory.newTransform(Transform.ENVELOPED, (TransformParameterSpec) null));
	transforms.add(
			xmlSignatureFactory.newTransform(CanonicalizationMethod.EXCLUSIVE, (C14NMethodParameterSpec) null));
	Reference reference = xmlSignatureFactory.newReference("",
			xmlSignatureFactory.newDigestMethod(DigestMethod.SHA1, null), transforms, null, null);

	SignedInfo signedInfo = xmlSignatureFactory.newSignedInfo(
			xmlSignatureFactory.newCanonicalizationMethod(CanonicalizationMethod.EXCLUSIVE,
					(C14NMethodParameterSpec) null),
			xmlSignatureFactory.newSignatureMethod(SignatureMethod.HMAC_SHA1, null),
			Collections.singletonList(reference));

	Element securityTokenReferenceElement = getSecurityTokenReference(session);

	KeyInfoFactory keyInfoFactory = xmlSignatureFactory.getKeyInfoFactory();
	DOMStructure securityTokenReferenceDOMStructure = new DOMStructure(securityTokenReferenceElement);
	KeyInfo keyInfo = keyInfoFactory.newKeyInfo(Collections.singletonList(securityTokenReferenceDOMStructure));

	XMLSignature xmlSignature = xmlSignatureFactory.newXMLSignature(signedInfo, keyInfo);
	xmlSignature.sign(domSignContext);
}
 
开发者ID:e-Contract,项目名称:dssp,代码行数:33,代码来源:PendingRequestFactory.java

示例15: getSigningCertificate

import javax.xml.crypto.dom.DOMStructure; //导入依赖的package包/类
/**
 * Retorna o XML que contem SigningCertificate, que eh uma das propriedades assinadas obrigatorias da ICP-BRASIL. 
 * contem cert = conforme DOC-ICP-04; CertDigest: /DigestMethod e /DigestValue; IssuerSerial: /X509IssuerName e /X509SerialNumber   
 * @param ix indica de qual a assinatura.
 * @return org.w3c.NodeList contendo SigningCertificate ou nulo
 * @throws Exception
 */

public NodeList getSigningCertificate(int ix) throws Exception{
	
	
	NodeList nodeSigningCertificate = null;
	if (this.getAssinaturas().isEmpty()){
		return null;
	}
	if (!this.getAssinaturas().get(ix).getObjects().isEmpty()){
       	DOMXMLObject objDX = null;
       	Iterator<?> it = this.getAssinaturas().get(ix).getObjects().iterator();
        while (it.hasNext()) {
        	Object ob1 = it.next();
	       	if (ob1 instanceof DOMXMLObject){
        		objDX = (DOMXMLObject) ob1;
        		for (int i=0; i < objDX.getContent().size();i++){
        			DOMStructure Dos = (DOMStructure) objDX.getContent().get(i);	
        			if (Dos.getNode().getLocalName() ==	"QualifyingProperties"){        				
        				Element el = (Element) Dos.getNode();
        				nodeSigningCertificate = el.getElementsByTagName("SigningCertificate");
        				break;
        			}
        		}
        		// se a lista estiver vazia retornar� nulo
        		if (nodeSigningCertificate.getLength() < 1){
        			nodeSigningCertificate = null;
        		}	        		
        	}
        }
	}
	return nodeSigningCertificate;
}
 
开发者ID:esaito,项目名称:ExemplosDemoiselle,代码行数:40,代码来源:TabeliaoAssinaturaEnvelopingXML.java


注:本文中的javax.xml.crypto.dom.DOMStructure类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。