diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2024-01-08 19:44:50 +0100 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2024-01-09 14:30:42 +0100 |
commit | 2184692bbe69a093368e959e1096cb7506feceee (patch) | |
tree | def8a14710198156545bf3fc8ba0bb6a6e7f29b5 /xmloff | |
parent | e1abdcef4404c2a1b8d6d87ae295451a457aeae4 (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>
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)); } } |