Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Lookup and insert newly generated keys in cache

If the key is not in the keycache or keycache update takes
a while we might not find the key in the ::key() method. This
leads to bugs.

BUG: 386506
parent 1fb23086
......@@ -65,6 +65,7 @@
#include <gpgme++/global.h>
#include <gpgme++/gpgmepp_version.h>
#include <gpgme++/keygenerationresult.h>
#include <gpgme++/context.h>
#include <KConfigGroup>
#include <KLocalizedString>
......@@ -892,6 +893,14 @@ private Q_SLOTS:
setField(QStringLiteral("result"), i18n("Key pair created successfully."));
}
}
// Ensure that we have the key in the keycache
auto ctx = Context::createForProtocol(pgp() ? OpenPGP : CMS);
if (ctx) {
// Check is pretty useless something very buggy in that case.
Error e;
KeyCache::mutableInstance()->insert(ctx->key(result.fingerprint(), e, true));
delete ctx;
}
setField(QStringLiteral("fingerprint"), QString::fromLatin1(result.fingerprint()));
job = nullptr;
Q_EMIT completeChanged();
......
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