summaryrefslogtreecommitdiff
path: root/xmloff/source/text/XMLSectionExport.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'xmloff/source/text/XMLSectionExport.cxx')
-rw-r--r--xmloff/source/text/XMLSectionExport.cxx8
1 files changed, 8 insertions, 0 deletions
diff --git a/xmloff/source/text/XMLSectionExport.cxx b/xmloff/source/text/XMLSectionExport.cxx
index e6a6875244c2..46189a119ca7 100644
--- a/xmloff/source/text/XMLSectionExport.cxx
+++ b/xmloff/source/text/XMLSectionExport.cxx
@@ -398,8 +398,16 @@ void XMLSectionExport::ExportRegularSectionStart(
{
OUStringBuffer aBuffer;
::sax::Converter::encodeBase64(aBuffer, aPassword);
+ // in ODF 1.0/1.1 the algorithm was left unspecified so we can write anything
GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_PROTECTION_KEY,
aBuffer.makeStringAndClear());
+ if (aPassword.getLength() == 32 && GetExport().getDefaultVersion() >= SvtSaveOptions::ODFVER_012)
+ {
+ // attribute exists in ODF 1.2 or later; default is SHA1 so no need to write that
+ GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_PROTECTION_KEY_DIGEST_ALGORITHM,
+ // write the URL from ODF 1.2, not the W3C one
+ "http://www.w3.org/2000/09/xmldsig#sha256");
+ }
}
// export element