diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2024-01-08 19:44:50 +0100 |
---|---|---|
committer | Adolfo Jayme Barrientos <fitojb@ubuntu.com> | 2024-01-09 15:24:47 +0100 |
commit | beae9f2dd680cbd9552b8d65d9d12b39400bec08 (patch) | |
tree | 5b2ac383ec9b5f558d09a342c23d3873ac99ba72 /xmloff | |
parent | dcfb786e5dee09a2ee28df9a4c64e08fef6180f9 (diff) |
xmloff: ODF export: if there's no checksum, don't generate chaff
Change-Id: I2e1bb6ed33df327ebd797edeca7ee82b75c524b4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161800
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
(cherry picked from commit 2184692bbe69a093368e959e1096cb7506feceee)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161767
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/core/xmlexp.cxx | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index 9900fa4d86fe..bb7ef1cc695d 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -95,7 +95,7 @@ #include <com/sun/star/document/XDocumentProperties.hpp> #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> #include <com/sun/star/document/XMLOasisBasicExporter.hpp> -#include <com/sun/star/embed/XEncryptionProtectedSource2.hpp> +#include <com/sun/star/embed/XEncryptionProtectedStorage.hpp> #include <com/sun/star/document/XGraphicStorageHandler.hpp> #include <com/sun/star/rdf/XMetadatable.hpp> #include <RDFaExportHelper.hxx> @@ -1188,10 +1188,22 @@ lcl_AddGrddl(SvXMLExport const & rExport, const SvXMLExportFlags /*nExportMode*/ // note: the point of this is presumably to mitigate SHA/1k info leak of plain text void SvXMLExport::addChaffWhenEncryptedStorage() { - uno::Reference< embed::XEncryptionProtectedSource2 > xEncr(mpImpl->mxTargetStorage, uno::UNO_QUERY); + uno::Reference<embed::XEncryptionProtectedStorage> const xEncr(mpImpl->mxTargetStorage, uno::UNO_QUERY); if (xEncr.is() && xEncr->hasEncryptionData() && mxExtHandler.is()) { + uno::Sequence<beans::NamedValue> const algo(xEncr->getEncryptionAlgorithms()); + for (auto const& it : algo) + { + if (it.Name == "ChecksumAlgorithm") + { + if (!it.Value.hasValue()) + { + return; // no checksum => no chaff + } + break; + } + } mxExtHandler->comment(OStringToOUString(comphelper::xml::makeXMLChaff(), RTL_TEXTENCODING_ASCII_US)); } } |