summaryrefslogtreecommitdiffstats
path: root/package/source/manifest
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--package/source/manifest/ManifestDefines.hxx9
-rw-r--r--package/source/manifest/ManifestImport.cxx25
-rw-r--r--package/source/manifest/ManifestImport.hxx1
3 files changed, 29 insertions, 6 deletions
diff --git a/package/source/manifest/ManifestDefines.hxx b/package/source/manifest/ManifestDefines.hxx
index dbe7b985b8..c2f5e2778a 100644
--- a/package/source/manifest/ManifestDefines.hxx
+++ b/package/source/manifest/ManifestDefines.hxx
@@ -70,9 +70,12 @@ inline constexpr OUString ELEMENT_KEY_DERIVATION = u"manifest:key-derivation"_us
inline constexpr OUString ATTRIBUTE_KEY_DERIVATION_NAME = u"manifest:key-derivation-name"_ustr;
inline constexpr OUString ATTRIBUTE_SALT = u"manifest:salt"_ustr;
inline constexpr OUString ATTRIBUTE_ITERATION_COUNT = u"manifest:iteration-count"_ustr;
-inline constexpr OUString ATTRIBUTE_ARGON2_T_LO= u"loext:argon2-iterations"_ustr;
-inline constexpr OUString ATTRIBUTE_ARGON2_M_LO= u"loext:argon2-memory"_ustr;
-inline constexpr OUString ATTRIBUTE_ARGON2_P_LO= u"loext:argon2-lanes"_ustr;
+inline constexpr OUString ATTRIBUTE_ARGON2_T = u"manifest:argon2-iterations"_ustr;
+inline constexpr OUString ATTRIBUTE_ARGON2_M = u"manifest:argon2-memory"_ustr;
+inline constexpr OUString ATTRIBUTE_ARGON2_P = u"manifest:argon2-lanes"_ustr;
+inline constexpr OUString ATTRIBUTE_ARGON2_T_LO = u"loext:argon2-iterations"_ustr;
+inline constexpr OUString ATTRIBUTE_ARGON2_M_LO = u"loext:argon2-memory"_ustr;
+inline constexpr OUString ATTRIBUTE_ARGON2_P_LO = u"loext:argon2-lanes"_ustr;
/// OFFICE-3708: wrong URL cited in ODF 1.2 and used since OOo 3.4 beta
inline constexpr OUString SHA256_URL_ODF12 = u"http://www.w3.org/2000/09/xmldsig#sha256"_ustr;
diff --git a/package/source/manifest/ManifestImport.cxx b/package/source/manifest/ManifestImport.cxx
index f6f4ce36f4..77f795efdc 100644
--- a/package/source/manifest/ManifestImport.cxx
+++ b/package/source/manifest/ManifestImport.cxx
@@ -242,11 +242,17 @@ void ManifestImport::doKeyDerivation(StringHashMap &rConvertedAttribs)
{
aSequence[PKG_MNFST_KDF].Value <<= xml::crypto::KDFID::Argon2id;
- aString = rConvertedAttribs[ATTRIBUTE_ARGON2_T_LO];
+ aString = rConvertedAttribs.find(ATTRIBUTE_ARGON2_T) != rConvertedAttribs.end()
+ ? rConvertedAttribs[ATTRIBUTE_ARGON2_T]
+ : rConvertedAttribs[ATTRIBUTE_ARGON2_T_LO];
sal_Int32 const t(aString.toInt32());
- aString = rConvertedAttribs[ATTRIBUTE_ARGON2_M_LO];
+ aString = rConvertedAttribs.find(ATTRIBUTE_ARGON2_M) != rConvertedAttribs.end()
+ ? rConvertedAttribs[ATTRIBUTE_ARGON2_M]
+ : rConvertedAttribs[ATTRIBUTE_ARGON2_M_LO];
sal_Int32 const m(aString.toInt32());
- aString = rConvertedAttribs[ATTRIBUTE_ARGON2_P_LO];
+ aString = rConvertedAttribs.find(ATTRIBUTE_ARGON2_P) != rConvertedAttribs.end()
+ ? rConvertedAttribs[ATTRIBUTE_ARGON2_P]
+ : rConvertedAttribs[ATTRIBUTE_ARGON2_P_LO];
sal_Int32 const p(aString.toInt32());
if (0 < t && 0 < m && 0 < p)
{
@@ -321,6 +327,7 @@ void SAL_CALL ManifestImport::startElement( const OUString& aName, const uno::Re
switch (nLevel) {
case 1: {
+ m_PackageVersion = aConvertedAttribs[ATTRIBUTE_VERSION];
if (aConvertedName != ELEMENT_MANIFEST) //manifest:manifest
aStack.back().m_bValid = false;
break;
@@ -445,6 +452,18 @@ void SAL_CALL ManifestImport::endElement( const OUString& aName )
return;
if ( aConvertedName == ELEMENT_FILE_ENTRY && aStack.back().m_bValid ) {
+ // required for wholesome encryption: if there is no document and hence
+ // no file-entry with a version attribute, send the package's version
+ // with the first file-entry.
+ // (note: the only case when a valid ODF document has no "/" entry with
+ // a version is when it is ODF 1.0/1.1 and then it doesn't have the
+ // package version either)
+ if (rManVector.empty() && !m_PackageVersion.isEmpty()
+ && !aSequence[PKG_MNFST_VERSION].Value.hasValue())
+ {
+ aSequence[PKG_MNFST_VERSION].Name = u"Version"_ustr;
+ aSequence[PKG_MNFST_VERSION].Value <<= m_PackageVersion;
+ }
// the first entry gets KeyInfo element if any, for PGP encryption
if (!bIgnoreEncryptData && !aKeys.empty() && rManVector.empty())
{
diff --git a/package/source/manifest/ManifestImport.hxx b/package/source/manifest/ManifestImport.hxx
index fd86e02e4f..883f1de623 100644
--- a/package/source/manifest/ManifestImport.hxx
+++ b/package/source/manifest/ManifestImport.hxx
@@ -61,6 +61,7 @@ class ManifestImport final : public cppu::WeakImplHelper < css::xml::sax::XDocum
bool bPgpEncryption;
sal_Int32 nDerivedKeySize;
::std::vector < css::uno::Sequence < css::beans::PropertyValue > > & rManVector;
+ OUString m_PackageVersion; // on root element
OUString PushNameAndNamespaces( const OUString& aName,