Only do key lookup after keygen for openpgp

For S/MIME this works on ephemeral certificates because
after generation there is only a CSR created. Trying to
insert that in the keycache leads to undefined behavior.
Mostly a crash.
parent 705548a4
......@@ -894,12 +894,14 @@ private Q_SLOTS:
}
}
// 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;
if (pgp()) {
auto ctx = Context::createForProtocol(OpenPGP);
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;
......
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