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

Samuel Mehrbrodt Samuel.Mehrbrodt at cib.de
Mon Jul 17 14:23:11 UTC 2017


 xmlsecurity/inc/xmlsignaturehelper.hxx           |    1 +
 xmlsecurity/source/helper/xmlsignaturehelper.cxx |    7 ++++++-
 xmlsecurity/source/helper/xsecctl.cxx            |    4 +++-
 3 files changed, 10 insertions(+), 2 deletions(-)

New commits:
commit 9127706ab39cd39da7a8b9a13acb553a77968890
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date:   Mon Jul 17 13:13:06 2017 +0200

    gpg4libre: Wrap PGPOwner in own namespace
    
    as recommended by W3C: https://www.w3.org/TR/xmldsig-core/#sec-PGPData
    
    Change-Id: I2cc0ae24eefc9137d2e3432da1d65e44245c7616
    Reviewed-on: https://gerrit.libreoffice.org/40058
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/xmlsecurity/inc/xmlsignaturehelper.hxx b/xmlsecurity/inc/xmlsignaturehelper.hxx
index d527942f50f2..2b2a82c413c8 100644
--- a/xmlsecurity/inc/xmlsignaturehelper.hxx
+++ b/xmlsecurity/inc/xmlsignaturehelper.hxx
@@ -96,6 +96,7 @@ private:
     rtl::Reference<XSecController> mpXSecController;
     bool                        mbError;
     bool mbODFPre1_2;
+    bool mbHasGpgSignatures;
     Link<LinkParamNone*,bool>   maStartVerifySignatureHdl;
 
 private:
diff --git a/xmlsecurity/source/helper/xmlsignaturehelper.cxx b/xmlsecurity/source/helper/xmlsignaturehelper.cxx
index c7841a5d5614..e9b5ff749aa4 100644
--- a/xmlsecurity/source/helper/xmlsignaturehelper.cxx
+++ b/xmlsecurity/source/helper/xmlsignaturehelper.cxx
@@ -51,6 +51,7 @@
 
 #define NS_DOCUMENTSIGNATURES   "http://openoffice.org/2004/documentsignatures"
 #define NS_DOCUMENTSIGNATURES_ODF_1_2 "urn:oasis:names:tc:opendocument:xmlns:digitalsignature:1.0"
+#define NS_DOCUMENTSIGNATURES_LOEXT "urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 #define OOXML_SIGNATURE_ORIGIN "http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/origin"
 #define OOXML_SIGNATURE_SIGNATURE "http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/signature"
 
@@ -58,7 +59,7 @@ using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
 
 XMLSignatureHelper::XMLSignatureHelper( const uno::Reference< uno::XComponentContext >& rxCtx)
-    : mxCtx(rxCtx), mbODFPre1_2(false)
+    : mxCtx(rxCtx), mbODFPre1_2(false), mbHasGpgSignatures(false)
 {
     mpXSecController = new XSecController(rxCtx);
     mbError = false;
@@ -128,6 +129,7 @@ void XMLSignatureHelper::SetGpgCertificate(sal_Int32 nSecurityId,
                                            const OUString& ouGpgCert,
                                            const OUString& ouGpgOwner)
 {
+    mbHasGpgSignatures = true;
     mpXSecController->setGpgCertificate(
         nSecurityId,
         ouGpgCertDigest,
@@ -179,6 +181,9 @@ uno::Reference<xml::sax::XWriter> XMLSignatureHelper::CreateDocumentHandlerWithH
         "xmlns",
         sNamespace);
 
+    if (mbHasGpgSignatures)
+        pAttributeList->AddAttribute("xmlns:loext", NS_DOCUMENTSIGNATURES_LOEXT);
+
     xSaxWriter->startDocument();
     xSaxWriter->startElement(
         "document-signatures",
diff --git a/xmlsecurity/source/helper/xsecctl.cxx b/xmlsecurity/source/helper/xsecctl.cxx
index 0d92cb0f0b54..9902dd1ad24a 100644
--- a/xmlsecurity/source/helper/xsecctl.cxx
+++ b/xmlsecurity/source/helper/xsecctl.cxx
@@ -749,9 +749,11 @@ void XSecController::exportSignature(
                     }
 
                     /* Write PGPOwner element */
+                    pAttributeList = new SvXMLAttributeList();
+                    pAttributeList->AddAttribute("namespace", "loext");
                     xDocumentHandler->startElement(
                         "PGPOwner",
-                        cssu::Reference< cssxs::XAttributeList > (new SvXMLAttributeList()));
+                        cssu::Reference< cssxs::XAttributeList >(pAttributeList));
                     xDocumentHandler->characters( signatureInfo.ouGpgOwner );
                     xDocumentHandler->endElement( "PGPOwner" );
                 }


More information about the Libreoffice-commits mailing list