summaryrefslogtreecommitdiff
path: root/xmlsecurity
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2018-09-18 09:59:08 +0200
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2018-09-19 07:55:17 +0200
commitc3de0478fbcbe1dc22ab5dea42b423bb8e45fcba (patch)
treeb5e4d4c6ff9457e1046cbfccf21774e87524c727 /xmlsecurity
parent02ae1077f118dc9d287913d99528de58f69852ce (diff)
tdf#118567 Signature Line: Fix ooxml signing
Change-Id: Ie2467db7ab209f10e92b6db1f5680e7a9be614ab Reviewed-on: https://gerrit.libreoffice.org/60676 Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'xmlsecurity')
-rw-r--r--xmlsecurity/inc/documentsignaturehelper.hxx3
-rw-r--r--xmlsecurity/source/helper/documentsignaturehelper.cxx10
-rw-r--r--xmlsecurity/source/helper/ooxmlsecexporter.cxx6
-rw-r--r--xmlsecurity/source/helper/xsecctl.cxx2
4 files changed, 11 insertions, 10 deletions
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" );
}