[jira] [Commented] (CAMEL-12181) XML Signature: '#' missing in ObjectReference attribute of XADES element DataObjectFormat

2018-02-01 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CAMEL-12181?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16348226#comment-16348226
 ] 

ASF GitHub Bot commented on CAMEL-12181:


davsclaus closed pull request #2203: CAMEL-12181: XML Signature: '#' missing in 
ObjectReference attribute 
URL: https://github.com/apache/camel/pull/2203
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

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 06ef1c7c9e3..da263dd9847 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 @@ protected String addDataObjectFormat(Element 
signedDataObjectProperties, Documen
 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 5a75256c0b0..eb64c1afd3c 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 void envelopingAllParameters() throws Exception {
 //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 @@ private void validateAgainstSchema(Document doc) throws 
Exception {
 
 static void checkXpath(Document doc, String xpathString, final Map prefix2Namespace, String expectedResult)
 throws XPathExpressionException {
+checkXpath(doc, xpathString, prefix2Namespace, expectedResult, false);
+}
+
+   static void checkXpath(Document doc, String xpathString, final Map 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);


 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> XML Signature: '#' missing in ObjectReference attribute of XADES element 
> DataObjectFormat
> -
>
> Key: CAMEL-12181
> URL: 

[jira] [Commented] (CAMEL-12181) XML Signature: '#' missing in ObjectReference attribute of XADES element DataObjectFormat

2018-02-01 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CAMEL-12181?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16348227#comment-16348227
 ] 

ASF GitHub Bot commented on CAMEL-12181:


Github user davsclaus closed the pull request at:

https://github.com/apache/camel/pull/2203


> XML Signature: '#' missing in ObjectReference attribute of XADES element 
> DataObjectFormat
> -
>
> Key: CAMEL-12181
> URL: https://issues.apache.org/jira/browse/CAMEL-12181
> Project: Camel
>  Issue Type: Bug
>  Components: camel-xmlsecurity
>Affects Versions: 2.18.5, 2.19.4, 2.20.1
>Reporter: Franz Forsthofer
>Assignee: Franz Forsthofer
>Priority: Major
> Fix For: 2.19.5, 2.20.3, 2.21.0
>
>
> If you create an XML Signature with a XADES element DataObjectFormat then you 
> get currently an XML which is similar as shown in the following snippet:
>  URI="#_4dccda23-2c67-487b-b7f2-30188bb089f7">
> ...
>  
> ...
> {color:#00} ObjectReference="_1a612e6b-0da6-4695-a8f7-d189a47a7e05">{color}
> {color:#00}    …{color}
> {color:#00}{color}
>  
> {color:#00}The ObjectReference value 
> "_1a612e6b-0da6-4695-a8f7-d189a47a7e05" is not a valid URI. The  character 
> '#' is missing at the beginning of the value{color}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CAMEL-12181) XML Signature: '#' missing in ObjectReference attribute of XADES element DataObjectFormat

2018-01-30 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CAMEL-12181?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16346340#comment-16346340
 ] 

ASF GitHub Bot commented on CAMEL-12181:


GitHub user forsthofer opened a pull request:

https://github.com/apache/camel/pull/2203

CAMEL-12181: XML Signature: '#' missing in ObjectReference attribute 

of XADES element DataObjectFormat

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/forsthofer/camel CAMEL-12181

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/camel/pull/2203.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #2203


commit e983854ebae91beabaf6b6c969bc76a53692d14d
Author: Franz Forsthofer 
Date:   2018-01-31T06:56:23Z

CAMEL-12181: XML Signature: '#' missing in ObjectReference attribute of
XADES element DataObjectFormat




> XML Signature: '#' missing in ObjectReference attribute of XADES element 
> DataObjectFormat
> -
>
> Key: CAMEL-12181
> URL: https://issues.apache.org/jira/browse/CAMEL-12181
> Project: Camel
>  Issue Type: Bug
>  Components: camel-xmlsecurity
>Affects Versions: 2.18.5, 2.19.4, 2.20.1
>Reporter: Franz Forsthofer
>Assignee: Franz Forsthofer
>Priority: Major
> Fix For: 2.19.5, 2.20.3, 2.21.0
>
>
> If you create an XML Signature with a XADES element DataObjectFormat then you 
> get currently an XML which is similar as shown in the following snippet:
>  URI="#_4dccda23-2c67-487b-b7f2-30188bb089f7">
> ...
>  
> ...
> {color:#00} ObjectReference="_1a612e6b-0da6-4695-a8f7-d189a47a7e05">{color}
> {color:#00}    …{color}
> {color:#00}{color}
>  
> {color:#00}The ObjectReference value 
> "_1a612e6b-0da6-4695-a8f7-d189a47a7e05" is not a valid URI. The  character 
> '#' is missing at the beginning of the value{color}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)