Kaydet (Commit) 9127706a authored tarafından Samuel Mehrbrodt's avatar Samuel Mehrbrodt Kaydeden (comit) Thorsten Behrens

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/40058Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
üst cf0a9b9c
......@@ -96,6 +96,7 @@ private:
rtl::Reference<XSecController> mpXSecController;
bool mbError;
bool mbODFPre1_2;
bool mbHasGpgSignatures;
Link<LinkParamNone*,bool> maStartVerifySignatureHdl;
private:
......
......@@ -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",
......
......@@ -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" );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment