If I use a QGpgME::EncryptJob to create a encrypted message the tofu data (encryptions table) is not updated.
As a testcase:
- delete the tofu.db
- run the testTofuEncrypt function:
Using protocol "OpenPGP" encrypt for 023DFCA4424EA644B174AD14C6F20F3A31F563CF
- check `tofu.db:
- it is created and bindings table is filled
- encryptions table is empty
Expected behaviour is that the 'encryptions` table has one entry!
Like it is when you it on the commandline:
echo "hey people\n" | gpg -r 023DFCA4424EA644B174AD14C6F20F3A31F563CF -e >/dev/null
Check tofu.db again and the encryptions table as one entry.
Sample code c++:
#include <qgpgme/keylistjob.h> #include <qgpgme/protocol.h> #include <qgpgme/encryptjob.h> #include <gpgme++/key.h> #include <gpgme++/keylistresult.h> #include <gpgme++/encryptionresult.h> #include <QDebug> #include <memory> static void testTofuEncrypt() { const QGpgME::Protocol *proto = QGpgME::openpgp(); Q_ASSERT(proto); qDebug() << "Using protocol" << proto->name(); std::vector<GpgME::Key> keys; std::unique_ptr<QGpgME::KeyListJob> listJob(proto->keyListJob(false, false, true)); // use validating keylisting if (listJob.get()) { // ##### Adjust this to your own identity // With a empty string, we will use the first key in the keyring listJob->exec({QString()}, false /*secret*/, keys); Q_ASSERT(!keys.empty()); } else { Q_ASSERT(0); // job failed } auto job = proto->encryptJob(true, true); QByteArray plainText = "Hey people\n"; qDebug() << " encrypt for " << keys[0].primaryFingerprint(); QByteArray ciphertext; const auto res = job->exec({keys[0]}, plainText, true, ciphertext); if (res.error().isCanceled()) { qDebug() << "encrypting was canceled by user"; return; } if (res.error()) { qDebug() << "encrypting failed:" << res.error().asString(); return; } }