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;
}
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);
}
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);
}
Aggregations