diff options
author | Vasily Melenchuk <vasily.melenchuk@cib.de> | 2019-10-14 00:01:52 +0300 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2019-11-15 12:50:38 +0100 |
commit | e0cced9d4c94324e834e46d807469a0cd6c1f738 (patch) | |
tree | 8d5e063a0ae2f46c937db21d0b9693bd51069180 /package/source | |
parent | e21f5796b1d0d34522cef3888a3e5d91b86c2c00 (diff) |
do not clean up EncryptionData during SaveAs
As the SID_ENCRYPTIONDATA and SID_PASSWORD are used for setting
password together, EncryptionData should be removed only
when Password was set (reset of Password protection for the document).
Elsewhere EncryptionData should remain as is, while it could
contain encryption data used for opened document.
Change-Id: I46b757af81e68ad4781e83b1a0e0b6da3a5e13e1
Change-Id: I1213ec55d6dc42f062930467976de45c73152f0b
Reviewed-on: https://gerrit.libreoffice.org/82616
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'package/source')
-rw-r--r-- | package/source/zippackage/ZipPackage.cxx | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index 7b2e705e45e5..63178c7fec24 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -1748,27 +1748,9 @@ void SAL_CALL ZipPackage::setPropertyValue( const OUString& aPropertyName, const // this property is only necessary to support raw passwords in storage API; // because of this support the storage has to operate with more than one key dependent on storage generation algorithm; // when this support is removed, the storage will get only one key from outside - uno::Sequence< beans::NamedValue > aKeys; - if ( !( aValue >>= aKeys ) ) + if ( !( aValue >>= m_aStorageEncryptionKeys ) ) throw IllegalArgumentException(THROW_WHERE, uno::Reference< uno::XInterface >(), 2 ); - if ( aKeys.hasElements() ) - { - bool bHasSHA256 = false; - bool bHasSHA1 = false; - for ( const auto& rKey : std::as_const(aKeys) ) - { - if ( rKey.Name == PACKAGE_ENCRYPTIONDATA_SHA256UTF8 ) - bHasSHA256 = true; - if ( rKey.Name == PACKAGE_ENCRYPTIONDATA_SHA1UTF8 ) - bHasSHA1 = true; - } - - if ( !bHasSHA256 && !bHasSHA1 ) - throw IllegalArgumentException(THROW_WHERE "Expected keys are not provided!", uno::Reference< uno::XInterface >(), 2 ); - } - - m_aStorageEncryptionKeys = aKeys; m_aEncryptionKey.realloc( 0 ); } else if ( aPropertyName == ENCRYPTION_ALGORITHMS_PROPERTY ) |