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 2011/11/01 10:40:45 UTC
svn commit: r1195896 - in /santuario/xml-security-java/branches/1.4.x-fixes:
CHANGELOG.txt
src_unitTests/org/apache/xml/security/test/c14n/implementations/Santuario273Test.java
Author: coheigea
Date: Tue Nov 1 09:40:45 2011
New Revision: 1195896
URL: http://svn.apache.org/viewvc?rev=1195896&view=rev
Log:
[SANTUARIO-286] - Test case Santuario273.testC14n11Base() tests for a side-effect of canonicalization, rather than the desired effect
Modified:
santuario/xml-security-java/branches/1.4.x-fixes/CHANGELOG.txt
santuario/xml-security-java/branches/1.4.x-fixes/src_unitTests/org/apache/xml/security/test/c14n/implementations/Santuario273Test.java
Modified: santuario/xml-security-java/branches/1.4.x-fixes/CHANGELOG.txt
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/1.4.x-fixes/CHANGELOG.txt?rev=1195896&r1=1195895&r2=1195896&view=diff
==============================================================================
--- santuario/xml-security-java/branches/1.4.x-fixes/CHANGELOG.txt (original)
+++ santuario/xml-security-java/branches/1.4.x-fixes/CHANGELOG.txt Tue Nov 1 09:40:45 2011
@@ -1,6 +1,7 @@
Changelog for "Apache xml-security" <http://santuario.apache.org/>
New in v.1.4.7-SNAPSHOT:
+ Fixed SANTUARIO-286: Test case Santuario273.testC14n11Base() tests for a side-effect of canonicalization, rather than the desired effect.
New in v.1.4.6
Fixed SANTUARIO-284: ElementProxy#getTextFromChildElement() doesn't get all of the text if the element contains an entity like &
Modified: santuario/xml-security-java/branches/1.4.x-fixes/src_unitTests/org/apache/xml/security/test/c14n/implementations/Santuario273Test.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/1.4.x-fixes/src_unitTests/org/apache/xml/security/test/c14n/implementations/Santuario273Test.java?rev=1195896&r1=1195895&r2=1195896&view=diff
==============================================================================
--- santuario/xml-security-java/branches/1.4.x-fixes/src_unitTests/org/apache/xml/security/test/c14n/implementations/Santuario273Test.java (original)
+++ santuario/xml-security-java/branches/1.4.x-fixes/src_unitTests/org/apache/xml/security/test/c14n/implementations/Santuario273Test.java Tue Nov 1 09:40:45 2011
@@ -45,7 +45,7 @@ import org.w3c.dom.Node;
* "xml:base attribute not processed correctly in C14N11 canonicalization"
*/
public class Santuario273Test extends TestCase {
- static String input = ""
+ public static String input = ""
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<Signature xmlns=\"http://www.w3.org/2000/09/xmldsig#\" xml:base=\"http://www.acme.com/resources/\">\n"
+ " <SignedInfo xml:base=\"subresources/\"><!-- comment inside -->\n"
@@ -67,6 +67,15 @@ public class Santuario273Test extends Te
+ "</Signature>\n"
;
+ public final static 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"
+ + " <Reference URI=\"http://www.w3.org/TR/xml-stylesheet\">\n"
+ + " <DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\"></DigestMethod>\n"
+ + " <DigestValue>60NvZvtdTB+7UnlLp/H24p7h4bs=</DigestValue>\n"
+ + " </Reference>\n"
+ + " </SignedInfo>";
+
static {
Init.init();
}
@@ -91,21 +100,9 @@ public class Santuario273Test extends Te
Element nscontext = createDSctx(doc, "ds", Constants.SignatureSpecNS);
Node signedInfo = XPathAPI.selectSingleNode(doc, "//ds:SignedInfo", nscontext);
- c14n.canonicalizeSubtree(signedInfo);
+ byte[] output = c14n.canonicalizeSubtree(signedInfo);
- NamedNodeMap attributes = signedInfo.getAttributes();
- boolean foundBase = false;
- for (int i = 0; i < attributes.getLength(); i++) {
- Node attribute = attributes.item(i);
- if ("base".equals(attribute.getLocalName())
- && "http://www.acme.com/resources/subresources/".equals(attribute.getNodeValue())) {
- foundBase = true;
- break;
- }
- }
- if (!foundBase) {
- fail("The base attribute was not found or was incorrect");
- }
+ assertEquals(new String(output, "UTF-8"), expectedResult);
}
/**