diff options
author | Franklin Weng <franklin@goodhorse.idv.tw> | 2019-08-18 21:30:05 +0800 |
---|---|---|
committer | Katarina Behrens <Katarina.Behrens@cib.de> | 2019-08-20 15:14:48 +0200 |
commit | 648990692c8253e3843c4c5954940e8b893d5f3e (patch) | |
tree | e2b443780d5a55216bb30a0fb67303a8f9fb0086 /xmlsecurity | |
parent | af7ce81494df6c1f23af1ee14adf4aa55132b5bb (diff) |
tdf#116862 do not encrypt to self when encryption key is not set
When "always encrypt to self" is checked but no encryption key is set,
encrypting a file with GPG key would cause error. So check if
msPreferredKey is empty or not before comparing with sIssuer.
Change-Id: I4d95f0b436cb1fafad1d57d50330fd2080902b69
Reviewed-on: https://gerrit.libreoffice.org/77665
Tested-by: Jenkins
Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
Diffstat (limited to 'xmlsecurity')
-rw-r--r-- | xmlsecurity/source/dialogs/certificatechooser.cxx | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/xmlsecurity/source/dialogs/certificatechooser.cxx b/xmlsecurity/source/dialogs/certificatechooser.cxx index 32c688f2a257..795e9bf3ae07 100644 --- a/xmlsecurity/source/dialogs/certificatechooser.cxx +++ b/xmlsecurity/source/dialogs/certificatechooser.cxx @@ -220,13 +220,15 @@ void CertificateChooser::ImplInitialize() #if HAVE_FEATURE_GPGME // only GPG has preferred keys - if ( sIssuer == msPreferredKey ) - { - if ( meAction == UserAction::Sign || meAction == UserAction::SelectSign ) - m_xCertLB->select(nRow); - else if ( meAction == UserAction::Encrypt && - aUserOpts.GetEncryptToSelf() ) - mxEncryptToSelf = xCert; + if ( !sIssuer.isEmpty() && !msPreferredKey.isEmpty() ) { + if ( sIssuer == msPreferredKey ) + { + if ( meAction == UserAction::Sign || meAction == UserAction::SelectSign ) + m_xCertLB->select(nRow); + else if ( meAction == UserAction::Encrypt && + aUserOpts.GetEncryptToSelf() ) + mxEncryptToSelf = xCert; + } } #endif } |