Make wholesome ODF package encryption the default

Change-Id: I825ae7a5e4b80d390804a7bb2cfdfc3b1843bd07
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162066
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
This commit is contained in:
Thorsten Behrens
2024-01-23 21:41:03 +01:00
parent ac1cafad39
commit d0dcd87788
2 changed files with 31 additions and 30 deletions
+1 -2
View File
@@ -170,8 +170,7 @@ bool SfxObjectShell::QuerySlotExecutable( sal_uInt16 /*nSlotId*/ )
static bool UseODFWholesomeEncryption(SvtSaveOptions::ODFSaneDefaultVersion const nODFVersion)
{
return nODFVersion == SvtSaveOptions::ODFSVER_LATEST_EXTENDED
&& officecfg::Office::Common::Misc::ExperimentalMode::get();
return nODFVersion == SvtSaveOptions::ODFSVER_LATEST_EXTENDED;
}
bool GetEncryptionData_Impl( const SfxItemSet* pSet, uno::Sequence< beans::NamedValue >& o_rEncryptionData )
+30 -28
View File
@@ -128,9 +128,21 @@ CPPUNIT_TEST_FIXTURE(SigningTest2, testPasswordPreserveMacroSignatureODF13)
CPPUNIT_ASSERT_EQUAL(SignatureState::OK, pObjectShell->GetScriptingSignatureState());
}
saveAndReload("writer8", "password");
{
// test standard ODF 1.2/1.3/1.4 encryption
// test the old, standard ODF 1.2/1.3/1.4 encryption
Resetter resetter([]() {
std::shared_ptr<comphelper::ConfigurationChanges> pBatch(
comphelper::ConfigurationChanges::create());
officecfg::Office::Common::Save::ODF::DefaultVersion::set(3, pBatch);
return pBatch->commit();
});
std::shared_ptr<comphelper::ConfigurationChanges> pBatch(
comphelper::ConfigurationChanges::create());
officecfg::Office::Common::Save::ODF::DefaultVersion::set(10, pBatch);
pBatch->commit();
saveAndReload("writer8", "password");
xmlDocUniquePtr pXmlDoc = parseExport("META-INF/manifest.xml");
assertXPath(pXmlDoc, "/manifest:manifest"_ostr, "version"_ostr, "1.3");
assertXPath(pXmlDoc, "/manifest:manifest/manifest:file-entry[@manifest:size != '0']"_ostr,
@@ -174,18 +186,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest2, testPasswordPreserveMacroSignatureODF13)
}
{
Resetter resetter([]() {
std::shared_ptr<comphelper::ConfigurationChanges> pBatch(
comphelper::ConfigurationChanges::create());
officecfg::Office::Common::Misc::ExperimentalMode::set(false, pBatch);
return pBatch->commit();
});
std::shared_ptr<comphelper::ConfigurationChanges> pBatch(
comphelper::ConfigurationChanges::create());
officecfg::Office::Common::Misc::ExperimentalMode::set(true, pBatch);
pBatch->commit();
// store it experimental - reload
// store it with new wholesome ODF extended encryption - reload
saveAndReload("writer8", "password");
// test wholesome ODF extended encryption
@@ -253,18 +254,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest2, testPasswordPreserveMacroSignatureODFWholesom
}
{
Resetter resetter([]() {
std::shared_ptr<comphelper::ConfigurationChanges> pBatch(
comphelper::ConfigurationChanges::create());
officecfg::Office::Common::Misc::ExperimentalMode::set(false, pBatch);
return pBatch->commit();
});
std::shared_ptr<comphelper::ConfigurationChanges> pBatch(
comphelper::ConfigurationChanges::create());
officecfg::Office::Common::Misc::ExperimentalMode::set(true, pBatch);
pBatch->commit();
// store it experimental - reload
// store it with new wholesome ODF extended encryption - reload
saveAndReload("writer8", "password");
// test wholesome ODF extended encryption
@@ -321,9 +311,21 @@ CPPUNIT_TEST_FIXTURE(SigningTest2, testPasswordPreserveMacroSignatureODFWholesom
CPPUNIT_ASSERT_EQUAL(SignatureState::OK, pObjectShell->GetScriptingSignatureState());
}
saveAndReload("writer8", "password");
{
// test standard ODF 1.2/1.3/1.4 encryption
// test the old, standard ODF 1.2/1.3/1.4 encryption
Resetter resetter([]() {
std::shared_ptr<comphelper::ConfigurationChanges> pBatch(
comphelper::ConfigurationChanges::create());
officecfg::Office::Common::Save::ODF::DefaultVersion::set(3, pBatch);
return pBatch->commit();
});
std::shared_ptr<comphelper::ConfigurationChanges> pBatch(
comphelper::ConfigurationChanges::create());
officecfg::Office::Common::Save::ODF::DefaultVersion::set(10, pBatch);
pBatch->commit();
saveAndReload("writer8", "password");
xmlDocUniquePtr pXmlDoc = parseExport("META-INF/manifest.xml");
assertXPath(pXmlDoc, "/manifest:manifest"_ostr, "version"_ostr, "1.3");
assertXPath(pXmlDoc, "/manifest:manifest/manifest:file-entry[@manifest:size != '0']"_ostr,