[Libreoffice-commits] core.git: xmlsecurity/inc xmlsecurity/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Sep 19 05:55:41 UTC 2018


 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 c3de0478fbcbe1dc22ab5dea42b423bb8e45fcba
Author:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Tue Sep 18 09:59:08 2018 +0200
Commit:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Wed Sep 19 07:55:17 2018 +0200

    tdf#118567 Signature Line: Fix ooxml signing
    
    Change-Id: Ie2467db7ab209f10e92b6db1f5680e7a9be614ab
    Reviewed-on: https://gerrit.libreoffice.org/60676
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at 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 dc97143f0029..dc00cc18e626 100644
--- a/xmlsecurity/source/helper/documentsignaturehelper.cxx
+++ b/xmlsecurity/source/helper/documentsignaturehelper.cxx
@@ -515,7 +515,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());
@@ -554,8 +554,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(
@@ -574,7 +574,7 @@ void DocumentSignatureHelper::writeSignedProperties(
         }
 
         {
-            // Write SignatureLineId element
+            // Write SignatureLineValidImage element
             xDocumentHandler->startElement(
                 "loext:SignatureLineValidImage",
                 Reference<XAttributeList>(new SvXMLAttributeList()));
@@ -589,7 +589,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 5a3a8c293b0b..8e0df5927a37 100644
--- a/xmlsecurity/source/helper/ooxmlsecexporter.cxx
+++ b/xmlsecurity/source/helper/ooxmlsecexporter.cxx
@@ -359,9 +359,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()));
@@ -416,7 +416,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 0ab4c39528fb..f6d1f89b6a6b 100644
--- a/xmlsecurity/source/helper/xsecctl.cxx
+++ b/xmlsecurity/source/helper/xsecctl.cxx
@@ -906,7 +906,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" );
             }


More information about the Libreoffice-commits mailing list