summaryrefslogtreecommitdiffstats
path: root/sfx2
diff options
context:
space:
mode:
authorThorsten Behrens <Thorsten.Behrens@CIB.de>2017-12-10 23:40:00 +0100
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2018-01-13 14:17:48 +0100
commit01c7a60c051ac4562e3a317dde3c29c507f3f40b (patch)
tree0b7104b75ba3910ed0363b46bc66b4b5afaede3e /sfx2
parentlimit WEBSERVICE to http[s] protocols (diff)
downloadcore-01c7a60c051ac4562e3a317dde3c29c507f3f40b.tar.gz
core-01c7a60c051ac4562e3a317dde3c29c507f3f40b.zip
tdf#114550: load back PGP encrypted files
This squashes the following commits from master: gpg4libre: import PGP encryption manifest Change-Id: Iadd7f8f1194299cb50907d8594114c89c668ebd0 gpg4libre: open encrypted files also via gpg Change-Id: I1f626143e6c8443b4ad0c4fc5bdbd5ab8d56a451 tdf#114550 use 32 bit random session key for gpg encryption Change-Id: I7303be71fd855aa454d07fcae04d7f42e3c9cd9c tdf#114550 recognize sym key & init vec as valid f/ decrypt Change-Id: Ie366f086a3c14d6b54b91b4edee8cfef1a42c44b tdf#114550 don't use PBKDF2 in package for gpg encryption Change-Id: Ic96b2193f8541bbd109795fb9c0212a0a10c7344 gpg4libre: add initial unit test for encryption Change-Id: Id782dd865878ae7b8a60c7c80821b1370f6ac7e7 Change-Id: Id77b67a275bf91614ab62b65fdc69e4872247ffc Reviewed-on: https://gerrit.libreoffice.org/47784 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/appl/appopen.cxx9
1 files changed, 9 insertions, 0 deletions
diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx
index 0ae86d85f9b4..6c5d833af317 100644
--- a/sfx2/source/appl/appopen.cxx
+++ b/sfx2/source/appl/appopen.cxx
@@ -195,9 +195,12 @@ ErrCode CheckPasswd_Impl
if ( xStorageProps.is() )
{
bool bIsEncrypted = false;
+ uno::Sequence< uno::Sequence< beans::NamedValue > > aGpgProperties;
try {
xStorageProps->getPropertyValue("HasEncryptedEntries")
>>= bIsEncrypted;
+ xStorageProps->getPropertyValue("EncryptionGpGProperties")
+ >>= aGpgProperties;
} catch( uno::Exception& )
{
// TODO/LATER:
@@ -230,6 +233,12 @@ ErrCode CheckPasswd_Impl
if ( pEncryptionDataItem )
pEncryptionDataItem->GetValue() >>= aEncryptionData;
+ // try if one of the public key entries is
+ // decryptable, then extract session key
+ // from it
+ if ( !aEncryptionData.hasElements() && aGpgProperties.hasElements() )
+ aEncryptionData = ::comphelper::DocPasswordHelper::decryptGpgSession(aGpgProperties);
+
SfxDocPasswordVerifier aVerifier( xStorage );
aEncryptionData = ::comphelper::DocPasswordHelper::requestAndVerifyDocPassword(
aVerifier, aEncryptionData, aPassword, xInteractionHandler, pFile->GetOrigURL(), comphelper::DocPasswordRequestType::Standard );