Search in sources :

Example 6 with Canonicalizer20010315Excl

use of org.apache.xml.security.c14n.implementations.Canonicalizer20010315Excl in project santuario-java by apache.

the class Canonicalizer20010315ExclusiveTest method test221excl.

/**
 * Method test221excl
 *
 * @throws CanonicalizationException
 * @throws FileNotFoundException
 * @throws IOException
 * @throws InvalidCanonicalizerException
 * @throws ParserConfigurationException
 * @throws SAXException
 * @throws TransformerException
 * @throws XMLSecurityException
 * @throws XMLSignatureException
 */
@org.junit.Test
public void test221excl() throws IOException, FileNotFoundException, SAXException, ParserConfigurationException, CanonicalizationException, InvalidCanonicalizerException, TransformerException, XMLSignatureException, XMLSecurityException {
    Document doc = this.db.parse(getAbsolutePath("src/test/resources/org/apache/xml/security/c14n/inExcl/example2_2_1.xml"));
    Node root = doc.getElementsByTagNameNS("http://example.net", "elem2").item(0);
    Canonicalizer20010315Excl c = new Canonicalizer20010315ExclWithComments();
    byte[] reference = JavaUtils.getBytesFromFile(getAbsolutePath("src/test/resources/org/apache/xml/security/c14n/inExcl/example2_2_c14nized_exclusive.xml"));
    byte[] result = c.engineCanonicalizeSubTree(root);
    boolean equals = java.security.MessageDigest.isEqual(reference, result);
    assertTrue(equals);
}
Also used : Canonicalizer20010315Excl(org.apache.xml.security.c14n.implementations.Canonicalizer20010315Excl) Canonicalizer20010315ExclWithComments(org.apache.xml.security.c14n.implementations.Canonicalizer20010315ExclWithComments) Node(org.w3c.dom.Node) Document(org.w3c.dom.Document)

Aggregations

Canonicalizer20010315Excl (org.apache.xml.security.c14n.implementations.Canonicalizer20010315Excl)6 Document (org.w3c.dom.Document)6 Canonicalizer20010315ExclWithComments (org.apache.xml.security.c14n.implementations.Canonicalizer20010315ExclWithComments)5 Node (org.w3c.dom.Node)4 ByteArrayInputStream (java.io.ByteArrayInputStream)1 InputStream (java.io.InputStream)1 DocumentBuilder (javax.xml.parsers.DocumentBuilder)1 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)1 XPath (javax.xml.xpath.XPath)1 XPathFactory (javax.xml.xpath.XPathFactory)1 Canonicalizer20010315ExclOmitComments (org.apache.xml.security.c14n.implementations.Canonicalizer20010315ExclOmitComments)1 DSNamespaceContext (org.apache.xml.security.test.dom.DSNamespaceContext)1 Element (org.w3c.dom.Element)1 NodeList (org.w3c.dom.NodeList)1