You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by co...@apache.org on 2015/12/15 18:13:22 UTC
svn commit: r1720201 [15/24] - in /santuario/xml-security-java/trunk:
samples/javax/xml/crypto/dsig/samples/
samples/org/apache/xml/security/samples/
samples/org/apache/xml/security/samples/algorithms/
samples/org/apache/xml/security/samples/canonicali...
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Canonicalizer20010315Test.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Canonicalizer20010315Test.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Canonicalizer20010315Test.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Canonicalizer20010315Test.java Tue Dec 15 17:13:17 2015
@@ -56,7 +56,7 @@ import org.xml.sax.SAXException;
/**
- * Unit test for
+ * Unit test for
* {@link org.apache.xml.security.c14n.implementations.Canonicalizer20010315WithXPath}
*
* @author Christian Geuer-Pollmann
@@ -69,10 +69,10 @@ public class Canonicalizer20010315Test e
static {
org.apache.xml.security.Init.init();
}
-
+
/** Field prefix */
private String prefix;
-
+
public Canonicalizer20010315Test() {
prefix = "src/test/resources/org/apache/xml/security/c14n/";
String basedir = System.getProperty("basedir");
@@ -91,7 +91,7 @@ public class Canonicalizer20010315Test e
* @throws ParserConfigurationException
* @throws SAXException
* @throws TransformerException
- * @throws XPathExpressionException
+ * @throws XPathExpressionException
*/
@org.junit.Test
public void test31withCommentsSubtree()
@@ -111,7 +111,7 @@ public class Canonicalizer20010315Test e
assertTrue(descri,
c14nAndCompare(fileIn, fileRef, fileOut, c14nURI, validating, xpath));
}
-
+
/**
* 3.1 PIs, Comments, and Outside of Document Element
*
@@ -122,7 +122,7 @@ public class Canonicalizer20010315Test e
* @throws ParserConfigurationException
* @throws SAXException
* @throws TransformerException
- * @throws XPathExpressionException
+ * @throws XPathExpressionException
*/
@org.junit.Test
public void test31withCommentsSubset()
@@ -154,7 +154,7 @@ public class Canonicalizer20010315Test e
* @throws SAXException
* @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-OutsideDoc">the example from the spec</A>
* @throws TransformerException
- * @throws XPathExpressionException
+ * @throws XPathExpressionException
*/
@org.junit.Test
public void test31subtree()
@@ -173,7 +173,7 @@ public class Canonicalizer20010315Test e
assertTrue(descri,
c14nAndCompare(fileIn, fileRef, fileOut, c14nURI, validating, xpath));
}
-
+
/**
* 3.1 PIs, Comments, and Outside of Document Element
*
@@ -185,7 +185,7 @@ public class Canonicalizer20010315Test e
* @throws SAXException
* @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-OutsideDoc">the example from the spec</A>
* @throws TransformerException
- * @throws XPathExpressionException
+ * @throws XPathExpressionException
*/
@org.junit.Test
public void test31subset()
@@ -217,7 +217,7 @@ public class Canonicalizer20010315Test e
* @throws SAXException
* @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-WhitespaceInContent">the example from the spec</A>
* @throws TransformerException
- * @throws XPathExpressionException
+ * @throws XPathExpressionException
*/
@org.junit.Test
public void test32subtree()
@@ -247,7 +247,7 @@ public class Canonicalizer20010315Test e
* @throws SAXException
* @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-WhitespaceInContent">the example from the spec</A>
* @throws TransformerException
- * @throws XPathExpressionException
+ * @throws XPathExpressionException
*/
@org.junit.Test
public void test32subset()
@@ -277,7 +277,7 @@ public class Canonicalizer20010315Test e
* @throws SAXException
* @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-SETags">the example from the spec</A>
* @throws TransformerException
- * @throws XPathExpressionException
+ * @throws XPathExpressionException
*/
@org.junit.Test
public void test33subtree()
@@ -325,7 +325,7 @@ public class Canonicalizer20010315Test e
* @see #test34validatingParser
* @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-Chars">the example from the spec</A>
* @throws TransformerException
- * @throws XPathExpressionException
+ * @throws XPathExpressionException
*/
@org.junit.Test
public void test34()
@@ -364,7 +364,7 @@ public class Canonicalizer20010315Test e
* @throws SAXException
* @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-Chars">the example from the spec</A>
* @throws TransformerException
- * @throws XPathExpressionException
+ * @throws XPathExpressionException
*/
@org.junit.Test
public void test34subtree()
@@ -383,7 +383,7 @@ public class Canonicalizer20010315Test e
assertTrue(descri,
c14nAndCompare(fileIn, fileRef, fileOut, c14nURI, validating, xpath));
}
-
+
/**
* 3.4 Character Modifications and Character References (patched to run on validating Parsers)
* <P>
@@ -403,7 +403,7 @@ public class Canonicalizer20010315Test e
* @throws SAXException
* @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-Chars">the example from the spec</A>
* @throws TransformerException
- * @throws XPathExpressionException
+ * @throws XPathExpressionException
*/
@org.junit.Test
public void test34subset()
@@ -435,7 +435,7 @@ public class Canonicalizer20010315Test e
* @throws SAXException
* @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-Entities">the example from the spec</A>
* @throws TransformerException
- * @throws XPathExpressionException
+ * @throws XPathExpressionException
*/
@org.junit.Test
public void test35subtree()
@@ -453,7 +453,7 @@ public class Canonicalizer20010315Test e
assertTrue(descri,
c14nAndCompare(fileIn, fileRef, fileOut, c14nURI, validating, xpath));
}
-
+
/**
* 3.5 Entity References
*
@@ -465,7 +465,7 @@ public class Canonicalizer20010315Test e
* @throws SAXException
* @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-Entities">the example from the spec</A>
* @throws TransformerException
- * @throws XPathExpressionException
+ * @throws XPathExpressionException
*/
@org.junit.Test
public void test35subset()
@@ -495,7 +495,7 @@ public class Canonicalizer20010315Test e
* @throws SAXException
* @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-UTF8">the example from the spec</A>
* @throws TransformerException
- * @throws XPathExpressionException
+ * @throws XPathExpressionException
*/
@org.junit.Test
public void test36subtree()
@@ -513,7 +513,7 @@ public class Canonicalizer20010315Test e
assertTrue(descri,
c14nAndCompare(fileIn, fileRef, fileOut, c14nURI, validating, xpath));
}
-
+
/**
* 3.6 UTF-8 Encoding
*
@@ -525,7 +525,7 @@ public class Canonicalizer20010315Test e
* @throws SAXException
* @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-UTF8">the example from the spec</A>
* @throws TransformerException
- * @throws XPathExpressionException
+ * @throws XPathExpressionException
*/
@org.junit.Test
public void test36subset()
@@ -555,7 +555,7 @@ public class Canonicalizer20010315Test e
* @throws SAXException
* @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-DocSubsets">the example from the spec</A>
* @throws TransformerException
- * @throws XPathExpressionException
+ * @throws XPathExpressionException
*/
@org.junit.Test
public void test37()
@@ -594,7 +594,7 @@ public class Canonicalizer20010315Test e
* @throws SAXException
* @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-DocSubsets">the example from the spec</A>
* @throws TransformerException
- * @throws XPathExpressionException
+ * @throws XPathExpressionException
*/
@org.junit.Test
public void test37byNodeList()
@@ -624,7 +624,7 @@ public class Canonicalizer20010315Test e
Map<String, String> namespace = new HashMap<String, String>();
namespace.put("ietf", "http://www.ietf.org");
-
+
XPathFactory xpf = XPathFactory.newInstance();
XPath xPath = xpf.newXPath();
DSNamespaceContext namespaceContext =
@@ -723,7 +723,7 @@ public class Canonicalizer20010315Test e
Canonicalizer.getInstance(Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS);
byte c14nBytes[] = c14n.canonicalize(utf16);
org.xml.sax.EntityResolver resolver = new TestVectorResolver();
- InputStream refStream =
+ InputStream refStream =
resolver.resolveEntity(
null, prefix + "/in/testTranslationFromUTF16toUTF8.xml").getByteStream();
byte refBytes[] = JavaUtils.getBytesFromStream(refStream);
@@ -742,7 +742,7 @@ public class Canonicalizer20010315Test e
* @throws ParserConfigurationException
* @throws SAXException
* @throws TransformerException
- * @throws XPathExpressionException
+ * @throws XPathExpressionException
*/
@org.junit.Test
public void testXMLAttributes1()
@@ -779,7 +779,7 @@ public class Canonicalizer20010315Test e
* @throws ParserConfigurationException
* @throws SAXException
* @throws TransformerException
- * @throws XPathExpressionException
+ * @throws XPathExpressionException
*/
@org.junit.Test
public void testXMLAttributes2()
@@ -816,7 +816,7 @@ public class Canonicalizer20010315Test e
* @throws ParserConfigurationException
* @throws SAXException
* @throws TransformerException
- * @throws XPathExpressionException
+ * @throws XPathExpressionException
*/
@org.junit.Test
public void testXMLAttributes3()
@@ -853,7 +853,7 @@ public class Canonicalizer20010315Test e
* @throws ParserConfigurationException
* @throws SAXException
* @throws TransformerException
- * @throws XPathExpressionException
+ * @throws XPathExpressionException
*/
@org.junit.Test
@org.junit.Ignore
@@ -893,7 +893,7 @@ public class Canonicalizer20010315Test e
* @throws ParserConfigurationException
* @throws SAXException
* @throws TransformerException
- * @throws XPathExpressionException
+ * @throws XPathExpressionException
*/
@org.junit.Test
@org.junit.Ignore
@@ -933,7 +933,7 @@ public class Canonicalizer20010315Test e
* @throws ParserConfigurationException
* @throws SAXException
* @throws TransformerException
- * @throws XPathExpressionException
+ * @throws XPathExpressionException
*/
@org.junit.Test
@org.junit.Ignore
@@ -977,7 +977,7 @@ public class Canonicalizer20010315Test e
* @throws ParserConfigurationException
* @throws SAXException
* @throws TransformerException
- * @throws XPathExpressionException
+ * @throws XPathExpressionException
*/
private boolean doTestXMLAttributes(String input, String definedOutput)
throws IOException, FileNotFoundException, SAXException,
@@ -994,14 +994,14 @@ public class Canonicalizer20010315Test e
Canonicalizer.getInstance(Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS);
//XMLUtils.circumventBug2650(doc);
-
+
XPathFactory xpf = XPathFactory.newInstance();
XPath xPath = xpf.newXPath();
xPath.setNamespaceContext(new DSNamespaceContext());
- String xpath =
+ String xpath =
"(//*[local-name()='included'] | //@*[parent::node()[local-name()='included']])";
- NodeList nodes =
+ NodeList nodes =
(NodeList)xPath.evaluate(xpath, doc, XPathConstants.NODESET);
byte result[] = c14nizer.canonicalizeXPathNodeSet(nodes);
@@ -1011,25 +1011,25 @@ public class Canonicalizer20010315Test e
}
private boolean c14nAndCompare(
- String fileIn,
- String fileRef,
- String fileOut,
- String c14nURI,
+ String fileIn,
+ String fileRef,
+ String fileOut,
+ String c14nURI,
boolean validating,
String xpath
) throws IOException, FileNotFoundException, SAXException,
ParserConfigurationException, CanonicalizationException,
InvalidCanonicalizerException, TransformerException, XPathExpressionException {
Map<String, String> namespace = new HashMap<String, String>();
- return c14nAndCompare(fileIn, fileRef, fileOut,
+ return c14nAndCompare(fileIn, fileRef, fileOut,
c14nURI, validating, xpath, namespace);
}
-
+
private boolean c14nAndCompare(
- String fileIn,
- String fileRef,
- String fileOut,
- String c14nURI,
+ String fileIn,
+ String fileRef,
+ String fileOut,
+ String c14nURI,
boolean validating,
String xpath,
Map<String, String> namespaces
@@ -1056,7 +1056,7 @@ public class Canonicalizer20010315Test e
c14nBytes = c14n.canonicalizeSubtree(doc);
} else {
NodeList nl = null;
-
+
XPathFactory xpf = XPathFactory.newInstance();
XPath xPath = xpf.newXPath();
DSNamespaceContext namespaceContext =
@@ -1075,7 +1075,7 @@ public class Canonicalizer20010315Test e
// if everything is OK, result is true; we do a binary compare, byte by byte
boolean result = java.security.MessageDigest.isEqual(refBytes, c14nBytes);
- if (!result) {
+ if (!result) {
File f = new File(fileOut);
if (!f.exists()) {
File parent = new File(f.getParent());
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/ExclusiveC14NInteropTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/ExclusiveC14NInteropTest.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/ExclusiveC14NInteropTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/ExclusiveC14NInteropTest.java Tue Dec 15 17:13:17 2015
@@ -41,7 +41,7 @@ public class ExclusiveC14NInteropTest ex
static {
org.apache.xml.security.Init.init();
}
-
+
/**
* Constructor ExclusiveC14NInteropTest
*/
@@ -170,5 +170,5 @@ public class ExclusiveC14NInteropTest ex
return r;
}
}
-
+
}
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/MockCanonicalizationMethod.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/MockCanonicalizationMethod.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/MockCanonicalizationMethod.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/MockCanonicalizationMethod.java Tue Dec 15 17:13:17 2015
@@ -41,7 +41,7 @@ public class MockCanonicalizationMethod
return _impl.engineCanonicalizeSubTree(rootNode);
}
- public byte[] engineCanonicalizeSubTree(Node rootNode, String inclusiveNamespaces)
+ public byte[] engineCanonicalizeSubTree(Node rootNode, String inclusiveNamespaces)
throws CanonicalizationException {
return _impl.engineCanonicalizeSubTree(rootNode, inclusiveNamespaces);
}
@@ -56,7 +56,7 @@ public class MockCanonicalizationMethod
return _impl.engineCanonicalizeXPathNodeSet(xpathNodeSet);
}
- public byte[] engineCanonicalizeXPathNodeSet(Set<Node> xpathNodeSet, String inclusiveNamespaces)
+ public byte[] engineCanonicalizeXPathNodeSet(Set<Node> xpathNodeSet, String inclusiveNamespaces)
throws CanonicalizationException {
return _impl.engineCanonicalizeXPathNodeSet(xpathNodeSet, inclusiveNamespaces);
}
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/NameSpaceSymbTableTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/NameSpaceSymbTableTest.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/NameSpaceSymbTableTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/NameSpaceSymbTableTest.java Tue Dec 15 17:13:17 2015
@@ -35,15 +35,15 @@ public class NameSpaceSymbTableTest exte
node2 = doc.createAttributeNS("b","c");
} catch (Exception e) {
e.printStackTrace();
- }
+ }
}
-
+
@org.junit.Test
public void testNullFirstXmlns() {
NameSpaceSymbTable ns = new NameSpaceSymbTable();
assertNull(ns.getMapping("xmlns"));
}
-
+
@org.junit.Test
public void testXmlnsPut() {
NameSpaceSymbTable ns = new NameSpaceSymbTable();
@@ -51,7 +51,7 @@ public class NameSpaceSymbTableTest exte
ns.addMapping("xmlns", "http://a", node1);
assertEquals(node1, ns.getMapping("xmlns"));
}
-
+
@org.junit.Test
public void testXmlnsMap() {
NameSpaceSymbTable ns = new NameSpaceSymbTable();
@@ -59,20 +59,20 @@ public class NameSpaceSymbTableTest exte
ns.addMapping("xmlns", "http://a", node1);
assertEquals(node1, ns.getMapping("xmlns"));
ns.pop();
- assertEquals(null, ns.getMapping("xmlns"));
+ assertEquals(null, ns.getMapping("xmlns"));
}
-
+
@org.junit.Test
public void testXmlnsMap2() {
NameSpaceSymbTable ns = new NameSpaceSymbTable();
ns.push();
ns.push();
- ns.addMapping("xmlns", "http://a", node1);
+ ns.addMapping("xmlns", "http://a", node1);
ns.pop();
ns.pop();
- assertEquals(null, ns.getMapping("xmlns"));
+ assertEquals(null, ns.getMapping("xmlns"));
}
-
+
@org.junit.Test
public void testXmlnsPrefix() {
NameSpaceSymbTable ns = new NameSpaceSymbTable();
@@ -81,12 +81,12 @@ public class NameSpaceSymbTableTest exte
assertEquals(node1, ns.getMapping("xmlns"));
ns.push();
ns.addMapping("xmlns", "http://a", node1);
- assertEquals(null, ns.getMapping("xmlns"));
+ assertEquals(null, ns.getMapping("xmlns"));
ns.push();
ns.addMapping("xmlns", "http://b", node1);
assertEquals(node1, ns.getMapping("xmlns"));
}
-
+
@org.junit.Test
public void testXmlnsRemovePrefix() {
NameSpaceSymbTable ns = new NameSpaceSymbTable();
@@ -94,10 +94,10 @@ public class NameSpaceSymbTableTest exte
ns.push();
ns.addMapping("xmlns", "http://a", node1);
assertEquals(node1, ns.getMapping("xmlns"));
- ns.pop();
- assertNull(ns.getMapping("xmlns"));
+ ns.pop();
+ assertNull(ns.getMapping("xmlns"));
}
-
+
@org.junit.Test
public void testPrefix() {
NameSpaceSymbTable ns = new NameSpaceSymbTable();
@@ -115,7 +115,7 @@ public class NameSpaceSymbTableTest exte
ns.addMapping("a", "http://c",node1);
assertEquals(node1, ns.getMapping("a"));
}
-
+
@org.junit.Test
public void testSeveralPrefixes() {
NameSpaceSymbTable ns = new NameSpaceSymbTable();
@@ -127,18 +127,18 @@ public class NameSpaceSymbTableTest exte
ns.push();
assertNull(ns.getMapping("a"));
}
-
+
@org.junit.Test
public void testSeveralPrefixes2() {
NameSpaceSymbTable ns = new NameSpaceSymbTable();
ns.push();
ns.addMapping("a", "http://a",node1);
- ns.push();
+ ns.push();
assertEquals(node1, ns.getMapping("a"));
ns.pop();
- assertEquals(node1, ns.getMapping("a"));
+ assertEquals(node1, ns.getMapping("a"));
}
-
+
@org.junit.Test
public void testGetUnrenderedNodes() {
NameSpaceSymbTable ns = new NameSpaceSymbTable();
@@ -152,7 +152,7 @@ public class NameSpaceSymbTableTest exte
assertNotNull("xmlns=\"\" not rendered", n);
assertEquals(n, node2);
}
-
+
@org.junit.Test
public void testUnrederedNodes() {
NameSpaceSymbTable ns = new NameSpaceSymbTable();
@@ -174,7 +174,7 @@ public class NameSpaceSymbTableTest exte
l.clear();
ns.getUnrenderedNodes(l);
assertFalse(l.contains(node1));
- assertFalse(l.contains(node2));
+ assertFalse(l.contains(node2));
ns.pop();
ns.pop();
l.clear();
@@ -188,13 +188,13 @@ public class NameSpaceSymbTableTest exte
NameSpaceSymbTable ns = new NameSpaceSymbTable();
ns.push();
- ns.addMappingAndRender("generated-command", "http://foo.com/command",node1);
+ ns.addMappingAndRender("generated-command", "http://foo.com/command",node1);
ns.addMappingAndRender("generated-event", "http://foo.com/event",node1);
ns.addMappingAndRender("command", "http://foo.com/command",node1);
ns.addMappingAndRender("ui", "http://foo.com/ui", node1);
ns.addMappingAndRender("event", "http://foo.com/event", node1);
ns.addMappingAndRender("instruction", "http://foo/instruction", node1);
- ns.addMappingAndRender("directory", "http://foo.com/io/directory", node1);
+ ns.addMappingAndRender("directory", "http://foo.com/io/directory", node1);
ns.addMappingAndRender("function", "http://foo.com/function", node1);
ns.addMappingAndRender("xmlns", "http://www.w3.org/1999/xhtml", node1);
ns.addMappingAndRender("ctrl", "http://foo.com/controls", node1);
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Santuario191Test.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Santuario191Test.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Santuario191Test.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Santuario191Test.java Tue Dec 15 17:13:17 2015
@@ -31,7 +31,7 @@ import org.apache.xml.security.utils.XML
/**
* This is a test for Santuario-191:
- *
+ *
* https://issues.apache.org/jira/browse/SANTUARIO-191
*
* An xml:Id attribute is appearing in a child element, contrary to the C14n11 spec.
@@ -53,7 +53,7 @@ public class Santuario191Test extends or
+ "</data>";
private DocumentBuilder db;
-
+
static {
org.apache.xml.security.Init.init();
}
@@ -65,14 +65,14 @@ public class Santuario191Test extends or
//
db = XMLUtils.createDocumentBuilder(false);
Document doc = db.parse(new ByteArrayInputStream(INPUT_DATA.getBytes("UTF8")));
-
+
//
// Canonicalize the data
//
NodeList dataNodes = doc.getElementsByTagName("data");
Canonicalizer11 c14ner = new Canonicalizer11_OmitComments();
byte[] result = c14ner.engineCanonicalizeSubTree(dataNodes.item(0));
-
+
//
// Test against expected result
//
@@ -80,5 +80,5 @@ public class Santuario191Test extends or
out.write(result);
assertTrue(EXPECTED_RESULT.equals(out.toString("UTF8")));
}
-
+
}
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Santuario273Test.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Santuario273Test.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Santuario273Test.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Santuario273Test.java Tue Dec 15 17:13:17 2015
@@ -34,7 +34,7 @@ import org.w3c.dom.Node;
/**
* This is a test for Santuario-273:
- *
+ *
* https://issues.apache.org/jira/browse/SANTUARIO-273
* "xml:base attribute not processed correctly in C14N11 canonicalization"
*/
@@ -60,7 +60,7 @@ public class Santuario273Test extends or
+ " </KeyInfo>\n"
+ "</Signature>\n"
;
-
+
public static final String expectedResult = "<SignedInfo xmlns=\"http://www.w3.org/2000/09/xmldsig#\" xml:base=\"http://www.acme.com/resources/subresources/\">\n"
+ " <CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\"></CanonicalizationMethod>\n"
+ " <SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#rsa-sha1\"></SignatureMethod>\n"
@@ -69,7 +69,7 @@ public class Santuario273Test extends or
+ " <DigestValue>60NvZvtdTB+7UnlLp/H24p7h4bs=</DigestValue>\n"
+ " </Reference>\n"
+ " </SignedInfo>";
-
+
static {
Init.init();
}
@@ -82,7 +82,7 @@ public class Santuario273Test extends or
byte inputBytes[] = input.getBytes();
Document doc =
documentBuilder.parse(new ByteArrayInputStream(inputBytes));
-
+
Canonicalizer c14n =
Canonicalizer.getInstance(Canonicalizer.ALGO_ID_C14N11_OMIT_COMMENTS);
@@ -90,7 +90,7 @@ public class Santuario273Test extends or
XPath xPath = xpf.newXPath();
xPath.setNamespaceContext(new DSNamespaceContext());
- Node signedInfo =
+ Node signedInfo =
(Node) xPath.evaluate("//ds:SignedInfo[1]", doc, XPathConstants.NODE);
byte[] output = c14n.canonicalizeSubtree(signedInfo);
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/UtfHelperTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/UtfHelperTest.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/UtfHelperTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/UtfHelperTest.java Tue Dec 15 17:13:17 2015
@@ -42,15 +42,15 @@ public class UtfHelperTest extends org.j
@org.junit.Test
public void testUtf() throws Exception {
-
+
//
// This test fails with the IBM JDK
//
if ("IBM Corporation".equals(System.getProperty("java.vendor"))) {
return;
}
-
- // if system property org.apache.xml.security.c14n.oldUtf8=true, can only validate
+
+ // if system property org.apache.xml.security.c14n.oldUtf8=true, can only validate
// 16bit chars against String.getBytes("UTF8");
int chunk = (Boolean.getBoolean("org.apache.xml.security.c14n.oldUtf8")) ? (1 << 16)
: (Character.MAX_CODE_POINT + 1);
@@ -85,7 +85,7 @@ public class UtfHelperTest extends org.j
byte correct[] = str.getBytes("UTF8");
assertTrue("UtfHelper.getStringInUtf8 false", Arrays.equals(correct, a));
assertTrue(
- "UtfHelper.getStringInUtf8 false",
+ "UtfHelper.getStringInUtf8 false",
Arrays.equals(correct, charByCharOs.toByteArray())
);
UtfHelpper.writeStringToUtf8(str, strOs);
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/BaltimoreEncTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/BaltimoreEncTest.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/BaltimoreEncTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/BaltimoreEncTest.java Tue Dec 15 17:13:17 2015
@@ -81,7 +81,7 @@ public class BaltimoreEncTest extends or
*/
public BaltimoreEncTest() throws Exception {
// Create the comparison strings
- String filename =
+ String filename =
"src/test/resources/ie/baltimore/merlin-examples/merlin-xmlenc-five/plaintext.xml";
String basedir = System.getProperty("basedir");
if (basedir != null && !"".equals(basedir)) {
@@ -117,7 +117,7 @@ public class BaltimoreEncTest extends or
byte[] pkcs8Bytes = JavaUtils.getBytesFromFile(filename);
PKCS8EncodedKeySpec pkcs8Spec = new PKCS8EncodedKeySpec(pkcs8Bytes);
- // Create a key factory
+ // Create a key factory
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
rsaKey = keyFactory.generatePrivate(pkcs8Spec);
@@ -130,7 +130,7 @@ public class BaltimoreEncTest extends or
// Check what algorithms are available
haveISOPadding = false;
- String algorithmId =
+ String algorithmId =
JCEMapper.translateURItoJCEID(EncryptionConstants.ALGO_ID_BLOCKCIPHER_AES128);
if (algorithmId != null) {
@@ -145,7 +145,7 @@ public class BaltimoreEncTest extends or
}
}
- haveKeyWraps =
+ haveKeyWraps =
(JCEMapper.translateURItoJCEID(EncryptionConstants.ALGO_ID_KEYWRAP_AES128) != null);
}
@@ -157,7 +157,7 @@ public class BaltimoreEncTest extends or
@org.junit.Test
public void test_five_content_3des_cbc() throws Exception {
if (haveISOPadding) {
- String filename =
+ String filename =
"src/test/resources/ie/baltimore/merlin-examples/merlin-xmlenc-five/encrypt-content-tripledes-cbc.xml";
Document dd = decryptElement(filename);
@@ -179,7 +179,7 @@ public class BaltimoreEncTest extends or
public void test_five_content_aes256_cbc() throws Exception {
if (haveISOPadding) {
- String filename =
+ String filename =
"src/test/resources/ie/baltimore/merlin-examples/merlin-xmlenc-five/encrypt-content-aes256-cbc-prop.xml";
Document dd = decryptElement(filename);
@@ -201,7 +201,7 @@ public class BaltimoreEncTest extends or
@org.junit.Test
public void test_five_content_aes128_cbc_kw_aes192() throws Exception {
if (haveISOPadding && haveKeyWraps) {
- String filename =
+ String filename =
"src/test/resources/ie/baltimore/merlin-examples/merlin-xmlenc-five/encrypt-content-aes128-cbc-kw-aes192.xml";
Document dd = decryptElement(filename);
@@ -224,7 +224,7 @@ public class BaltimoreEncTest extends or
public void test_five_content_3des_cbc_kw_aes128() throws Exception {
if (haveISOPadding && haveKeyWraps) {
- String filename =
+ String filename =
"src/test/resources/ie/baltimore/merlin-examples/merlin-xmlenc-five/encrypt-element-tripledes-cbc-kw-aes128.xml";
Document dd = decryptElement(filename);
@@ -246,7 +246,7 @@ public class BaltimoreEncTest extends or
@org.junit.Test
public void test_five_content_aes128_cbc_rsa_15() throws Exception {
if (haveISOPadding) {
- String filename =
+ String filename =
"src/test/resources/ie/baltimore/merlin-examples/merlin-xmlenc-five/encrypt-element-aes128-cbc-rsa-1_5.xml";
Document dd = decryptElement(filename);
@@ -268,7 +268,7 @@ public class BaltimoreEncTest extends or
@org.junit.Test
public void test_five_element_aes192_cbc_ref() throws Exception {
if (haveISOPadding) {
- String filename =
+ String filename =
"src/test/resources/ie/baltimore/merlin-examples/merlin-xmlenc-five/encrypt-element-aes192-cbc-ref.xml";
Document dd = decryptElement(filename);
@@ -292,7 +292,7 @@ public class BaltimoreEncTest extends or
@org.junit.Test
public void test_five_data_aes128_cbc() throws Exception {
if (haveISOPadding) {
- String filename =
+ String filename =
"src/test/resources/ie/baltimore/merlin-examples/merlin-xmlenc-five/encrypt-data-aes128-cbc.xml";
byte[] decrypt = decryptData(filename);
@@ -314,7 +314,7 @@ public class BaltimoreEncTest extends or
@org.junit.Test
public void test_five_data_aes256_cbc_3des() throws Exception {
if (haveISOPadding && haveKeyWraps) {
- String filename =
+ String filename =
"src/test/resources/ie/baltimore/merlin-examples/merlin-xmlenc-five/encrypt-data-aes256-cbc-kw-tripledes.xml";
byte[] decrypt = decryptData(filename);
@@ -336,7 +336,7 @@ public class BaltimoreEncTest extends or
@org.junit.Test
public void test_five_data_aes192_cbc_aes256() throws Exception {
if (haveISOPadding && haveKeyWraps) {
- String filename =
+ String filename =
"src/test/resources/ie/baltimore/merlin-examples/merlin-xmlenc-five/encrypt-data-aes192-cbc-kw-aes256.xml";
byte[] decrypt = decryptData(filename);
@@ -358,7 +358,7 @@ public class BaltimoreEncTest extends or
@org.junit.Test
public void test_five_data_3des_cbc_rsa_oaep() throws Exception {
if (haveISOPadding) {
- String filename =
+ String filename =
"src/test/resources/ie/baltimore/merlin-examples/merlin-xmlenc-five/encrypt-data-tripledes-cbc-rsa-oaep-mgf1p.xml";
byte[] decrypt = decryptData(filename);
@@ -414,7 +414,7 @@ public class BaltimoreEncTest extends or
/**
* Method decryptData
*
- * Take a file, find an encrypted element decrypt it and return the
+ * Take a file, find an encrypted element decrypt it and return the
* resulting byte array
*
* @param filename File to decrypt from
@@ -450,7 +450,7 @@ public class BaltimoreEncTest extends or
return cipher.decryptToByteArray(ee);
}
- /**
+ /**
* Method mapKeyName
*
* Create a secret key from a key name for merlin-five
@@ -529,7 +529,7 @@ public class BaltimoreEncTest extends or
if (kek != null) {
XMLCipher cipher = XMLCipher.getInstance();
cipher.init(XMLCipher.UNWRAP_MODE, kek);
- key =
+ key =
cipher.decryptKey(
encryptedKey, encryptedData.getEncryptionMethod().getAlgorithm()
);
@@ -537,7 +537,7 @@ public class BaltimoreEncTest extends or
return key;
}
-
+
/**
* Method countNodes
*
@@ -561,7 +561,7 @@ public class BaltimoreEncTest extends or
return count;
}
-
+
/**
* Method retrieveCCNumber
*
@@ -569,12 +569,12 @@ public class BaltimoreEncTest extends or
*
* @param doc The document to retrieve the card number from
* @return The retrieved credit card number
- * @throws XPathExpressionException
+ * @throws XPathExpressionException
*/
- private static String retrieveCCNumber(Document doc)
- throws javax.xml.transform.TransformerException,
+ private static String retrieveCCNumber(Document doc)
+ throws javax.xml.transform.TransformerException,
XPathExpressionException {
-
+
XPathFactory xpf = XPathFactory.newInstance();
XPath xpath = xpf.newXPath();
Map<String, String> namespace = new HashMap<String, String>();
@@ -583,7 +583,7 @@ public class BaltimoreEncTest extends or
xpath.setNamespaceContext(context);
String expression = "//x:Number/text()";
- Node ccnumElt =
+ Node ccnumElt =
(Node) xpath.evaluate(expression, doc, XPathConstants.NODE);
if (ccnumElt != null) {
@@ -608,7 +608,7 @@ public class BaltimoreEncTest extends or
int myNodeCount = countNodes(d);
assertTrue(
- "Node count mismatches",
+ "Node count mismatches",
((myNodeCount > 0) && myNodeCount == nodeCount)
);
}
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/BobKeyResolver.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/BobKeyResolver.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/BobKeyResolver.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/BobKeyResolver.java Tue Dec 15 17:13:17 2015
@@ -117,9 +117,9 @@ public class BobKeyResolver extends KeyR
) throws KeyResolverException {
if (engineCanResolve(element, BaseURI, storage)) {
try {
- DESedeKeySpec keySpec =
+ DESedeKeySpec keySpec =
new DESedeKeySpec("abcdefghijklmnopqrstuvwx".getBytes("ASCII"));
- SecretKeyFactory keyFactory =
+ SecretKeyFactory keyFactory =
SecretKeyFactory.getInstance("DESede");
SecretKey key = keyFactory.generateSecret(keySpec);
@@ -132,6 +132,6 @@ public class BobKeyResolver extends KeyR
return null;
}
-
+
}
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/EncryptContentTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/EncryptContentTest.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/EncryptContentTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/EncryptContentTest.java Tue Dec 15 17:13:17 2015
@@ -54,7 +54,7 @@ public class EncryptContentTest extends
" <serial>Y10</serial>\n" +
" </user>\n" +
"</users>\n";
-
+
private static final String MULTIPLE_USER_DATA =
"<users>\n" +
" <user>\n" +
@@ -87,7 +87,7 @@ public class EncryptContentTest extends
// 3DES encryption
haveISOPadding = false;
- String algorithmId =
+ String algorithmId =
JCEMapper.translateURItoJCEID(
org.apache.xml.security.utils.EncryptionConstants.ALGO_ID_BLOCKCIPHER_AES128
);
@@ -128,20 +128,20 @@ public class EncryptContentTest extends
while (child != null && child.getNodeType() != Node.ELEMENT_NODE) {
child = child.getNextSibling();
}
-
+
// child should be EncryptedData, if not throw exception
Element childElem = (Element) child;
if (!childElem.getLocalName().equals("EncryptedData")) {
// t.transform(new DOMSource(doc), new StreamResult(System.out));
throw new Exception("Element content not replaced");
}
-
+
// there shouldn't be any more children elements
Node sibling = childElem.getNextSibling();
while (sibling != null && sibling.getNodeType() != Node.ELEMENT_NODE) {
sibling = sibling.getNextSibling();
}
-
+
if (sibling != null) {
// t.transform(new DOMSource(doc), new StreamResult(System.out));
throw new Exception("Sibling element content not replaced");
@@ -149,7 +149,7 @@ public class EncryptContentTest extends
// t.transform(new DOMSource(doc), new StreamResult(System.out));
}
-
+
/**
* See SANTUARIO-301:
* https://issues.apache.org/jira/browse/SANTUARIO-301
@@ -172,7 +172,7 @@ public class EncryptContentTest extends
EncryptedData encryptedData = dataCipher.getEncryptedData();
encryptedData.setKeyInfo(keyInfo);
-
+
for (int i = 0; i < dataToEncrypt.getLength(); i++) {
dataCipher.doFinal(doc,(Element) dataToEncrypt.item(i), true);
}
@@ -180,5 +180,5 @@ public class EncryptContentTest extends
NodeList keyInfoList = doc.getElementsByTagNameNS(Constants.SignatureSpecNS, "KeyInfo");
assertEquals(keyInfoList.getLength(), 2);
}
-
+
}
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/ReferenceListTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/ReferenceListTest.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/ReferenceListTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/ReferenceListTest.java Tue Dec 15 17:13:17 2015
@@ -54,7 +54,7 @@ public class ReferenceListTest extends o
dataRefList.add(dataRef1);
Reference dataRef2 = dataRefList.newDataReference("#id2");
dataRefList.add(dataRef2);
-
+
assertEquals("#id1", dataRef1.getURI());
ReferenceList keyRefList = dataCipher.createReferenceList(ReferenceList.KEY_REFERENCE);
@@ -62,7 +62,7 @@ public class ReferenceListTest extends o
keyRefList.add(keyRef10);
Reference keyRef20 = keyRefList.newKeyReference("#id20");
keyRefList.add(keyRef20);
-
+
assertEquals("#id10", keyRef10.getURI());
// See SANTUARIO-302
@@ -79,7 +79,7 @@ public class ReferenceListTest extends o
assertEquals(EncryptionConstants._TAG_DATAREFERENCE, dataRef2Element.getLocalName());
assertEquals("#id2", dataRef2Element.getAttribute("URI"));
assertNull(dataRef2Element.getNextSibling());
-
+
Element keyRefListElement = dataCipher.martial(doc, keyRefList);
assertEquals(EncryptionConstants.EncryptionSpecNS, keyRefListElement.getNamespaceURI());
assertEquals(EncryptionConstants._TAG_REFERENCELIST, keyRefListElement.getLocalName());
@@ -103,7 +103,7 @@ public class ReferenceListTest extends o
assertEquals(EncryptionConstants._TAG_DATAREFERENCE, ref.getType());
assertEquals("#id2", ref.getURI());
assertTrue(!iter.hasNext());
-
+
iter = keyRefList.getReferences();
ref = iter.next();
assertEquals(EncryptionConstants._TAG_KEYREFERENCE, ref.getType());
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/XMLCipherTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/XMLCipherTest.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/XMLCipherTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/XMLCipherTest.java Tue Dec 15 17:13:17 2015
@@ -68,7 +68,7 @@ public class XMLCipherTest extends org.j
private static org.slf4j.Logger log =
org.slf4j.LoggerFactory.getLogger(XMLCipherTest.class);
-
+
static {
org.apache.xml.security.Init.init();
}
@@ -90,14 +90,14 @@ public class XMLCipherTest extends org.j
elementName = System.getProperty("org.apache.xml.enc.test.elem", "project");
elementIndex = System.getProperty("org.apache.xml.enc.test.idx", "0");
- tstBase64EncodedString =
+ tstBase64EncodedString =
"YmNkZWZnaGlqa2xtbm9wcRrPXjQ1hvhDFT+EdesMAPE4F6vlT+y0HPXe0+nAGLQ8";
// Determine if we have ISO 10126 Padding - needed for Bulk AES or
// 3DES encryption
haveISOPadding = false;
- String algorithmId =
+ String algorithmId =
JCEMapper.translateURItoJCEID(EncryptionConstants.ALGO_ID_BLOCKCIPHER_AES128);
if (algorithmId != null) {
@@ -112,12 +112,12 @@ public class XMLCipherTest extends org.j
}
}
- haveKeyWraps =
+ haveKeyWraps =
(JCEMapper.translateURItoJCEID(EncryptionConstants.ALGO_ID_KEYWRAP_AES128) != null);
-
+
//
- // If the BouncyCastle provider is not installed, then try to load it
- // via reflection.
+ // If the BouncyCastle provider is not installed, then try to load it
+ // via reflection.
//
if (Security.getProvider("BC") == null) {
Constructor<?> cons = null;
@@ -133,7 +133,7 @@ public class XMLCipherTest extends org.j
bcInstalled = true;
}
}
-
+
}
@org.junit.AfterClass
@@ -279,7 +279,7 @@ public class XMLCipherTest extends org.j
/**
* Test encryption using a generated AES 192 bit key that is
- * encrypted using a 3DES key. Then reverse by decrypting
+ * encrypted using a 3DES key. Then reverse by decrypting
* EncryptedKey by hand
*/
@org.junit.Test
@@ -585,7 +585,7 @@ public class XMLCipherTest extends org.j
);
}
}
-
+
@org.junit.Test
public void testEncryptionProperties() throws Exception {
Document d = document(); // source
@@ -609,7 +609,7 @@ public class XMLCipherTest extends org.j
// encrypt
cipher = XMLCipher.getInstance(XMLCipher.TRIPLEDES);
cipher.init(XMLCipher.ENCRYPT_MODE, key);
-
+
// Add EncryptionProperties
Element elem = d.createElement("CustomInformation");
elem.setTextContent("Some text content");
@@ -621,10 +621,10 @@ public class XMLCipherTest extends org.j
ep.setTarget("http://localhost/");
ep.setAttribute("xml:lang", "en");
eps.addEncryptionProperty(ep);
-
+
EncryptedData encData = cipher.getEncryptedData();
encData.setEncryptionProperties(eps);
-
+
ed = cipher.doFinal(d, e);
// XMLUtils.outputDOM(ed, System.out);
@@ -661,7 +661,7 @@ public class XMLCipherTest extends org.j
// Create the XMLCipher object
cipher = XMLCipher.getInstance();
- EncryptedData ed =
+ EncryptedData ed =
cipher.createEncryptedData(CipherData.REFERENCE_TYPE,
"#CipherTextId");
EncryptionMethod em =
@@ -679,7 +679,7 @@ public class XMLCipherTest extends org.j
XPathContainer xpc = new XPathContainer(d);
xpc.setXPath("self::text()[parent::CipherText[@Id=\"CipherTextId\"]]");
dsTransforms.addTransform(
- org.apache.xml.security.transforms.Transforms.TRANSFORM_XPATH,
+ org.apache.xml.security.transforms.Transforms.TRANSFORM_XPATH,
xpc.getElementPlusReturns()
);
@@ -708,7 +708,7 @@ public class XMLCipherTest extends org.j
byte[] decryptBytes = cipherDecrypt.decryptToByteArray(ee);
assertEquals("A test encrypted secret",
- new String(decryptBytes, "ASCII"));
+ new String(decryptBytes, "ASCII"));
} else {
log.warn(
"Test testSameDocumentCipherReference skipped as "
@@ -740,7 +740,7 @@ public class XMLCipherTest extends org.j
XMLCipher dataCipher = XMLCipher.getInstance(XMLCipher.TRIPLEDES);
dataCipher.init(XMLCipher.ENCRYPT_MODE, secretKey);
dataCipher.doFinal(doc, elem);
-
+
Element encrElem = (Element)doc.getDocumentElement().getFirstChild();
assertEquals("EncryptedData", encrElem.getLocalName());
@@ -764,7 +764,7 @@ public class XMLCipherTest extends org.j
dataCipher = XMLCipher.getInstance(XMLCipher.TRIPLEDES);
dataCipher.init(XMLCipher.ENCRYPT_MODE, secretKey);
dataCipher.doFinal(doc, elem);
-
+
encrElem = (Element)doc.getDocumentElement().getFirstChild();
assertEquals("EncryptedData", encrElem.getLocalName());
@@ -779,7 +779,7 @@ public class XMLCipherTest extends org.j
attr = (Attr)decrElem.getAttributes().item(0);
assertEquals("xmlns", attr.getName());
assertEquals("", attr.getValue());
-
+
// Test comments and PIs are not treated specially when serializing element content.
// Other c14n algorithms add a newline after comments and PIs, when they are before or after the document element.
final String DATA3 = "<root><!--comment1--><?pi1 target1?><elem/><!--comment2--><?pi2 target2?></root>";
@@ -789,7 +789,7 @@ public class XMLCipherTest extends org.j
dataCipher = XMLCipher.getInstance(XMLCipher.TRIPLEDES);
dataCipher.init(XMLCipher.ENCRYPT_MODE, secretKey);
dataCipher.doFinal(doc, elem, true);
-
+
encrElem = (Element)elem.getFirstChild();
assertEquals("EncryptedData", encrElem.getLocalName());
assertNull(encrElem.getNextSibling());
@@ -850,7 +850,7 @@ public class XMLCipherTest extends org.j
String before = baos.toString("UTF-8");
byte[] serialized = baos.toByteArray();
- EncryptedData encryptedData =
+ EncryptedData encryptedData =
cipher.encryptData(
d, EncryptionConstants.TYPE_ELEMENT, new ByteArrayInputStream(serialized)
);
@@ -870,7 +870,7 @@ public class XMLCipherTest extends org.j
@org.junit.Test
public void testEncryptedKeyWithRecipient() throws Exception {
- String filename =
+ String filename =
"src/test/resources/org/apache/xml/security/encryption/encryptedKey.xml";
if (basedir != null && !"".equals(basedir)) {
filename = basedir + "/" + filename;
@@ -878,17 +878,17 @@ public class XMLCipherTest extends org.j
File f = new File(filename);
DocumentBuilder builder = XMLUtils.createDocumentBuilder(false);
- Document document = builder.parse(f);
+ Document document = builder.parse(f);
XMLCipher keyCipher = XMLCipher.getInstance();
keyCipher.init(XMLCipher.UNWRAP_MODE, null);
- NodeList ekList =
+ NodeList ekList =
document.getElementsByTagNameNS(
EncryptionConstants.EncryptionSpecNS, EncryptionConstants._TAG_ENCRYPTEDKEY
);
for (int i = 0; i < ekList.getLength(); i++) {
- EncryptedKey ek =
+ EncryptedKey ek =
keyCipher.loadEncryptedKey(document, (Element) ekList.item(i));
assertNotNull(ek.getRecipient());
}
@@ -917,7 +917,7 @@ public class XMLCipherTest extends org.j
xmlCipher.decryptToByteArray(encryptedData);
}
-
+
@org.junit.Test
public void testMultipleKEKs() throws Exception {
@@ -937,7 +937,7 @@ public class XMLCipherTest extends org.j
KeyGenerator keygen = KeyGenerator.getInstance("AES");
keygen.init(192);
Key kek1 = keygen.generateKey();
-
+
// Set up Key Encryption Key no. 2
Key kek2 = keygen.generateKey();
@@ -949,7 +949,7 @@ public class XMLCipherTest extends org.j
cipher = XMLCipher.getInstance(XMLCipher.AES_192_KeyWrap);
cipher.init(XMLCipher.WRAP_MODE, kek1);
EncryptedKey encryptedKey1 = cipher.encryptKey(d, key);
-
+
cipher.init(XMLCipher.WRAP_MODE, kek2);
EncryptedKey encryptedKey2 = cipher.encryptKey(d, key);
@@ -968,7 +968,7 @@ public class XMLCipherTest extends org.j
builderKeyInfo.add(encryptedKey2);
ed = cipher.doFinal(d, e);
-
+
//decrypt
key = null;
ee = (Element) ed.getElementsByTagName("xenc:EncryptedData").item(0);
@@ -1029,5 +1029,5 @@ public class XMLCipherTest extends org.j
return (result);
}
-
+
}
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/XMLEncryption11Test.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/XMLEncryption11Test.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/XMLEncryption11Test.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/encryption/XMLEncryption11Test.java Tue Dec 15 17:13:17 2015
@@ -58,11 +58,11 @@ import org.w3c.dom.Node;
/**
* This is a set of tests that use the test vectors associated with the W3C XML Encryption 1.1 specification:
- *
+ *
* http://www.w3.org/2008/xmlsec/Drafts/xmlenc-core-11/test-cases/
- *
+ *
* Note: I had to convert the given .p12 file into a .jks as it could not be loaded with KeyStore.
- *
+ *
* TODO As of now all of the KeyWrapping tests are supported, but none of the KeyAgreement tests.
*/
public class XMLEncryption11Test extends org.junit.Assert {
@@ -79,7 +79,7 @@ public class XMLEncryption11Test extends
*/
public XMLEncryption11Test() throws Exception {
//
- // If the BouncyCastle provider is not installed, then try to load it
+ // If the BouncyCastle provider is not installed, then try to load it
// via reflection. If it is not available, then skip this test as it is
// required for GCM algorithm support
//
@@ -96,9 +96,9 @@ public class XMLEncryption11Test extends
Security.insertProviderAt(provider, 2);
}
}
-
+
// Create the comparison strings
- String filename =
+ String filename =
"src/test/resources/org/w3c/www/interop/xmlenc-core-11/plaintext.xml";
String basedir = System.getProperty("basedir");
if (basedir != null && !"".equals(basedir)) {
@@ -120,7 +120,7 @@ public class XMLEncryption11Test extends
// Check what algorithms are available
haveISOPadding = false;
- String algorithmId =
+ String algorithmId =
JCEMapper.translateURItoJCEID(EncryptionConstants.ALGO_ID_BLOCKCIPHER_AES128);
if (algorithmId != null) {
@@ -147,23 +147,23 @@ public class XMLEncryption11Test extends
@org.junit.Test
public void testKeyWrappingRSA2048() throws Exception {
if (haveISOPadding) {
- String keystore =
+ String keystore =
"src/test/resources/org/w3c/www/interop/xmlenc-core-11/RSA-2048_SHA256WithRSA.jks";
String basedir = System.getProperty("basedir");
if (basedir != null && !"".equals(basedir)) {
keystore = basedir + "/" + keystore;
}
-
+
KeyStore keyStore = KeyStore.getInstance("jks");
keyStore.load(new java.io.FileInputStream(keystore), "passwd".toCharArray());
-
+
Certificate cert = keyStore.getCertificate("importkey");
KeyStore.PrivateKeyEntry pkEntry = (KeyStore.PrivateKeyEntry)
keyStore.getEntry("importkey", new KeyStore.PasswordProtection("passwd".toCharArray()));
PrivateKey rsaKey = pkEntry.getPrivateKey();
-
- String filename =
+
+ String filename =
"src/test/resources/org/w3c/www/interop/xmlenc-core-11/"
+ "cipherText__RSA-2048__aes128-gcm__rsa-oaep-mgf1p.xml";
@@ -177,25 +177,25 @@ public class XMLEncryption11Test extends
);
}
}
-
+
/**
* rsa-oaep-mgf1p, Digest:SHA256, MGF:SHA1, PSource: None
*/
@org.junit.Test
public void testKeyWrappingRSA2048EncryptDecrypt() throws Exception {
if (haveISOPadding) {
- String keystore =
+ String keystore =
"src/test/resources/org/w3c/www/interop/xmlenc-core-11/RSA-2048_SHA256WithRSA.jks";
String basedir = System.getProperty("basedir");
if (basedir != null && !"".equals(basedir)) {
keystore = basedir + "/" + keystore;
}
-
+
KeyStore keyStore = KeyStore.getInstance("jks");
keyStore.load(new java.io.FileInputStream(keystore), "passwd".toCharArray());
-
+
Certificate cert = keyStore.getCertificate("importkey");
-
+
KeyStore.PrivateKeyEntry pkEntry = (KeyStore.PrivateKeyEntry)
keyStore.getEntry("importkey", new KeyStore.PasswordProtection("passwd".toCharArray()));
PrivateKey rsaKey = pkEntry.getPrivateKey();
@@ -211,9 +211,9 @@ public class XMLEncryption11Test extends
Document doc = db.parse(new java.io.FileInputStream(f));
Key sessionKey = getSessionKey("http://www.w3.org/2009/xmlenc11#aes128-gcm");
- EncryptedKey encryptedKey =
+ EncryptedKey encryptedKey =
createEncryptedKey(
- doc,
+ doc,
(X509Certificate)cert,
sessionKey,
"http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p",
@@ -221,16 +221,16 @@ public class XMLEncryption11Test extends
null,
null
);
-
- doc =
+
+ doc =
encryptDocument(
- doc,
+ doc,
encryptedKey,
- sessionKey,
+ sessionKey,
"http://www.w3.org/2009/xmlenc11#aes128-gcm"
);
// XMLUtils.outputDOM(doc.getFirstChild(), System.out);
-
+
// Perform decryption
Document dd = decryptElement(doc, rsaKey, (X509Certificate)cert);
// XMLUtils.outputDOM(dd.getFirstChild(), System.out);
@@ -242,30 +242,30 @@ public class XMLEncryption11Test extends
);
}
}
-
+
/**
* rsa-oaep-mgf1p, Digest:SHA256, MGF:SHA1, PSource: None
*/
@org.junit.Test
public void testKeyWrappingRSA3072() throws Exception {
if (haveISOPadding) {
- String keystore =
+ String keystore =
"src/test/resources/org/w3c/www/interop/xmlenc-core-11/RSA-3072_SHA256WithRSA.jks";
String basedir = System.getProperty("basedir");
if (basedir != null && !"".equals(basedir)) {
keystore = basedir + "/" + keystore;
}
-
+
KeyStore keyStore = KeyStore.getInstance("jks");
keyStore.load(new java.io.FileInputStream(keystore), "passwd".toCharArray());
-
+
Certificate cert = keyStore.getCertificate("importkey");
KeyStore.PrivateKeyEntry pkEntry = (KeyStore.PrivateKeyEntry)
keyStore.getEntry("importkey", new KeyStore.PasswordProtection("passwd".toCharArray()));
PrivateKey rsaKey = pkEntry.getPrivateKey();
-
- String filename =
+
+ String filename =
"src/test/resources/org/w3c/www/interop/xmlenc-core-11/"
+ "cipherText__RSA-3072__aes192-gcm__rsa-oaep-mgf1p__Sha256.xml";
@@ -279,25 +279,25 @@ public class XMLEncryption11Test extends
);
}
}
-
+
/**
* rsa-oaep-mgf1p, Digest:SHA256, MGF:SHA1, PSource: None
*/
@org.junit.Test
public void testKeyWrappingRSA3072EncryptDecrypt() throws Exception {
if (haveISOPadding) {
- String keystore =
+ String keystore =
"src/test/resources/org/w3c/www/interop/xmlenc-core-11/RSA-3072_SHA256WithRSA.jks";
String basedir = System.getProperty("basedir");
if (basedir != null && !"".equals(basedir)) {
keystore = basedir + "/" + keystore;
}
-
+
KeyStore keyStore = KeyStore.getInstance("jks");
keyStore.load(new java.io.FileInputStream(keystore), "passwd".toCharArray());
-
+
Certificate cert = keyStore.getCertificate("importkey");
-
+
KeyStore.PrivateKeyEntry pkEntry = (KeyStore.PrivateKeyEntry)
keyStore.getEntry("importkey", new KeyStore.PasswordProtection("passwd".toCharArray()));
PrivateKey rsaKey = pkEntry.getPrivateKey();
@@ -313,9 +313,9 @@ public class XMLEncryption11Test extends
Document doc = db.parse(new java.io.FileInputStream(f));
Key sessionKey = getSessionKey("http://www.w3.org/2009/xmlenc11#aes192-gcm");
- EncryptedKey encryptedKey =
+ EncryptedKey encryptedKey =
createEncryptedKey(
- doc,
+ doc,
(X509Certificate)cert,
sessionKey,
"http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p",
@@ -323,16 +323,16 @@ public class XMLEncryption11Test extends
null,
null
);
-
- doc =
+
+ doc =
encryptDocument(
- doc,
+ doc,
encryptedKey,
- sessionKey,
+ sessionKey,
"http://www.w3.org/2009/xmlenc11#aes192-gcm"
);
// XMLUtils.outputDOM(doc.getFirstChild(), System.out);
-
+
// Perform decryption
Document dd = decryptElement(doc, rsaKey, (X509Certificate)cert);
// XMLUtils.outputDOM(dd.getFirstChild(), System.out);
@@ -344,30 +344,30 @@ public class XMLEncryption11Test extends
);
}
}
-
+
/**
* rsa-oaep, Digest:SHA384, MGF:SHA1, PSource: None
*/
@org.junit.Test
public void testKeyWrappingRSA3072OAEP() throws Exception {
if (haveISOPadding) {
- String keystore =
+ String keystore =
"src/test/resources/org/w3c/www/interop/xmlenc-core-11/RSA-3072_SHA256WithRSA.jks";
String basedir = System.getProperty("basedir");
if (basedir != null && !"".equals(basedir)) {
keystore = basedir + "/" + keystore;
}
-
+
KeyStore keyStore = KeyStore.getInstance("jks");
keyStore.load(new java.io.FileInputStream(keystore), "passwd".toCharArray());
-
+
Certificate cert = keyStore.getCertificate("importkey");
KeyStore.PrivateKeyEntry pkEntry = (KeyStore.PrivateKeyEntry)
keyStore.getEntry("importkey", new KeyStore.PasswordProtection("passwd".toCharArray()));
PrivateKey rsaKey = pkEntry.getPrivateKey();
-
- String filename =
+
+ String filename =
"src/test/resources/org/w3c/www/interop/xmlenc-core-11/"
+ "cipherText__RSA-3072__aes256-gcm__rsa-oaep__Sha384-MGF_Sha1.xml";
@@ -381,25 +381,25 @@ public class XMLEncryption11Test extends
);
}
}
-
+
/**
* rsa-oaep, Digest:SHA384, MGF:SHA1, PSource: None
*/
@org.junit.Test
public void testKeyWrappingRSA3072OAEPEncryptDecrypt() throws Exception {
if (haveISOPadding) {
- String keystore =
+ String keystore =
"src/test/resources/org/w3c/www/interop/xmlenc-core-11/RSA-3072_SHA256WithRSA.jks";
String basedir = System.getProperty("basedir");
if (basedir != null && !"".equals(basedir)) {
keystore = basedir + "/" + keystore;
}
-
+
KeyStore keyStore = KeyStore.getInstance("jks");
keyStore.load(new java.io.FileInputStream(keystore), "passwd".toCharArray());
-
+
Certificate cert = keyStore.getCertificate("importkey");
-
+
KeyStore.PrivateKeyEntry pkEntry = (KeyStore.PrivateKeyEntry)
keyStore.getEntry("importkey", new KeyStore.PasswordProtection("passwd".toCharArray()));
PrivateKey rsaKey = pkEntry.getPrivateKey();
@@ -415,9 +415,9 @@ public class XMLEncryption11Test extends
Document doc = db.parse(new java.io.FileInputStream(f));
Key sessionKey = getSessionKey("http://www.w3.org/2009/xmlenc11#aes256-gcm");
- EncryptedKey encryptedKey =
+ EncryptedKey encryptedKey =
createEncryptedKey(
- doc,
+ doc,
(X509Certificate)cert,
sessionKey,
"http://www.w3.org/2009/xmlenc11#rsa-oaep",
@@ -425,16 +425,16 @@ public class XMLEncryption11Test extends
"http://www.w3.org/2009/xmlenc11#mgf1sha1",
null
);
-
- doc =
+
+ doc =
encryptDocument(
- doc,
+ doc,
encryptedKey,
- sessionKey,
+ sessionKey,
"http://www.w3.org/2009/xmlenc11#aes256-gcm"
);
// XMLUtils.outputDOM(doc.getFirstChild(), System.out);
-
+
// Perform decryption
Document dd = decryptElement(doc, rsaKey, (X509Certificate)cert);
// XMLUtils.outputDOM(dd.getFirstChild(), System.out);
@@ -446,30 +446,30 @@ public class XMLEncryption11Test extends
);
}
}
-
+
/**
* rsa-oaep, Digest:SHA512, MGF:SHA1, PSource: Specified 8 bytes
*/
@org.junit.Test
public void testKeyWrappingRSA4096() throws Exception {
if (haveISOPadding) {
- String keystore =
+ String keystore =
"src/test/resources/org/w3c/www/interop/xmlenc-core-11/RSA-4096_SHA256WithRSA.jks";
String basedir = System.getProperty("basedir");
if (basedir != null && !"".equals(basedir)) {
keystore = basedir + "/" + keystore;
}
-
+
KeyStore keyStore = KeyStore.getInstance("jks");
keyStore.load(new java.io.FileInputStream(keystore), "passwd".toCharArray());
-
+
Certificate cert = keyStore.getCertificate("importkey");
KeyStore.PrivateKeyEntry pkEntry = (KeyStore.PrivateKeyEntry)
keyStore.getEntry("importkey", new KeyStore.PasswordProtection("passwd".toCharArray()));
PrivateKey rsaKey = pkEntry.getPrivateKey();
-
- String filename =
+
+ String filename =
"src/test/resources/org/w3c/www/interop/xmlenc-core-11/"
+ "cipherText__RSA-4096__aes256-gcm__rsa-oaep__Sha512-MGF_Sha1_PSource.xml";
@@ -490,18 +490,18 @@ public class XMLEncryption11Test extends
@org.junit.Test
public void testKeyWrappingRSA4096EncryptDecrypt() throws Exception {
if (haveISOPadding) {
- String keystore =
+ String keystore =
"src/test/resources/org/w3c/www/interop/xmlenc-core-11/RSA-4096_SHA256WithRSA.jks";
String basedir = System.getProperty("basedir");
if (basedir != null && !"".equals(basedir)) {
keystore = basedir + "/" + keystore;
}
-
+
KeyStore keyStore = KeyStore.getInstance("jks");
keyStore.load(new java.io.FileInputStream(keystore), "passwd".toCharArray());
-
+
Certificate cert = keyStore.getCertificate("importkey");
-
+
KeyStore.PrivateKeyEntry pkEntry = (KeyStore.PrivateKeyEntry)
keyStore.getEntry("importkey", new KeyStore.PasswordProtection("passwd".toCharArray()));
PrivateKey rsaKey = pkEntry.getPrivateKey();
@@ -517,9 +517,9 @@ public class XMLEncryption11Test extends
Document doc = db.parse(new java.io.FileInputStream(f));
Key sessionKey = getSessionKey("http://www.w3.org/2009/xmlenc11#aes256-gcm");
- EncryptedKey encryptedKey =
+ EncryptedKey encryptedKey =
createEncryptedKey(
- doc,
+ doc,
(X509Certificate)cert,
sessionKey,
"http://www.w3.org/2009/xmlenc11#rsa-oaep",
@@ -527,16 +527,16 @@ public class XMLEncryption11Test extends
"http://www.w3.org/2009/xmlenc11#mgf1sha1",
Base64.decode("ZHVtbXkxMjM=".getBytes("UTF-8"))
);
-
- doc =
+
+ doc =
encryptDocument(
- doc,
+ doc,
encryptedKey,
- sessionKey,
+ sessionKey,
"http://www.w3.org/2009/xmlenc11#aes256-gcm"
);
// XMLUtils.outputDOM(doc.getFirstChild(), System.out);
-
+
// Perform decryption
Document dd = decryptElement(doc, rsaKey, (X509Certificate)cert);
// XMLUtils.outputDOM(dd.getFirstChild(), System.out);
@@ -548,7 +548,7 @@ public class XMLEncryption11Test extends
);
}
}
-
+
/**
* Method decryptElement
*
@@ -568,10 +568,10 @@ public class XMLEncryption11Test extends
DocumentBuilder db = XMLUtils.createDocumentBuilder(false);
Document doc = db.parse(new java.io.FileInputStream(f));
-
+
return decryptElement(doc, rsaKey, rsaCert);
}
-
+
/**
* Method decryptElement
*
@@ -584,15 +584,15 @@ public class XMLEncryption11Test extends
private Document decryptElement(Document doc, Key rsaKey, X509Certificate rsaCert) throws Exception {
// Create the XMLCipher element
XMLCipher cipher = XMLCipher.getInstance();
-
+
// Need to pre-load the Encrypted Data so we can get the key info
- Element ee =
+ Element ee =
(Element) doc.getElementsByTagNameNS(
"http://www.w3.org/2001/04/xmlenc#", "EncryptedData"
).item(0);
cipher.init(XMLCipher.DECRYPT_MODE, null);
EncryptedData encryptedData = cipher.loadEncryptedData(doc, ee);
-
+
KeyInfo ki = encryptedData.getKeyInfo();
EncryptedKey encryptedKey = ki.itemEncryptedKey(0);
KeyInfo kiek = encryptedKey.getKeyInfo();
@@ -600,10 +600,10 @@ public class XMLEncryption11Test extends
XMLX509Certificate xcert = certData.itemCertificate(0);
X509Certificate cert = xcert.getX509Certificate();
assertTrue(rsaCert.equals(cert));
-
+
XMLCipher cipher2 = XMLCipher.getInstance();
cipher2.init(XMLCipher.UNWRAP_MODE, rsaKey);
- Key key =
+ Key key =
cipher2.decryptKey(
encryptedKey, encryptedData.getEncryptionMethod().getAlgorithm()
);
@@ -628,10 +628,10 @@ public class XMLEncryption11Test extends
) throws Exception {
// Create the XMLCipher element
XMLCipher cipher = XMLCipher.getInstance(encryptionMethod, null, digestMethod);
-
+
cipher.init(XMLCipher.WRAP_MODE, rsaCert.getPublicKey());
EncryptedKey encryptedKey = cipher.encryptKey(doc, sessionKey, mgfAlgorithm, oaepParams);
-
+
KeyInfo builderKeyInfo = encryptedKey.getKeyInfo();
if (builderKeyInfo == null) {
builderKeyInfo = new KeyInfo(doc);
@@ -641,10 +641,10 @@ public class XMLEncryption11Test extends
X509Data x509Data = new X509Data(doc);
x509Data.addCertificate(rsaCert);
builderKeyInfo.add(x509Data);
-
+
return encryptedKey;
}
-
+
/**
* Generate a session key using the given algorithm
*/
@@ -660,7 +660,7 @@ public class XMLEncryption11Test extends
}
return keyGen.generateKey();
}
-
+
/**
* Encrypt a Document using the given parameters.
*/
@@ -672,7 +672,7 @@ public class XMLEncryption11Test extends
) throws Exception {
// Create the XMLCipher element
XMLCipher cipher = XMLCipher.getInstance(encryptionMethod);
-
+
cipher.init(XMLCipher.ENCRYPT_MODE, sessionKey);
EncryptedData builder = cipher.getEncryptedData();
@@ -683,11 +683,11 @@ public class XMLEncryption11Test extends
}
builderKeyInfo.add(encryptedKey);
-
+
return cipher.doFinal(doc, doc.getDocumentElement());
}
-
+
/**
* Method countNodes
*
@@ -711,7 +711,7 @@ public class XMLEncryption11Test extends
return count;
}
-
+
/**
* Method retrieveCCNumber
*
@@ -719,12 +719,12 @@ public class XMLEncryption11Test extends
*
* @param doc The document to retrieve the card number from
* @return The retrieved credit card number
- * @throws XPathExpressionException
+ * @throws XPathExpressionException
*/
- private static String retrieveCCNumber(Document doc)
- throws javax.xml.transform.TransformerException,
+ private static String retrieveCCNumber(Document doc)
+ throws javax.xml.transform.TransformerException,
XPathExpressionException {
-
+
XPathFactory xpf = XPathFactory.newInstance();
XPath xpath = xpf.newXPath();
Map<String, String> namespace = new HashMap<String, String>();
@@ -733,7 +733,7 @@ public class XMLEncryption11Test extends
xpath.setNamespaceContext(context);
String expression = "//x:Number/text()";
- Node ccnumElt =
+ Node ccnumElt =
(Node) xpath.evaluate(expression, doc, XPathConstants.NODE);
if (ccnumElt != null) {
@@ -758,7 +758,7 @@ public class XMLEncryption11Test extends
int myNodeCount = countNodes(d);
assertTrue(
- "Node count mismatches",
+ "Node count mismatches",
((myNodeCount > 0) && myNodeCount == nodeCount)
);
}
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/interop/IAIKTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/interop/IAIKTest.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/interop/IAIKTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/interop/IAIKTest.java Tue Dec 15 17:13:17 2015
@@ -38,7 +38,7 @@ public class IAIKTest extends InteropTes
/** Field gregorsDir */
static String gregorsDir = "src/test/resources/at/iaik/ixsil/";
-
+
static {
String basedir = System.getProperty("basedir");
if (basedir != null && !"".equals(basedir)) {
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/interop/IBMTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/interop/IBMTest.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/interop/IBMTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/interop/IBMTest.java Tue Dec 15 17:13:17 2015
@@ -51,11 +51,11 @@ public class IBMTest extends InteropTest
/** Field kentsDir */
static final String kentsDir = "data/com/ibm/xss4j-20030127/";
-
+
static {
org.apache.xml.security.Init.init();
}
-
+
private boolean runTests = false;
/**
@@ -330,5 +330,5 @@ public class IBMTest extends InteropTest
public void _not_active_test_enveloping_exclusive_soaped() throws Exception {
// exclusive c14n not supported yet
}
-
+
}
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/interop/InteropTestBase.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/interop/InteropTestBase.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/interop/InteropTestBase.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/interop/InteropTestBase.java Tue Dec 15 17:13:17 2015
@@ -60,13 +60,13 @@ public class InteropTestBase extends org
File f = new File(filename);
javax.xml.parsers.DocumentBuilder db = XMLUtils.createDocumentBuilder(false, false);
org.w3c.dom.Document doc = db.parse(new java.io.FileInputStream(f));
-
+
XPathFactory xpf = XPathFactory.newInstance();
XPath xpath = xpf.newXPath();
xpath.setNamespaceContext(new DSNamespaceContext());
String expression = "//ds:Signature[1]";
- Element sigElement =
+ Element sigElement =
(Element) xpath.evaluate(expression, doc, XPathConstants.NODE);
XMLSignature signature = new XMLSignature(sigElement, f.toURI().toURL().toString());
@@ -94,13 +94,13 @@ public class InteropTestBase extends org
File f = new File(filename);
javax.xml.parsers.DocumentBuilder db = XMLUtils.createDocumentBuilder(false, false);
org.w3c.dom.Document doc = db.parse(f);
-
+
XPathFactory xpf = XPathFactory.newInstance();
XPath xpath = xpf.newXPath();
xpath.setNamespaceContext(new DSNamespaceContext());
String expression = "//ds:Signature[1]";
- Element sigElement =
+ Element sigElement =
(Element) xpath.evaluate(expression, doc, XPathConstants.NODE);
XMLSignature signature = new XMLSignature(sigElement, f.toURI().toURL().toString());
@@ -134,12 +134,12 @@ public class InteropTestBase extends org
if (!result) {
for (int i = 0; i < signature.getSignedInfo().getLength(); i++) {
boolean refVerify =
- signature.getSignedInfo().getVerificationResult(i);
+ signature.getSignedInfo().getVerificationResult(i);
if (refVerify) {
log.debug("Reference " + i + " was OK");
} else {
- // JavaUtils.writeBytesToFilename(filename + i + ".apache.txt", signature.getSignedInfo().item(i).getContentsAfterTransformation().getBytes());
+ // JavaUtils.writeBytesToFilename(filename + i + ".apache.txt", signature.getSignedInfo().item(i).getContentsAfterTransformation().getBytes());
log.debug("Reference " + i + " was not OK");
}
}
@@ -149,7 +149,7 @@ public class InteropTestBase extends org
return result;
}
-
+
private void checkReferences(XMLSignature xmlSignature) throws Exception {
SignedInfo signedInfo = xmlSignature.getSignedInfo();
assertTrue(signedInfo.getLength() > 0);
@@ -158,7 +158,7 @@ public class InteropTestBase extends org
assertNotNull(reference);
ReferenceData referenceData = reference.getReferenceData();
assertNotNull(referenceData);
-
+
if (referenceData instanceof ReferenceNodeSetData) {
Iterator<Node> iter = ((ReferenceNodeSetData)referenceData).iterator();
assertTrue(iter.hasNext());
@@ -176,5 +176,5 @@ public class InteropTestBase extends org
}
}
}
-
+
}
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/keys/DEREncodedKeyValueTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/keys/DEREncodedKeyValueTest.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/keys/DEREncodedKeyValueTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/keys/DEREncodedKeyValueTest.java Tue Dec 15 17:13:17 2015
@@ -55,8 +55,8 @@ public class DEREncodedKeyValueTest exte
documentBuilder = XMLUtils.createDocumentBuilder(false);
//
- // If the BouncyCastle provider is not installed, then try to load it
- // via reflection.
+ // If the BouncyCastle provider is not installed, then try to load it
+ // via reflection.
//
if (Security.getProvider("BC") == null) {
Constructor<?> cons = null;
@@ -174,8 +174,8 @@ public class DEREncodedKeyValueTest exte
// Utility methods
private String getControlFilePath(String fileName) {
- return BASEDIR + SEP + "src" + SEP + "test" + SEP + "resources" +
- SEP + "org" + SEP + "apache" + SEP + "xml" + SEP + "security" +
+ return BASEDIR + SEP + "src" + SEP + "test" + SEP + "resources" +
+ SEP + "org" + SEP + "apache" + SEP + "xml" + SEP + "security" +
SEP + "keys" + SEP + "content" +
SEP + fileName;
}
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/keys/KeyInfoReferenceTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/keys/KeyInfoReferenceTest.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/keys/KeyInfoReferenceTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/keys/KeyInfoReferenceTest.java Tue Dec 15 17:13:17 2015
@@ -88,8 +88,8 @@ public class KeyInfoReferenceTest extend
// Utility methods
private String getControlFilePath(String fileName) {
- return BASEDIR + SEP + "src" + SEP + "test" + SEP + "resources" +
- SEP + "org" + SEP + "apache" + SEP + "xml" + SEP + "security" +
+ return BASEDIR + SEP + "src" + SEP + "test" + SEP + "resources" +
+ SEP + "org" + SEP + "apache" + SEP + "xml" + SEP + "security" +
SEP + "keys" + SEP + "content" +
SEP + fileName;
}
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/keys/content/x509/XMLX509CertificateTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/keys/content/x509/XMLX509CertificateTest.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/keys/content/x509/XMLX509CertificateTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/keys/content/x509/XMLX509CertificateTest.java Tue Dec 15 17:13:17 2015
@@ -49,10 +49,10 @@ public class XMLX509CertificateTest exte
Document doc = XMLUtils.createDocumentBuilder(false).parse(fis);
NodeList nl = doc.getElementsByTagNameNS
(Constants.SignatureSpecNS, "X509Certificate");
- XMLX509Certificate xmlCert =
+ XMLX509Certificate xmlCert =
new XMLX509Certificate((Element) nl.item(0), "");
xmlCert.getX509Certificate();
// System.out.println(cert);
}
-
+
}
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/keys/content/x509/XMLX509DigestTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/keys/content/x509/XMLX509DigestTest.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/keys/content/x509/XMLX509DigestTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/keys/content/x509/XMLX509DigestTest.java Tue Dec 15 17:13:17 2015
@@ -103,8 +103,8 @@ public class XMLX509DigestTest extends A
// Utility methods
private String getControlFilePath(String fileName) {
- return BASEDIR + SEP + "src" + SEP + "test" + SEP + "resources" +
- SEP + "org" + SEP + "apache" + SEP + "xml" + SEP + "security" +
+ return BASEDIR + SEP + "src" + SEP + "test" + SEP + "resources" +
+ SEP + "org" + SEP + "apache" + SEP + "xml" + SEP + "security" +
SEP + "keys" + SEP + "content" + SEP + "x509" +
SEP + fileName;
}