Search in sources :

Example 1 with Canonicalizer20010315WithComments

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

the class TransformC14NWithComments method enginePerformTransform.

/**
 * {@inheritDoc}
 */
protected XMLSignatureInput enginePerformTransform(XMLSignatureInput input, OutputStream os, Transform transformObject) throws CanonicalizationException {
    Canonicalizer20010315WithComments c14n = new Canonicalizer20010315WithComments();
    c14n.setSecureValidation(secureValidation);
    if (os != null) {
        c14n.setWriter(os);
    }
    byte[] result = null;
    result = c14n.engineCanonicalize(input);
    XMLSignatureInput output = new XMLSignatureInput(result);
    output.setSecureValidation(secureValidation);
    if (os != null) {
        output.setOutputStream(os);
    }
    return output;
}
Also used : XMLSignatureInput(org.apache.xml.security.signature.XMLSignatureInput) Canonicalizer20010315WithComments(org.apache.xml.security.c14n.implementations.Canonicalizer20010315WithComments)

Example 2 with Canonicalizer20010315WithComments

use of org.apache.xml.security.c14n.implementations.Canonicalizer20010315WithComments 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 3 with Canonicalizer20010315WithComments

use of org.apache.xml.security.c14n.implementations.Canonicalizer20010315WithComments 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

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