xmlsecurity/inc/documentsignaturehelper.hxx           |    3 ++-
 xmlsecurity/source/helper/documentsignaturehelper.cxx |   10 +++++-----
 xmlsecurity/source/helper/ooxmlsecexporter.cxx        |    6 +++---
 xmlsecurity/source/helper/xsecctl.cxx                 |    2 +-
 4 files changed, 11 insertions(+), 10 deletions(-)

New commits:
commit 59cdc0023f2429be6fe25f4570e07fd81a8f5d00
Author:     Samuel Mehrbrodt <samuel.mehrbr...@cib.de>
AuthorDate: Tue Sep 18 09:59:08 2018 +0200
Commit:     Thorsten Behrens <thorsten.behr...@cib.de>
CommitDate: Thu Sep 20 01:54:01 2018 +0200

    tdf#118567 Signature Line: Fix ooxml signing
    
    Change-Id: Ie2467db7ab209f10e92b6db1f5680e7a9be614ab
    Reviewed-on: https://gerrit.libreoffice.org/60676
    Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@cib.de>
    Tested-by: Samuel Mehrbrodt <samuel.mehrbr...@cib.de>
    (cherry picked from commit c3de0478fbcbe1dc22ab5dea42b423bb8e45fcba)
    Reviewed-on: https://gerrit.libreoffice.org/60735
    Tested-by: Jenkins
    Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de>

diff --git a/xmlsecurity/inc/documentsignaturehelper.hxx 
b/xmlsecurity/inc/documentsignaturehelper.hxx
index 1c5d1b97a972..bacef66746cd 100644
--- a/xmlsecurity/inc/documentsignaturehelper.hxx
+++ b/xmlsecurity/inc/documentsignaturehelper.hxx
@@ -102,7 +102,8 @@ namespace DocumentSignatureHelper
     void writeSignedProperties(
         const css::uno::Reference<css::xml::sax::XDocumentHandler>& 
xDocumentHandler,
         const SignatureInformation& signatureInfo,
-        const OUString& sDate);
+        const OUString& sDate,
+        const bool bWriteSignatureLineData);
 };
 
 #endif // INCLUDED_XMLSECURITY_INC_DOCUMENTSIGNATUREHELPER_HXX
diff --git a/xmlsecurity/source/helper/documentsignaturehelper.cxx 
b/xmlsecurity/source/helper/documentsignaturehelper.cxx
index 8bb06b84e92a..37342b536349 100644
--- a/xmlsecurity/source/helper/documentsignaturehelper.cxx
+++ b/xmlsecurity/source/helper/documentsignaturehelper.cxx
@@ -548,7 +548,7 @@ void DocumentSignatureHelper::writeDigestMethod(
 void DocumentSignatureHelper::writeSignedProperties(
     const uno::Reference<xml::sax::XDocumentHandler>& xDocumentHandler,
     const SignatureInformation& signatureInfo,
-    const OUString& sDate)
+    const OUString& sDate, const bool bWriteSignatureLineData)
 {
     {
         rtl::Reference<SvXMLAttributeList> pAttributeList(new 
SvXMLAttributeList());
@@ -587,8 +587,8 @@ void DocumentSignatureHelper::writeSignedProperties(
     xDocumentHandler->endElement("xd:SignaturePolicyImplied");
     xDocumentHandler->endElement("xd:SignaturePolicyIdentifier");
 
-    if (!signatureInfo.ouSignatureLineId.isEmpty() && 
signatureInfo.aValidSignatureImage.is()
-        && signatureInfo.aInvalidSignatureImage.is())
+    if (bWriteSignatureLineData && !signatureInfo.ouSignatureLineId.isEmpty()
+        && signatureInfo.aValidSignatureImage.is() && 
signatureInfo.aInvalidSignatureImage.is())
     {
         rtl::Reference<SvXMLAttributeList> pAttributeList(new 
SvXMLAttributeList());
         pAttributeList->AddAttribute(
@@ -607,7 +607,7 @@ void DocumentSignatureHelper::writeSignedProperties(
         }
 
         {
-            // Write SignatureLineId element
+            // Write SignatureLineValidImage element
             xDocumentHandler->startElement(
                 "loext:SignatureLineValidImage",
                 Reference<XAttributeList>(new SvXMLAttributeList()));
@@ -622,7 +622,7 @@ void DocumentSignatureHelper::writeSignedProperties(
         }
 
         {
-            // Write SignatureLineId element
+            // Write SignatureLineInvalidImage element
             xDocumentHandler->startElement(
                 "loext:SignatureLineInvalidImage",
                 Reference<XAttributeList>(new SvXMLAttributeList()));
diff --git a/xmlsecurity/source/helper/ooxmlsecexporter.cxx 
b/xmlsecurity/source/helper/ooxmlsecexporter.cxx
index 6f9b2eb946dc..08cf2788f554 100644
--- a/xmlsecurity/source/helper/ooxmlsecexporter.cxx
+++ b/xmlsecurity/source/helper/ooxmlsecexporter.cxx
@@ -353,9 +353,9 @@ void OOXMLSecExporter::Impl::writeSignatureInfo()
     pAttributeList->AddAttribute("xmlns", 
"http://schemas.microsoft.com/office/2006/digsig";);
     m_xDocumentHandler->startElement("SignatureInfoV1", 
uno::Reference<xml::sax::XAttributeList>(pAttributeList.get()));
 
-    m_xDocumentHandler->startElement("SetupId", 
uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
+    m_xDocumentHandler->startElement("SetupID", 
uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
     m_xDocumentHandler->characters(m_rInformation.ouSignatureLineId);
-    m_xDocumentHandler->endElement("SetupId");
+    m_xDocumentHandler->endElement("SetupID");
     m_xDocumentHandler->startElement("SignatureText", 
uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
     m_xDocumentHandler->endElement("SignatureText");
     m_xDocumentHandler->startElement("SignatureImage", 
uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
@@ -410,7 +410,7 @@ void OOXMLSecExporter::Impl::writePackageSignature()
         m_xDocumentHandler->startElement("xd:QualifyingProperties", 
uno::Reference<xml::sax::XAttributeList>(pAttributeList.get()));
     }
 
-    DocumentSignatureHelper::writeSignedProperties(m_xDocumentHandler, 
m_rInformation, m_aSignatureTimeValue);
+    DocumentSignatureHelper::writeSignedProperties(m_xDocumentHandler, 
m_rInformation, m_aSignatureTimeValue, false);
 
     m_xDocumentHandler->endElement("xd:QualifyingProperties");
     m_xDocumentHandler->endElement("Object");
diff --git a/xmlsecurity/source/helper/xsecctl.cxx 
b/xmlsecurity/source/helper/xsecctl.cxx
index c10e9f0d3c50..1d9906f27ed3 100644
--- a/xmlsecurity/source/helper/xsecctl.cxx
+++ b/xmlsecurity/source/helper/xsecctl.cxx
@@ -898,7 +898,7 @@ void XSecController::exportSignature(
                 xDocumentHandler->startElement(
                     "xd:QualifyingProperties",
                     cssu::Reference< cssxs::XAttributeList > (pAttributeList));
-                
DocumentSignatureHelper::writeSignedProperties(xDocumentHandler, signatureInfo, 
sDate);
+                
DocumentSignatureHelper::writeSignedProperties(xDocumentHandler, signatureInfo, 
sDate, true);
                 writeUnsignedProperties(xDocumentHandler, signatureInfo);
                 xDocumentHandler->endElement( "xd:QualifyingProperties" );
             }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to