package/source/manifest/ManifestExport.cxx | 9 ++++++++- package/source/zippackage/ZipPackage.cxx | 1 + 2 files changed, 9 insertions(+), 1 deletion(-)
New commits: commit a44a6ab7a51f35997a5a4d0b12cd0c8eae421397 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Thu Dec 14 11:51:37 2023 +0100 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Thu Dec 14 15:41:08 2023 +0100 OFFICE-3708: package: produce correct SHA256 URL Old versions of LO or other consumers can't read wholesome ODF encrypted documents anyway, so start using the correct W3C SHA256 URL (see commit 1015d35f2362953f415804476037d4f162eb49b5). Change-Id: Id82ab2c9f605eb2084ff01a26e8186223dd46763 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160764 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/package/source/manifest/ManifestExport.cxx b/package/source/manifest/ManifestExport.cxx index cf60614ccd58..a15ae0118277 100644 --- a/package/source/manifest/ManifestExport.cxx +++ b/package/source/manifest/ManifestExport.cxx @@ -453,7 +453,14 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con *pStartKeyAlg >>= nStartKeyAlgID; if ( nStartKeyAlgID == xml::crypto::DigestID::SHA256 ) { - sStartKeyAlg = sSHA256_URL_ODF12; // TODO use SHA256_URL + if (nEncAlgID == xml::crypto::CipherID::AES_GCM_W3C) + { // new encryption is incompatible anyway, use W3C URL + sStartKeyAlg = SHA256_URL; + } + else // to interop with ODF <= 1.4 consumers use bad ODF URL + { + sStartKeyAlg = sSHA256_URL_ODF12; + } aBuffer.append( sal_Int32(32) ); sStartKeySize = aBuffer.makeStringAndClear(); } diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index f95731f368d1..459b998de79d 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -1801,6 +1801,7 @@ void SAL_CALL ZipPackage::setPropertyValue( const OUString& aPropertyName, const // override algorithm defaults (which are some legacy ODF // defaults) with reasonable values + // note: these should be overridden by SfxObjectShell::SetupStorage() m_nStartKeyGenerationID = 0; // this is unused for PGP m_nCommonEncryptionID = xml::crypto::CipherID::AES_CBC_W3C_PADDING; m_oChecksumDigestID.emplace(xml::crypto::DigestID::SHA512_1K);