diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2017-07-17 13:13:06 +0200 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2017-07-17 16:22:34 +0200 |
commit | 9127706ab39cd39da7a8b9a13acb553a77968890 (patch) | |
tree | 54e341d544bc28a91a52f4627d8a3af3aaed6231 /xmlsecurity | |
parent | cf0a9b9c7a988b74102bcdd38710fb9e80521081 (diff) |
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@libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'xmlsecurity')
-rw-r--r-- | xmlsecurity/inc/xmlsignaturehelper.hxx | 1 | ||||
-rw-r--r-- | xmlsecurity/source/helper/xmlsignaturehelper.cxx | 7 | ||||
-rw-r--r-- | xmlsecurity/source/helper/xsecctl.cxx | 4 |
3 files changed, 10 insertions, 2 deletions
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" ); } |