This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new 42f6796  CAMEL-12181: XML Signature: '#' missing in ObjectReference 
attribute of XADES element DataObjectFormat
42f6796 is described below

commit 42f67963bfbcd48c4da143d040971e635ed9d868
Author: Franz Forsthofer <franz.forstho...@sap.com>
AuthorDate: Wed Jan 31 07:56:23 2018 +0100

    CAMEL-12181: XML Signature: '#' missing in ObjectReference attribute of
    XADES element DataObjectFormat
---
 .../component/xmlsecurity/api/XAdESSignatureProperties.java    |  2 +-
 .../component/xmlsecurity/XAdESSignaturePropertiesTest.java    | 10 +++++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git 
a/components/camel-xmlsecurity/src/main/java/org/apache/camel/component/xmlsecurity/api/XAdESSignatureProperties.java
 
b/components/camel-xmlsecurity/src/main/java/org/apache/camel/component/xmlsecurity/api/XAdESSignatureProperties.java
index 06ef1c7..da263dd 100644
--- 
a/components/camel-xmlsecurity/src/main/java/org/apache/camel/component/xmlsecurity/api/XAdESSignatureProperties.java
+++ 
b/components/camel-xmlsecurity/src/main/java/org/apache/camel/component/xmlsecurity/api/XAdESSignatureProperties.java
@@ -740,7 +740,7 @@ public class XAdESSignatureProperties implements 
XmlSignatureProperties {
         Element dataObjectFormat = createElement("DataObjectFormat", doc, 
input);
         signedDataObjectProperties.appendChild(dataObjectFormat);
         String contentReferenceId = "_" + UUID.randomUUID().toString();
-        setAttribute(dataObjectFormat, "ObjectReference", contentReferenceId);
+        setAttribute(dataObjectFormat, "ObjectReference", "#" + 
contentReferenceId);
 
         if (getDataObjectFormatDescription() != null && 
!getDataObjectFormatDescription().isEmpty()) {
             Element description = createElement("Description", doc, input);
diff --git 
a/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/XAdESSignaturePropertiesTest.java
 
b/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/XAdESSignaturePropertiesTest.java
index 5a75256..eb64c1a 100644
--- 
a/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/XAdESSignaturePropertiesTest.java
+++ 
b/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/XAdESSignaturePropertiesTest.java
@@ -223,6 +223,7 @@ public class XAdESSignaturePropertiesTest extends 
CamelTestSupport {
         //DataObjectFormat
         checkXpath(doc, pathToDataObjectProperties + 
"etsi:DataObjectFormat/etsi:Description/text()", prefix2Namespace, "invoice");
         checkXpath(doc, pathToDataObjectProperties + 
"etsi:DataObjectFormat/etsi:MimeType/text()", prefix2Namespace, "text/xml");
+        checkXpath(doc, pathToDataObjectProperties + 
"etsi:DataObjectFormat/@ObjectReference", prefix2Namespace, "#", true);
         checkXpath(doc, pathToDataObjectProperties + 
"etsi:DataObjectFormat/etsi:ObjectIdentifier/etsi:Identifier/text()",
                 prefix2Namespace, "1.2.840.113549.1.9.16.6.2");
         checkXpath(doc, pathToDataObjectProperties + 
"etsi:DataObjectFormat/etsi:ObjectIdentifier/etsi:Identifier/@Qualifier",
@@ -834,11 +835,18 @@ public class XAdESSignaturePropertiesTest extends 
CamelTestSupport {
 
     static void checkXpath(Document doc, String xpathString, final Map<String, 
String> prefix2Namespace, String expectedResult)
         throws XPathExpressionException {
+        checkXpath(doc, xpathString, prefix2Namespace, expectedResult, false);
+    }
+        
+   static void checkXpath(Document doc, String xpathString, final Map<String, 
String> prefix2Namespace, String expectedResult, boolean startsWith)
+            throws XPathExpressionException {
 
         XPathExpression expr = getXpath(xpathString, prefix2Namespace);
         String result = (String) expr.evaluate(doc, XPathConstants.STRING);
         assertNotNull("The xpath " + xpathString + " returned a null value", 
result);
-        if (NOT_EMPTY.equals(expectedResult)) {
+        if (startsWith) {
+            assertTrue(result.startsWith(expectedResult));
+        } else if (NOT_EMPTY.equals(expectedResult)) {
             assertTrue("Not empty result for xpath " + xpathString + " 
expected", !result.isEmpty());
         } else {
             assertEquals(expectedResult, result);

-- 
To stop receiving notification emails like this one, please contact
davscl...@apache.org.

Reply via email to