Commit 93221c7f authored by Ingo Klöcker's avatar Ingo Klöcker
Browse files

Set the key origin when importing keys retrieved via WKD

GnuPG-bug-id: 5334
parent 80ecfe9a
Pipeline #110526 passed with stage
in 3 minutes and 23 seconds
......@@ -111,6 +111,7 @@ if (QGpgme_VERSION VERSION_GREATER_EQUAL "1.16.1")
set(QGPGME_CRYPTOCONFIGENTRY_HAS_DEFAULT_VALUE 1)
set(QGPGME_SUPPORTS_WKDLOOKUP 1)
set(QGPGME_SUPPORTS_IMPORT_WITH_FILTER 1)
set(QGPGME_SUPPORTS_IMPORT_WITH_KEY_ORIGIN 1)
endif()
# Kdepimlibs packages
......
......@@ -44,3 +44,6 @@
/* Defined if QGpgME supports specifying an import filter when importing keys */
#cmakedefine QGPGME_SUPPORTS_IMPORT_WITH_FILTER 1
/* Defined if QGpgME supports setting key origin when importing keys */
#cmakedefine QGPGME_SUPPORTS_IMPORT_WITH_KEY_ORIGIN 1
......@@ -702,6 +702,9 @@ void ImportCertificatesCommand::Private::startImport(GpgME::Protocol protocol, c
#ifdef QGPGME_SUPPORTS_IMPORT_WITH_FILTER
job->setImportFilter(options.importFilter);
#endif
#ifdef QGPGME_SUPPORTS_IMPORT_WITH_KEY_ORIGIN
job->setKeyOrigin(options.keyOrigin, options.keyOriginUrl);
#endif
const GpgME::Error err = job->start(data);
if (err.code()) {
......
......@@ -80,6 +80,8 @@ struct ImportedGroup
struct ImportOptions
{
QString importFilter;
GpgME::Key::Origin keyOrigin = GpgME::Key::OriginUnknown;
QString keyOriginUrl;
};
class Kleo::ImportCertificatesCommand::Private : public Command::Private
......
......@@ -464,7 +464,8 @@ void LookupCertificatesCommand::Private::slotImportRequested(const std::vector<K
if (!wkdKeys.empty()) {
// set an import filter, so that only user IDs matching the email address used for the WKD lookup are imported
const QString importFilter = QLatin1String{"keep-uid=mbox = "} + searchTextToEmailAddress(keyListing.pattern);
startImport(OpenPGP, keyListing.wkdKeyData, keyListing.wkdSource, {importFilter});
startImport(OpenPGP, keyListing.wkdKeyData, keyListing.wkdSource,
{importFilter, Key::OriginWKD, keyListing.wkdSource});
}
if (!pgp.empty()) {
startImport(OpenPGP, pgp,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment