Search in sources :

Example 1 with Canonicalizer20010315

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

the class Canonicalizer20010315ExclusiveTest method test222.

/**
 * Method test222
 *
 * @throws CanonicalizationException
 * @throws FileNotFoundException
 * @throws IOException
 * @throws InvalidCanonicalizerException
 * @throws ParserConfigurationException
 * @throws SAXException
 * @throws TransformerException
 * @throws XMLSecurityException
 * @throws XMLSignatureException
 */
@org.junit.Test
public void test222() 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_2.xml"));
    Node root = doc.getElementsByTagNameNS("http://example.net", "elem2").item(0);
    Canonicalizer20010315 c = new Canonicalizer20010315WithComments();
    byte[] reference = JavaUtils.getBytesFromFile(getAbsolutePath("src/test/resources/org/apache/xml/security/c14n/inExcl/example2_2_2_c14nized.xml"));
    byte[] result = c.engineCanonicalizeSubTree(root);
    boolean equals = java.security.MessageDigest.isEqual(reference, result);
    assertTrue(equals);
}
Also used : Node(org.w3c.dom.Node) Canonicalizer20010315(org.apache.xml.security.c14n.implementations.Canonicalizer20010315) Document(org.w3c.dom.Document) Canonicalizer20010315WithComments(org.apache.xml.security.c14n.implementations.Canonicalizer20010315WithComments)

Example 2 with Canonicalizer20010315

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

the class Canonicalizer20010315ExclusiveTest method test221.

/**
 * Method test221
 *
 * @throws CanonicalizationException
 * @throws FileNotFoundException
 * @throws IOException
 * @throws InvalidCanonicalizerException
 * @throws ParserConfigurationException
 * @throws SAXException
 * @throws TransformerException
 * @throws XMLSecurityException
 * @throws XMLSignatureException
 */
@org.junit.Test
public void test221() 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);
    Canonicalizer20010315 c = new Canonicalizer20010315WithComments();
    byte[] reference = JavaUtils.getBytesFromFile(getAbsolutePath("src/test/resources/org/apache/xml/security/c14n/inExcl/example2_2_1_c14nized.xml"));
    byte[] result = c.engineCanonicalizeSubTree(root);
    boolean equals = java.security.MessageDigest.isEqual(reference, result);
    assertTrue(equals);
}
Also used : Node(org.w3c.dom.Node) Canonicalizer20010315(org.apache.xml.security.c14n.implementations.Canonicalizer20010315) Document(org.w3c.dom.Document) Canonicalizer20010315WithComments(org.apache.xml.security.c14n.implementations.Canonicalizer20010315WithComments)

Aggregations

Canonicalizer20010315 (org.apache.xml.security.c14n.implementations.Canonicalizer20010315)2 Canonicalizer20010315WithComments (org.apache.xml.security.c14n.implementations.Canonicalizer20010315WithComments)2 Document (org.w3c.dom.Document)2 Node (org.w3c.dom.Node)2