[git] GPGME - branch, master, updated. gpgme-1.8.0-26-g56926c9

by Andre Heinecke cvs at cvs.gnupg.org
Wed Jan 11 16:21:32 CET 2017


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GnuPG Made Easy".

The branch, master has been updated
       via  56926c9b5012e8135541a933af1d69c5a81f02b3 (commit)
       via  9e643ab67168dfbd189ccc0bfed8fb59253ee79c (commit)
       via  e416f9961837039f259558edf41fccbc181ad128 (commit)
      from  efe58fe011f195d98adb4f03b1e1068a26ba287b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 56926c9b5012e8135541a933af1d69c5a81f02b3
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Jan 11 16:20:31 2017 +0100

    qt: Clean up test dirs on failure
    
    * t-encrypt.cpp,
    t-keylist.cpp,
    t-keylocate.cpp,
    t-ownertrust.cpp,
    t-tofuinfo.cpp,
    t-various.cpp,
    t-verify.cpp,
    t-wkspublish.cpp: Use QVERIFY instead of Q_ASSERT

diff --git a/lang/qt/tests/t-encrypt.cpp b/lang/qt/tests/t-encrypt.cpp
index 4d65dc7..57b586d 100644
--- a/lang/qt/tests/t-encrypt.cpp
+++ b/lang/qt/tests/t-encrypt.cpp
@@ -85,18 +85,18 @@ private Q_SLOTS:
         std::vector<Key> keys;
         auto keylistresult = listjob->exec(QStringList() << QStringLiteral("alfa at example.net"),
                                           false, keys);
-        Q_ASSERT(!keylistresult.error());
-        Q_ASSERT(keys.size() == 1);
+        QVERIFY(!keylistresult.error());
+        QVERIFY(keys.size() == 1);
         delete listjob;
 
         auto job = openpgp()->encryptJob(/*ASCII Armor */true, /* Textmode */ true);
-        Q_ASSERT(job);
+        QVERIFY(job);
         QByteArray cipherText;
         auto result = job->exec(keys, QStringLiteral("Hello World").toUtf8(), Context::AlwaysTrust, cipherText);
         delete job;
-        Q_ASSERT(!result.error());
+        QVERIFY(!result.error());
         const auto cipherString = QString::fromUtf8(cipherText);
-        Q_ASSERT(cipherString.startsWith("-----BEGIN PGP MESSAGE-----"));
+        QVERIFY(cipherString.startsWith("-----BEGIN PGP MESSAGE-----"));
 
         /* Now decrypt */
         if (!decryptSupported()) {
@@ -109,8 +109,8 @@ private Q_SLOTS:
         auto decJob = new QGpgMEDecryptJob(ctx);
         QByteArray plainText;
         auto decResult = decJob->exec(cipherText, plainText);
-        Q_ASSERT(!result.error());
-        Q_ASSERT(QString::fromUtf8(plainText) == QStringLiteral("Hello World"));
+        QVERIFY(!result.error());
+        QVERIFY(QString::fromUtf8(plainText) == QStringLiteral("Hello World"));
         delete decJob;
     }
 
@@ -125,12 +125,12 @@ private Q_SLOTS:
         std::vector<Key> keys;
         auto keylistresult = listjob->exec(QStringList() << QStringLiteral("alfa at example.net"),
                                           false, keys);
-        Q_ASSERT(!keylistresult.error());
-        Q_ASSERT(keys.size() == 1);
+        QVERIFY(!keylistresult.error());
+        QVERIFY(keys.size() == 1);
         delete listjob;
 
         auto job = openpgp()->encryptJob(/*ASCII Armor */false, /* Textmode */ false);
-        Q_ASSERT(job);
+        QVERIFY(job);
         QByteArray plainBa;
         plainBa.fill('X', PROGRESS_TEST_SIZE);
         QByteArray cipherText;
@@ -140,21 +140,21 @@ private Q_SLOTS:
         connect(job, &Job::progress, this, [this, &initSeen, &finishSeen] (const QString&, int current, int total) {
                 // We only check for progress 0 and max progress as the other progress
                 // lines depend on the system speed and are as such unreliable to test.
-                Q_ASSERT(total == PROGRESS_TEST_SIZE);
+                QVERIFY(total == PROGRESS_TEST_SIZE);
                 if (current == 0) {
                     initSeen = true;
                 }
                 if (current == total) {
                     finishSeen = true;
                 }
-                Q_ASSERT(current >= 0 && current <= total);
+                QVERIFY(current >= 0 && current <= total);
             });
         connect(job, &EncryptJob::result, this, [this, &initSeen, &finishSeen] (const GpgME::EncryptionResult &,
                                                                                 const QByteArray &,
                                                                                 const QString,
                                                                                 const GpgME::Error) {
-                Q_ASSERT(initSeen);
-                Q_ASSERT(finishSeen);
+                QVERIFY(initSeen);
+                QVERIFY(finishSeen);
                 Q_EMIT asyncDone();
             });
 
@@ -165,7 +165,7 @@ private Q_SLOTS:
 
         job->start(keys, inptr, outptr, Context::AlwaysTrust);
         QSignalSpy spy (this, SIGNAL(asyncDone()));
-        Q_ASSERT(spy.wait());
+        QVERIFY(spy.wait());
     }
 
     void testSymmetricEncryptDecrypt()
@@ -183,9 +183,9 @@ private Q_SLOTS:
         QByteArray cipherText;
         auto result = job->exec(std::vector<Key>(), QStringLiteral("Hello symmetric World").toUtf8(), Context::AlwaysTrust, cipherText);
         delete job;
-        Q_ASSERT(!result.error());
+        QVERIFY(!result.error());
         const auto cipherString = QString::fromUtf8(cipherText);
-        Q_ASSERT(cipherString.startsWith("-----BEGIN PGP MESSAGE-----"));
+        QVERIFY(cipherString.startsWith("-----BEGIN PGP MESSAGE-----"));
 
         killAgent(mDir.path());
 
@@ -195,8 +195,8 @@ private Q_SLOTS:
         auto decJob = new QGpgMEDecryptJob(ctx2);
         QByteArray plainText;
         auto decResult = decJob->exec(cipherText, plainText);
-        Q_ASSERT(!result.error());
-        Q_ASSERT(QString::fromUtf8(plainText) == QStringLiteral("Hello symmetric World"));
+        QVERIFY(!result.error());
+        QVERIFY(QString::fromUtf8(plainText) == QStringLiteral("Hello symmetric World"));
         delete decJob;
     }
 
@@ -212,8 +212,8 @@ private:
         std::vector<Key> keys;
         auto keylistresult = listjob->exec(QStringList() << QStringLiteral("alfa at example.net"),
                                           false, keys);
-        Q_ASSERT(!keylistresult.error());
-        Q_ASSERT(keys.size() == 1);
+        QVERIFY(!keylistresult.error());
+        QVERIFY(keys.size() == 1);
         delete listjob;
 
         auto ctx = Context::createForProtocol(OpenPGP);
@@ -229,10 +229,10 @@ private:
                                 cipherText);
         printf("After exec\n");
         delete job;
-        Q_ASSERT(!result.error());
+        QVERIFY(!result.error());
         printf("Cipher:\n%s\n", cipherText.constData());
         const auto cipherString = QString::fromUtf8(cipherText);
-        Q_ASSERT(cipherString.startsWith("-----BEGIN PGP MESSAGE-----"));
+        QVERIFY(cipherString.startsWith("-----BEGIN PGP MESSAGE-----"));
 
         killAgent(mDir.path());
 
@@ -240,7 +240,7 @@ private:
         QTemporaryDir tmp;
         qputenv("GNUPGHOME", tmp.path().toUtf8());
         QFile agentConf(tmp.path() + QStringLiteral("/gpg-agent.conf"));
-        Q_ASSERT(agentConf.open(QIODevice::WriteOnly));
+        QVERIFY(agentConf.open(QIODevice::WriteOnly));
         agentConf.write("allow-loopback-pinentry");
         agentConf.close();
 
@@ -251,9 +251,9 @@ private:
         auto decJob = new QGpgMEDecryptJob(ctx2);
         QByteArray plainText;
         auto decResult = decJob->exec(cipherText, plainText);
-        Q_ASSERT(!decResult.error());
+        QVERIFY(!decResult.error());
         qDebug() << "Plain: " << plainText;
-        Q_ASSERT(QString::fromUtf8(plainText) == QStringLiteral("Hello symmetric World"));
+        QVERIFY(QString::fromUtf8(plainText) == QStringLiteral("Hello symmetric World"));
         delete decJob;
 
         killAgent(tmp.path());
@@ -267,12 +267,12 @@ public Q_SLOT:
         QGpgMETest::initTestCase();
         const QString gpgHome = qgetenv("GNUPGHOME");
         qputenv("GNUPGHOME", mDir.path().toUtf8());
-        Q_ASSERT(mDir.isValid());
+        QVERIFY(mDir.isValid());
         QFile agentConf(mDir.path() + QStringLiteral("/gpg-agent.conf"));
-        Q_ASSERT(agentConf.open(QIODevice::WriteOnly));
+        QVERIFY(agentConf.open(QIODevice::WriteOnly));
         agentConf.write("allow-loopback-pinentry");
         agentConf.close();
-        Q_ASSERT(copyKeyrings(gpgHome, mDir.path()));
+        QVERIFY(copyKeyrings(gpgHome, mDir.path()));
     }
 
 private:
diff --git a/lang/qt/tests/t-keylist.cpp b/lang/qt/tests/t-keylist.cpp
index 2578576..5e88a5e 100644
--- a/lang/qt/tests/t-keylist.cpp
+++ b/lang/qt/tests/t-keylist.cpp
@@ -61,14 +61,14 @@ private Q_SLOTS:
         GpgME::KeyListResult result = job->exec(QStringList() << QStringLiteral("alfa at example.net"),
                                                 false, keys);
         delete job;
-        Q_ASSERT (!result.error());
-        Q_ASSERT (keys.size() == 1);
+        QVERIFY (!result.error());
+        QVERIFY (keys.size() == 1);
         const QString kId = QLatin1String(keys.front().keyID());
-        Q_ASSERT (kId == QStringLiteral("2D727CC768697734"));
+        QVERIFY (kId == QStringLiteral("2D727CC768697734"));
 
-        Q_ASSERT (keys[0].subkeys().size() == 2);
-        Q_ASSERT (keys[0].subkeys()[0].publicKeyAlgorithm() == Subkey::AlgoDSA);
-        Q_ASSERT (keys[0].subkeys()[1].publicKeyAlgorithm() == Subkey::AlgoELG_E);
+        QVERIFY (keys[0].subkeys().size() == 2);
+        QVERIFY (keys[0].subkeys()[0].publicKeyAlgorithm() == Subkey::AlgoDSA);
+        QVERIFY (keys[0].subkeys()[1].publicKeyAlgorithm() == Subkey::AlgoELG_E);
     }
 
     void testPubkeyAlgoAsString()
@@ -87,7 +87,7 @@ private Q_SLOTS:
             { Subkey::AlgoUnknown, QString() }
         };
         Q_FOREACH (Subkey::PubkeyAlgo algo, expected.keys()) {
-            Q_ASSERT(QString::fromUtf8(Subkey::publicKeyAlgorithmAsString(algo)) ==
+            QVERIFY(QString::fromUtf8(Subkey::publicKeyAlgorithmAsString(algo)) ==
                      expected.value(algo));
         }
     }
@@ -97,12 +97,12 @@ private Q_SLOTS:
         KeyListJob *job = openpgp()->keyListJob();
         connect(job, &KeyListJob::result, job, [this, job](KeyListResult, std::vector<Key> keys, QString, Error)
         {
-            Q_ASSERT(keys.size() == 1);
+            QVERIFY(keys.size() == 1);
             Q_EMIT asyncDone();
         });
         job->start(QStringList() << "alfa at example.net");
         QSignalSpy spy (this, SIGNAL(asyncDone()));
-        Q_ASSERT(spy.wait());
+        QVERIFY(spy.wait());
     }
 };
 
diff --git a/lang/qt/tests/t-keylocate.cpp b/lang/qt/tests/t-keylocate.cpp
index 63cb836..550305c 100644
--- a/lang/qt/tests/t-keylocate.cpp
+++ b/lang/qt/tests/t-keylocate.cpp
@@ -63,7 +63,7 @@ private Q_SLOTS:
         qputenv("GNUPGHOME", dir.path().toUtf8());
         /* Could do this with gpgconf but this is not a gpgconf test ;-) */
         QFile conf(dir.path() + QStringLiteral("/gpg.conf"));
-        Q_ASSERT(conf.open(QIODevice::WriteOnly));
+        QVERIFY(conf.open(QIODevice::WriteOnly));
         conf.write("auto-key-locate dane");
         conf.close();
 
@@ -71,11 +71,11 @@ private Q_SLOTS:
         mTestpattern = QStringLiteral("wk at gnupg.org");
         connect(job, &KeyListJob::result, job, [this, job](KeyListResult result, std::vector<Key> keys, QString, Error)
         {
-            Q_ASSERT(!result.error());
-            Q_ASSERT(keys.size() == 1);
+            QVERIFY(!result.error());
+            QVERIFY(keys.size() == 1);
 
             Key k = keys.front();
-            Q_ASSERT(k.numUserIDs());
+            QVERIFY(k.numUserIDs());
             bool found = false;
             Q_FOREACH (const UserID uid, k.userIDs()) {
                 const QString mailBox = QString::fromUtf8(uid.email());
@@ -83,12 +83,12 @@ private Q_SLOTS:
                     found = true;
                 }
             }
-            Q_ASSERT(found);
+            QVERIFY(found);
             Q_EMIT asyncDone();
         });
         job->start(QStringList() << mTestpattern);
         QSignalSpy spy (this, SIGNAL(asyncDone()));
-        Q_ASSERT(spy.wait());
+        QVERIFY(spy.wait());
         qputenv("GNUPGHOME", oldHome.toUtf8());
     }
 #endif
@@ -103,13 +103,13 @@ private Q_SLOTS:
 
         connect(job, &KeyListJob::result, job, [this, job](KeyListResult result, std::vector<Key> keys, QString, Error)
         {
-            Q_ASSERT(!result.isNull());
-            Q_ASSERT(!result.isTruncated());
-            Q_ASSERT(!result.error());
-            Q_ASSERT(keys.size() == 1);
+            QVERIFY(!result.isNull());
+            QVERIFY(!result.isTruncated());
+            QVERIFY(!result.error());
+            QVERIFY(keys.size() == 1);
 
             Key k = keys.front();
-            Q_ASSERT(k.numUserIDs());
+            QVERIFY(k.numUserIDs());
             bool found = false;
             Q_FOREACH (const UserID uid, k.userIDs()) {
                 const QString mailBox = QString::fromUtf8(uid.email());
@@ -117,12 +117,12 @@ private Q_SLOTS:
                     found = true;
                 }
             }
-            Q_ASSERT(found);
+            QVERIFY(found);
             Q_EMIT asyncDone();
         });
         job->start(QStringList() << mTestpattern);
         QSignalSpy spy (this, SIGNAL(asyncDone()));
-        Q_ASSERT(spy.wait());
+        QVERIFY(spy.wait());
     }
 
 private:
diff --git a/lang/qt/tests/t-ownertrust.cpp b/lang/qt/tests/t-ownertrust.cpp
index db863b2..f2fa3c8 100644
--- a/lang/qt/tests/t-ownertrust.cpp
+++ b/lang/qt/tests/t-ownertrust.cpp
@@ -62,10 +62,10 @@ private Q_SLOTS:
         GpgME::KeyListResult result = job->exec(QStringList() << QStringLiteral("alfa at example.net"),
                                                 false, keys);
         delete job;
-        Q_ASSERT (!result.error());
-        Q_ASSERT (keys.size() == 1);
+        QVERIFY (!result.error());
+        QVERIFY (keys.size() == 1);
         Key key = keys.front();
-        Q_ASSERT (key.ownerTrust() == Key::Unknown);
+        QVERIFY (key.ownerTrust() == Key::Unknown);
 
         ChangeOwnerTrustJob *job2 = openpgp()->changeOwnerTrustJob();
         connect(job2, &ChangeOwnerTrustJob::result, this, [this](Error e)
@@ -73,28 +73,28 @@ private Q_SLOTS:
             if (e) {
                 qDebug() <<  "Error in result: " << e.asString();
             }
-            Q_ASSERT(!e);
+            QVERIFY(!e);
             Q_EMIT asyncDone();
         });
         job2->start(key, Key::Ultimate);
         QSignalSpy spy (this, SIGNAL(asyncDone()));
-        Q_ASSERT(spy.wait());
+        QVERIFY(spy.wait());
 
         job = openpgp()->keyListJob(false, true, true);
         result = job->exec(QStringList() << QStringLiteral("alfa at example.net"),
                            false, keys);
         delete job;
         key = keys.front();
-        Q_ASSERT (key.ownerTrust() == Key::Ultimate);
+        QVERIFY (key.ownerTrust() == Key::Ultimate);
 
         ChangeOwnerTrustJob *job3 = openpgp()->changeOwnerTrustJob();
         connect(job3, &ChangeOwnerTrustJob::result, this, [this](Error e)
         {
-            Q_ASSERT(!e);
+            QVERIFY(!e);
             Q_EMIT asyncDone();
         });
         job3->start(key, Key::Unknown);
-        Q_ASSERT(spy.wait());
+        QVERIFY(spy.wait());
 
         job = openpgp()->keyListJob(false, true, true);
         result = job->exec(QStringList() << QStringLiteral("alfa at example.net"),
@@ -102,7 +102,7 @@ private Q_SLOTS:
         delete job;
 
         key = keys.front();
-        Q_ASSERT (key.ownerTrust() == Key::Unknown);
+        QVERIFY (key.ownerTrust() == Key::Unknown);
     }
 };
 
diff --git a/lang/qt/tests/t-tofuinfo.cpp b/lang/qt/tests/t-tofuinfo.cpp
index f89e1c2..d88861c 100644
--- a/lang/qt/tests/t-tofuinfo.cpp
+++ b/lang/qt/tests/t-tofuinfo.cpp
@@ -72,12 +72,12 @@ class TofuInfoTest: public QGpgMETest
 
     void testTofuCopy(TofuInfo other, const TofuInfo &orig)
     {
-        Q_ASSERT(!orig.isNull());
-        Q_ASSERT(!other.isNull());
-        Q_ASSERT(orig.signLast() == other.signLast());
-        Q_ASSERT(orig.signCount() == other.signCount());
-        Q_ASSERT(orig.validity() == other.validity());
-        Q_ASSERT(orig.policy() == other.policy());
+        QVERIFY(!orig.isNull());
+        QVERIFY(!other.isNull());
+        QVERIFY(orig.signLast() == other.signLast());
+        QVERIFY(orig.signCount() == other.signCount());
+        QVERIFY(orig.validity() == other.validity());
+        QVERIFY(orig.policy() == other.policy());
     }
 
     void signAndVerify(const QString &what, const GpgME::Key &key, int expected)
@@ -94,10 +94,10 @@ class TofuInfoTest: public QGpgMETest
         auto sigResult = job->exec(keys, what.toUtf8(), NormalSignatureMode, signedData);
         delete job;
 
-        Q_ASSERT(!sigResult.error());
+        QVERIFY(!sigResult.error());
         foreach (const auto uid, keys[0].userIDs()) {
             auto info = uid.tofuInfo();
-            Q_ASSERT(info.signCount() == expected - 1);
+            QVERIFY(info.signCount() == expected - 1);
         }
 
         auto verifyJob = openpgp()->verifyOpaqueJob();
@@ -106,25 +106,25 @@ class TofuInfoTest: public QGpgMETest
         auto result = verifyJob->exec(signedData, verified);
         delete verifyJob;
 
-        Q_ASSERT(!result.error());
-        Q_ASSERT(verified == what.toUtf8());
+        QVERIFY(!result.error());
+        QVERIFY(verified == what.toUtf8());
 
-        Q_ASSERT(result.numSignatures() == 1);
+        QVERIFY(result.numSignatures() == 1);
         auto sig = result.signatures()[0];
 
         auto key2 = sig.key();
-        Q_ASSERT(!key.isNull());
-        Q_ASSERT(!strcmp (key2.primaryFingerprint(), key.primaryFingerprint()));
-        Q_ASSERT(!strcmp (key.primaryFingerprint(), sig.fingerprint()));
+        QVERIFY(!key.isNull());
+        QVERIFY(!strcmp (key2.primaryFingerprint(), key.primaryFingerprint()));
+        QVERIFY(!strcmp (key.primaryFingerprint(), sig.fingerprint()));
         auto stats = key2.userID(0).tofuInfo();
-        Q_ASSERT(!stats.isNull());
+        QVERIFY(!stats.isNull());
         if (stats.signCount() != expected) {
             std::cout << "################ Key before verify: "
                       << key
                       << "################ Key after verify: "
                       << key2;
         }
-        Q_ASSERT(stats.signCount() == expected);
+        QVERIFY(stats.signCount() == expected);
     }
 
 private Q_SLOTS:
@@ -134,13 +134,13 @@ private Q_SLOTS:
             return;
         }
         TofuInfo tofu;
-        Q_ASSERT(tofu.isNull());
-        Q_ASSERT(!tofu.description());
-        Q_ASSERT(!tofu.signCount());
-        Q_ASSERT(!tofu.signLast());
-        Q_ASSERT(!tofu.signFirst());
-        Q_ASSERT(tofu.validity() == TofuInfo::ValidityUnknown);
-        Q_ASSERT(tofu.policy() == TofuInfo::PolicyUnknown);
+        QVERIFY(tofu.isNull());
+        QVERIFY(!tofu.description());
+        QVERIFY(!tofu.signCount());
+        QVERIFY(!tofu.signLast());
+        QVERIFY(!tofu.signFirst());
+        QVERIFY(tofu.validity() == TofuInfo::ValidityUnknown);
+        QVERIFY(tofu.policy() == TofuInfo::PolicyUnknown);
     }
 
     void testTofuInfo()
@@ -153,30 +153,30 @@ private Q_SLOTS:
         QByteArray plaintext;
 
         auto ctx = Job::context(job);
-        Q_ASSERT(ctx);
+        QVERIFY(ctx);
         ctx->setSender("alfa at example.net");
 
         auto result = job->exec(data1, plaintext);
         delete job;
 
-        Q_ASSERT(!result.isNull());
-        Q_ASSERT(!result.error());
-        Q_ASSERT(!strcmp(plaintext.constData(), "Just GNU it!\n"));
+        QVERIFY(!result.isNull());
+        QVERIFY(!result.error());
+        QVERIFY(!strcmp(plaintext.constData(), "Just GNU it!\n"));
 
-        Q_ASSERT(result.numSignatures() == 1);
+        QVERIFY(result.numSignatures() == 1);
         Signature sig = result.signatures()[0];
         /* TOFU is always marginal */
-        Q_ASSERT(sig.validity() == Signature::Marginal);
+        QVERIFY(sig.validity() == Signature::Marginal);
 
         auto stats = sig.key().userID(0).tofuInfo();
-        Q_ASSERT(!stats.isNull());
-        Q_ASSERT(sig.key().primaryFingerprint());
-        Q_ASSERT(sig.fingerprint());
-        Q_ASSERT(!strcmp(sig.key().primaryFingerprint(), sig.fingerprint()));
-        Q_ASSERT(stats.signFirst() == stats.signLast());
-        Q_ASSERT(stats.signCount() == 1);
-        Q_ASSERT(stats.policy() == TofuInfo::PolicyAuto);
-        Q_ASSERT(stats.validity() == TofuInfo::LittleHistory);
+        QVERIFY(!stats.isNull());
+        QVERIFY(sig.key().primaryFingerprint());
+        QVERIFY(sig.fingerprint());
+        QVERIFY(!strcmp(sig.key().primaryFingerprint(), sig.fingerprint()));
+        QVERIFY(stats.signFirst() == stats.signLast());
+        QVERIFY(stats.signCount() == 1);
+        QVERIFY(stats.policy() == TofuInfo::PolicyAuto);
+        QVERIFY(stats.validity() == TofuInfo::LittleHistory);
 
         testTofuCopy(stats, stats);
 
@@ -186,42 +186,42 @@ private Q_SLOTS:
         result = job->exec(data1, plaintext);
         delete job;
 
-        Q_ASSERT(!result.isNull());
-        Q_ASSERT(!result.error());
+        QVERIFY(!result.isNull());
+        QVERIFY(!result.error());
 
-        Q_ASSERT(result.numSignatures() == 1);
+        QVERIFY(result.numSignatures() == 1);
         sig = result.signatures()[0];
         /* TOFU is always marginal */
-        Q_ASSERT(sig.validity() == Signature::Marginal);
+        QVERIFY(sig.validity() == Signature::Marginal);
 
         stats = sig.key().userID(0).tofuInfo();
-        Q_ASSERT(!stats.isNull());
-        Q_ASSERT(!strcmp(sig.key().primaryFingerprint(), sig.fingerprint()));
-        Q_ASSERT(stats.signFirst() == stats.signLast());
-        Q_ASSERT(stats.signCount() == 1);
-        Q_ASSERT(stats.policy() == TofuInfo::PolicyAuto);
-        Q_ASSERT(stats.validity() == TofuInfo::LittleHistory);
+        QVERIFY(!stats.isNull());
+        QVERIFY(!strcmp(sig.key().primaryFingerprint(), sig.fingerprint()));
+        QVERIFY(stats.signFirst() == stats.signLast());
+        QVERIFY(stats.signCount() == 1);
+        QVERIFY(stats.policy() == TofuInfo::PolicyAuto);
+        QVERIFY(stats.validity() == TofuInfo::LittleHistory);
 
         /* Verify that another call yields the same result */
         job = openpgp()->verifyOpaqueJob(true);
         result = job->exec(data1, plaintext);
         delete job;
 
-        Q_ASSERT(!result.isNull());
-        Q_ASSERT(!result.error());
+        QVERIFY(!result.isNull());
+        QVERIFY(!result.error());
 
-        Q_ASSERT(result.numSignatures() == 1);
+        QVERIFY(result.numSignatures() == 1);
         sig = result.signatures()[0];
         /* TOFU is always marginal */
-        Q_ASSERT(sig.validity() == Signature::Marginal);
+        QVERIFY(sig.validity() == Signature::Marginal);
 
         stats = sig.key().userID(0).tofuInfo();
-        Q_ASSERT(!stats.isNull());
-        Q_ASSERT(!strcmp(sig.key().primaryFingerprint(), sig.fingerprint()));
-        Q_ASSERT(stats.signFirst() == stats.signLast());
-        Q_ASSERT(stats.signCount() == 1);
-        Q_ASSERT(stats.policy() == TofuInfo::PolicyAuto);
-        Q_ASSERT(stats.validity() == TofuInfo::LittleHistory);
+        QVERIFY(!stats.isNull());
+        QVERIFY(!strcmp(sig.key().primaryFingerprint(), sig.fingerprint()));
+        QVERIFY(stats.signFirst() == stats.signLast());
+        QVERIFY(stats.signCount() == 1);
+        QVERIFY(stats.policy() == TofuInfo::PolicyAuto);
+        QVERIFY(stats.validity() == TofuInfo::LittleHistory);
     }
 
     void testTofuSignCount()
@@ -235,9 +235,9 @@ private Q_SLOTS:
         GpgME::KeyListResult result = job->exec(QStringList() << QStringLiteral("zulu at example.net"),
                                                 true, keys);
         delete job;
-        Q_ASSERT(!keys.empty());
+        QVERIFY(!keys.empty());
         Key key = keys[0];
-        Q_ASSERT(!key.isNull());
+        QVERIFY(!key.isNull());
 
         /* As we sign & verify quickly here we need different
          * messages to avoid having them treated as the same
@@ -266,10 +266,10 @@ private Q_SLOTS:
         auto result = job->exec(QStringList() << QStringLiteral("zulu at example.net"),
                                                  true, keys);
         delete job;
-        Q_ASSERT(!keys.empty());
+        QVERIFY(!keys.empty());
         auto key = keys[0];
-        Q_ASSERT(!key.isNull());
-        Q_ASSERT(key.userID(0).tofuInfo().isNull());
+        QVERIFY(!key.isNull());
+        QVERIFY(key.userID(0).tofuInfo().isNull());
         auto keyCopy = key;
         keyCopy.update();
         auto sigCnt = keyCopy.userID(0).tofuInfo().signCount();
@@ -285,13 +285,13 @@ private Q_SLOTS:
         result = job->exec(QStringList() << QStringLiteral("zulu at example.net"),
                            true, keys);
         delete job;
-        Q_ASSERT(!result.error());
-        Q_ASSERT(!keys.empty());
+        QVERIFY(!result.error());
+        QVERIFY(!keys.empty());
         auto key2 = keys[0];
-        Q_ASSERT(!key2.isNull());
+        QVERIFY(!key2.isNull());
         auto info = key2.userID(0).tofuInfo();
-        Q_ASSERT(!info.isNull());
-        Q_ASSERT(info.signCount());
+        QVERIFY(!info.isNull());
+        QVERIFY(info.signCount());
     }
 
     void testTofuPolicy()
@@ -326,25 +326,25 @@ private Q_SLOTS:
                          << ">\n fpr: " << key.primaryFingerprint();
             }
         }
-        Q_ASSERT(!result.error());
-        Q_ASSERT(!keys.empty());
+        QVERIFY(!result.error());
+        QVERIFY(!keys.empty());
         auto key = keys[0];
-        Q_ASSERT(!key.isNull());
-        Q_ASSERT(key.userID(0).tofuInfo().policy() != TofuInfo::PolicyBad);
+        QVERIFY(!key.isNull());
+        QVERIFY(key.userID(0).tofuInfo().policy() != TofuInfo::PolicyBad);
         auto *tofuJob = openpgp()->tofuPolicyJob();
         auto err = tofuJob->exec(key, TofuInfo::PolicyBad);
-        Q_ASSERT(!err);
+        QVERIFY(!err);
         result = job->exec(QStringList() << QStringLiteral("bravo at example.net"),
                                             false, keys);
-        Q_ASSERT(!keys.empty());
+        QVERIFY(!keys.empty());
         key = keys[0];
-        Q_ASSERT(key.userID(0).tofuInfo().policy() == TofuInfo::PolicyBad);
+        QVERIFY(key.userID(0).tofuInfo().policy() == TofuInfo::PolicyBad);
         err = tofuJob->exec(key, TofuInfo::PolicyGood);
 
         result = job->exec(QStringList() << QStringLiteral("bravo at example.net"),
                                             false, keys);
         key = keys[0];
-        Q_ASSERT(key.userID(0).tofuInfo().policy() == TofuInfo::PolicyGood);
+        QVERIFY(key.userID(0).tofuInfo().policy() == TofuInfo::PolicyGood);
         delete tofuJob;
         delete job;
     }
@@ -354,16 +354,16 @@ private Q_SLOTS:
         QGpgMETest::initTestCase();
         const QString gpgHome = qgetenv("GNUPGHOME");
         qputenv("GNUPGHOME", mDir.path().toUtf8());
-        Q_ASSERT(mDir.isValid());
+        QVERIFY(mDir.isValid());
         QFile conf(mDir.path() + QStringLiteral("/gpg.conf"));
-        Q_ASSERT(conf.open(QIODevice::WriteOnly));
+        QVERIFY(conf.open(QIODevice::WriteOnly));
         conf.write("trust-model tofu+pgp");
         conf.close();
         QFile agentConf(mDir.path() + QStringLiteral("/gpg-agent.conf"));
-        Q_ASSERT(agentConf.open(QIODevice::WriteOnly));
+        QVERIFY(agentConf.open(QIODevice::WriteOnly));
         agentConf.write("allow-loopback-pinentry");
         agentConf.close();
-        Q_ASSERT(copyKeyrings(gpgHome, mDir.path()));
+        QVERIFY(copyKeyrings(gpgHome, mDir.path()));
     }
 private:
     QTemporaryDir mDir;
diff --git a/lang/qt/tests/t-various.cpp b/lang/qt/tests/t-various.cpp
index 330e62d..aa45b62 100644
--- a/lang/qt/tests/t-various.cpp
+++ b/lang/qt/tests/t-various.cpp
@@ -66,15 +66,15 @@ private Q_SLOTS:
         GpgME::KeyListResult result = job->exec(QStringList() << QStringLiteral("alfa at example.net"),
                                                 false, keys);
         delete job;
-        Q_ASSERT (!result.error());
-        Q_ASSERT (keys.size() == 1);
+        QVERIFY (!result.error());
+        QVERIFY (keys.size() == 1);
         Key key = keys.front();
 
         QVERIFY (key.numUserIDs() == 3);
         const char uid[] = "Foo Bar (with comment) <foo at bar.baz>";
 
         auto ctx = Context::createForProtocol(key.protocol());
-        Q_ASSERT (ctx);
+        QVERIFY (ctx);
         TestPassphraseProvider provider;
         ctx->setPassphraseProvider(&provider);
         ctx->setPinentryMode(Context::PinentryLoopback);
@@ -106,14 +106,14 @@ private Q_SLOTS:
                 break;
             }
         }
-        Q_ASSERT(id_revoked);
+        QVERIFY(id_revoked);
     }
 
     void initTestCase()
     {
         QGpgMETest::initTestCase();
         const QString gpgHome = qgetenv("GNUPGHOME");
-        Q_ASSERT(copyKeyrings(gpgHome, mDir.path()));
+        QVERIFY(copyKeyrings(gpgHome, mDir.path()));
         qputenv("GNUPGHOME", mDir.path().toUtf8());
     }
 
diff --git a/lang/qt/tests/t-verify.cpp b/lang/qt/tests/t-verify.cpp
index aedfc19..7caed28 100644
--- a/lang/qt/tests/t-verify.cpp
+++ b/lang/qt/tests/t-verify.cpp
@@ -70,14 +70,14 @@ private Q_SLOTS:
         QByteArray verified;
 
         auto result = verifyJob->exec(signedData, verified);
-        Q_ASSERT(!result.error());
+        QVERIFY(!result.error());
         delete verifyJob;
 
-        Q_ASSERT(result.numSignatures() == 1);
+        QVERIFY(result.numSignatures() == 1);
         auto sig = result.signatures()[0];
 
         const auto key = sig.key(true, false);
-        Q_ASSERT(!key.isNull());
+        QVERIFY(!key.isNull());
 
         bool found = false;
         for (const auto subkey: key.subkeys()) {
@@ -85,7 +85,7 @@ private Q_SLOTS:
                 found = true;
             }
         }
-        Q_ASSERT(found);
+        QVERIFY(found);
     }
 };
 
diff --git a/lang/qt/tests/t-wkspublish.cpp b/lang/qt/tests/t-wkspublish.cpp
index 326ecaa..64f101e 100644
--- a/lang/qt/tests/t-wkspublish.cpp
+++ b/lang/qt/tests/t-wkspublish.cpp
@@ -127,12 +127,12 @@ private Q_SLOTS:
         auto job = openpgp()->wksPublishJob();
         connect(job, &WKSPublishJob::result, this,
                 [this] (Error err, QByteArray, QByteArray, QString, Error) {
-            Q_ASSERT(err);
+            QVERIFY(err);
             Q_EMIT asyncDone();
         });
         job->startCheck ("testuser1 at localhost");
         QSignalSpy spy (this, SIGNAL(asyncDone()));
-        Q_ASSERT(spy.wait());
+        QVERIFY(spy.wait());
     }
 #ifdef DO_ONLINE_TESTS
 private Q_SLOTS:
@@ -147,15 +147,15 @@ private:
                 [this] (Error err, QByteArray, QByteArray, QString, Error) {
             if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.0.16") {
                 std::cout << err;
-                Q_ASSERT(err);
+                QVERIFY(err);
             } else {
-                Q_ASSERT(!err);
+                QVERIFY(!err);
             }
             Q_EMIT asyncDone();
         });
         job->startCheck ("testuser1 at test.gnupg.org");
         QSignalSpy spy (this, SIGNAL(asyncDone()));
-        Q_ASSERT(spy.wait());
+        QVERIFY(spy.wait());
     }
 
     void testWKSPublishErrors() {
@@ -166,13 +166,13 @@ private:
         auto job = openpgp()->wksPublishJob();
         connect(job, &WKSPublishJob::result, this,
                 [this] (Error err, QByteArray, QByteArray, QString, Error) {
-            Q_ASSERT(err);
+            QVERIFY(err);
             Q_EMIT asyncDone();
         });
         job->startCreate("AB874F24E98EBB8487EE7B170F8E3D97FE7011B7",
                          QStringLiteral("Foo at bar.baz"));
         QSignalSpy spy (this, SIGNAL(asyncDone()));
-        Q_ASSERT(spy.wait());
+        QVERIFY(spy.wait());
     }
 
     void testWKSPublishCreate() {
@@ -199,31 +199,31 @@ private:
         connect(keygenjob, &KeyGenerationJob::result, this,
                 [this, &fpr](KeyGenerationResult result, QByteArray, QString, Error)
         {
-            Q_ASSERT(!result.error());
+            QVERIFY(!result.error());
             fpr = QByteArray(result.fingerprint());
-            Q_ASSERT(!fpr.isEmpty());
+            QVERIFY(!fpr.isEmpty());
             Q_EMIT asyncDone();
         });
         keygenjob->start(args);
         QSignalSpy spy (this, SIGNAL(asyncDone()));
-        Q_ASSERT(spy.wait());
+        QVERIFY(spy.wait());
 
         /* Then try to create a request. */
         auto job = openpgp()->wksPublishJob();
         connect(job, &WKSPublishJob::result, this,
                 [this] (Error err, QByteArray out, QByteArray, QString, Error) {
-            Q_ASSERT(!err);
+            QVERIFY(!err);
             Q_EMIT asyncDone();
             const QString outstr = QString(out);
-            Q_ASSERT(outstr.contains(
+            QVERIFY(outstr.contains(
                      QStringLiteral("-----BEGIN PGP PUBLIC KEY BLOCK-----")));
-            Q_ASSERT(outstr.contains(
+            QVERIFY(outstr.contains(
                      QStringLiteral("Content-Type: application/pgp-keys")));
-            Q_ASSERT(outstr.contains(
+            QVERIFY(outstr.contains(
                      QStringLiteral("From: " TEST_ADDRESS)));
         });
         job->startCreate(fpr.constData(), QLatin1String(TEST_ADDRESS));
-        Q_ASSERT(spy.wait());
+        QVERIFY(spy.wait());
     }
 
     void testWKSPublishReceive() {
@@ -235,31 +235,31 @@ private:
         connect(importjob, &ImportJob::result, this,
                 [this](ImportResult result, QString, Error)
         {
-            Q_ASSERT(!result.error());
-            Q_ASSERT(!result.imports().empty());
-            Q_ASSERT(result.numSecretKeysImported());
+            QVERIFY(!result.error());
+            QVERIFY(!result.imports().empty());
+            QVERIFY(result.numSecretKeysImported());
             Q_EMIT asyncDone();
         });
         importjob->start(QByteArray(testSecKey));
         QSignalSpy spy (this, SIGNAL(asyncDone()));
-        Q_ASSERT(spy.wait());
+        QVERIFY(spy.wait());
 
         /* Get a response. */
         auto job = openpgp()->wksPublishJob();
         connect(job, &WKSPublishJob::result, this,
                 [this] (Error err, QByteArray out, QByteArray, QString, Error) {
-            Q_ASSERT(!err);
+            QVERIFY(!err);
             Q_EMIT asyncDone();
             const QString outstr = QString(out);
-            Q_ASSERT(outstr.contains(
+            QVERIFY(outstr.contains(
                      QStringLiteral("-----BEGIN PGP MESSAGE-----")));
-            Q_ASSERT(outstr.contains(
+            QVERIFY(outstr.contains(
                      QStringLiteral("Content-Type: multipart/encrypted;")));
-            Q_ASSERT(outstr.contains(
+            QVERIFY(outstr.contains(
                      QStringLiteral("From: " TEST_ADDRESS)));
         });
         job->startReceive(QByteArray(testResponse));
-        Q_ASSERT(spy.wait());
+        QVERIFY(spy.wait());
     }
 
     void initTestCase()
@@ -267,9 +267,9 @@ private:
         QGpgMETest::initTestCase();
         const QString gpgHome = qgetenv("GNUPGHOME");
         qputenv("GNUPGHOME", mDir.path().toUtf8());
-        Q_ASSERT(mDir.isValid());
+        QVERIFY(mDir.isValid());
         QFile agentConf(mDir.path() + QStringLiteral("/gpg-agent.conf"));
-        Q_ASSERT(agentConf.open(QIODevice::WriteOnly));
+        QVERIFY(agentConf.open(QIODevice::WriteOnly));
         agentConf.write("allow-loopback-pinentry");
         agentConf.close();
     }

commit 9e643ab67168dfbd189ccc0bfed8fb59253ee79c
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Jan 11 16:18:17 2017 +0100

    qt: Add test for uid functions
    
    * lang/qt/tests/t-various.cpp: New.
    * lang/qt/tests/Makefile.am: Update accordingly.

diff --git a/lang/qt/tests/Makefile.am b/lang/qt/tests/Makefile.am
index ad08ad4..aba7be8 100644
--- a/lang/qt/tests/Makefile.am
+++ b/lang/qt/tests/Makefile.am
@@ -25,10 +25,11 @@ TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir)
 EXTRA_DIST = initial.test
 
 TESTS = initial.test t-keylist t-keylocate t-ownertrust t-tofuinfo \
-        t-encrypt t-verify
+        t-encrypt t-verify t-various
 
 moc_files = t-keylist.moc t-keylocate.moc t-ownertrust.moc t-tofuinfo.moc \
-            t-encrypt.moc t-support.hmoc t-wkspublish.moc t-verify.moc
+            t-encrypt.moc t-support.hmoc t-wkspublish.moc t-verify.moc \
+            t-various.moc
 
 AM_LDFLAGS = -no-install
 
@@ -57,6 +58,7 @@ t_tofuinfo_SOURCES = t-tofuinfo.cpp $(support_src)
 t_encrypt_SOURCES = t-encrypt.cpp $(support_src)
 t_wkspublish_SOURCES = t-wkspublish.cpp $(support_src)
 t_verify_SOURCES = t-verify.cpp $(support_src)
+t_various_SOURCES = t-various.cpp $(support_src)
 run_keyformailboxjob_SOURCES = run-keyformailboxjob.cpp
 
 nodist_t_keylist_SOURCES = $(moc_files)
@@ -64,7 +66,7 @@ nodist_t_keylist_SOURCES = $(moc_files)
 BUILT_SOURCES = $(moc_files)
 
 noinst_PROGRAMS = t-keylist t-keylocate t-ownertrust t-tofuinfo t-encrypt \
-    run-keyformailboxjob t-wkspublish t-verify
+    run-keyformailboxjob t-wkspublish t-verify t-various
 
 CLEANFILES = secring.gpg pubring.gpg pubring.kbx trustdb.gpg dirmngr.conf \
 	gpg-agent.conf pubring.kbx~ S.gpg-agent gpg.conf pubring.gpg~ \
diff --git a/lang/qt/tests/t-various.cpp b/lang/qt/tests/t-various.cpp
new file mode 100644
index 0000000..330e62d
--- /dev/null
+++ b/lang/qt/tests/t-various.cpp
@@ -0,0 +1,126 @@
+/* t-various.cpp
+
+    This file is part of qgpgme, the Qt API binding for gpgme
+    Copyright (c) 2017 Intevation GmbH
+
+    QGpgME is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License as
+    published by the Free Software Foundation; either version 2 of the
+    License, or (at your option) any later version.
+
+    QGpgME is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+    In addition, as a special exception, the copyright holders give
+    permission to link the code of this program with any edition of
+    the Qt library by Trolltech AS, Norway (or with modified versions
+    of Qt that use the same license as Qt), and distribute linked
+    combinations including the two.  You must obey the GNU General
+    Public License in all respects for all of the code used other than
+    Qt.  If you modify this file, you may extend this exception to
+    your version of the file, but you are not obligated to do so.  If
+    you do not wish to do so, delete this exception statement from
+    your version.
+*/
+
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
+#include <QDebug>
+#include <QTest>
+#include <QSignalSpy>
+#include "keylistjob.h"
+#include "protocol.h"
+#include "keylistresult.h"
+#include "context.h"
+#include "engineinfo.h"
+
+#include "t-support.h"
+
+using namespace QGpgME;
+using namespace GpgME;
+
+class TestVarious: public QGpgMETest
+{
+    Q_OBJECT
+
+Q_SIGNALS:
+    void asyncDone();
+
+private Q_SLOTS:
+
+    void testQuickUid()
+    {
+        if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.1.13") {
+            return;
+        }
+        KeyListJob *job = openpgp()->keyListJob(false, true, true);
+        std::vector<GpgME::Key> keys;
+        GpgME::KeyListResult result = job->exec(QStringList() << QStringLiteral("alfa at example.net"),
+                                                false, keys);
+        delete job;
+        Q_ASSERT (!result.error());
+        Q_ASSERT (keys.size() == 1);
+        Key key = keys.front();
+
+        QVERIFY (key.numUserIDs() == 3);
+        const char uid[] = "Foo Bar (with comment) <foo at bar.baz>";
+
+        auto ctx = Context::createForProtocol(key.protocol());
+        Q_ASSERT (ctx);
+        TestPassphraseProvider provider;
+        ctx->setPassphraseProvider(&provider);
+        ctx->setPinentryMode(Context::PinentryLoopback);
+
+        QVERIFY(!ctx->addUid(key, uid));
+        delete ctx;
+        key.update();
+
+        QVERIFY (key.numUserIDs() == 4);
+        bool id_found = false;;
+        for (const auto &u: key.userIDs()) {
+            if (!strcmp (u.id(), uid)) {
+                QVERIFY (!u.isRevoked());
+                id_found = true;
+                break;
+            }
+        }
+        QVERIFY (id_found);
+
+        ctx = Context::createForProtocol(key.protocol());
+        QVERIFY (!ctx->revUid(key, uid));
+        delete ctx;
+        key.update();
+
+        bool id_revoked = false;;
+        for (const auto &u: key.userIDs()) {
+            if (!strcmp (u.id(), uid)) {
+                id_revoked = true;
+                break;
+            }
+        }
+        Q_ASSERT(id_revoked);
+    }
+
+    void initTestCase()
+    {
+        QGpgMETest::initTestCase();
+        const QString gpgHome = qgetenv("GNUPGHOME");
+        Q_ASSERT(copyKeyrings(gpgHome, mDir.path()));
+        qputenv("GNUPGHOME", mDir.path().toUtf8());
+    }
+
+private:
+    QTemporaryDir mDir;
+};
+
+QTEST_MAIN(TestVarious)
+
+#include "t-various.moc"

commit e416f9961837039f259558edf41fccbc181ad128
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Jan 11 16:14:45 2017 +0100

    cpp: Add revuid and adduid support
    
    * lang/cpp/src/context.cpp
    (Context::revUid, Context::startRevUid),
    (Context::addUid, Context::startAddUid): New.
    * lang/cpp/src/context.h: Declare new functions.
    * lang/cpp/src/key.cpp (Key::UserID::revoke)
    (Key::addUid): Idomatic helpers.
    lang/cpp/src/key.h: Declare new functions.
    * NEWS: Update accordingly.

diff --git a/NEWS b/NEWS
index 39b41f6..c0ae27f 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,17 @@
 Noteworthy changes in version 1.8.1 (unreleased)
 ------------------------------------------------
 
+ * cpp: Support for adduid and revuid operations.
+
+ * Interface changes relative to the 1.8.0 release:
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ cpp: Context::revUid(const Key&, const char*)      NEW.
+ cpp: Context::startRevUid(const Key&, const char*) NEW.
+ cpp: Context::addUid(const Key&, const char*)      NEW.
+ cpp: Context::startAddUid(const Key&, const char*) NEW.
+ cpp: Key::UserID::revoke()                         NEW.
+ cpp: Key::addUid()                                 NEW.
+
 
 Noteworthy changes in version 1.8.0 (2016-11-16)
 ------------------------------------------------
diff --git a/lang/cpp/src/context.cpp b/lang/cpp/src/context.cpp
index ada7bea..040e8f3 100644
--- a/lang/cpp/src/context.cpp
+++ b/lang/cpp/src/context.cpp
@@ -1376,6 +1376,30 @@ Error Context::setTofuPolicyStart(const Key &k, unsigned int policy)
                  k.impl(), to_tofu_policy_t(policy)));
 }
 
+Error Context::addUid(const Key &k, const char *userid)
+{
+    return Error(d->lasterr = gpgme_op_adduid(d->ctx,
+                 k.impl(), userid, 0));
+}
+
+Error Context::startAddUid(const Key &k, const char *userid)
+{
+    return Error(d->lasterr = gpgme_op_adduid_start(d->ctx,
+                 k.impl(), userid, 0));
+}
+
+Error Context::revUid(const Key &k, const char *userid)
+{
+    return Error(d->lasterr = gpgme_op_revuid(d->ctx,
+                 k.impl(), userid, 0));
+}
+
+Error Context::startRevUid(const Key &k, const char *userid)
+{
+    return Error(d->lasterr = gpgme_op_revuid_start(d->ctx,
+                 k.impl(), userid, 0));
+}
+
 // Engine Spawn stuff
 Error Context::spawn(const char *file, const char *argv[],
                      Data &input, Data &output, Data &err,
diff --git a/lang/cpp/src/context.h b/lang/cpp/src/context.h
index 2c205b0..b075bf1 100644
--- a/lang/cpp/src/context.h
+++ b/lang/cpp/src/context.h
@@ -214,6 +214,12 @@ public:
     GpgME::Error edit(const Key &key, std::unique_ptr<EditInteractor> function, Data &out);
     GpgME::Error startEditing(const Key &key, std::unique_ptr<EditInteractor> function, Data &out);
 
+    Error addUid(const Key &key, const char *userid);
+    Error startAddUid(const Key &key, const char *userid);
+
+    Error revUid(const Key &key, const char *userid);
+    Error startRevUid(const Key &key, const char *userid);
+
     // using TofuInfo::Policy
     Error setTofuPolicy(const Key &k, unsigned int policy);
     Error setTofuPolicyStart(const Key &k, unsigned int policy);
diff --git a/lang/cpp/src/key.cpp b/lang/cpp/src/key.cpp
index 4f7ec54..3cc26a7 100644
--- a/lang/cpp/src/key.cpp
+++ b/lang/cpp/src/key.cpp
@@ -906,6 +906,34 @@ std::string UserID::addrSpec() const
     return uid->address;
 }
 
+Error UserID::revoke()
+{
+    if (isNull()) {
+        return Error::fromCode(GPG_ERR_GENERAL);
+    }
+    auto ctx = Context::createForProtocol(parent().protocol());
+    if (!ctx) {
+        return Error::fromCode(GPG_ERR_INV_ENGINE);
+    }
+    Error ret = ctx->revUid(key, id());
+    delete ctx;
+    return ret;
+}
+
+Error Key::addUid(const char *uid)
+{
+    if (isNull()) {
+        return Error::fromCode(GPG_ERR_GENERAL);
+    }
+    auto ctx = Context::createForProtocol(protocol());
+    if (!ctx) {
+        return Error::fromCode(GPG_ERR_INV_ENGINE);
+    }
+    Error ret = ctx->addUid(key, uid);
+    delete ctx;
+    return ret;
+}
+
 std::ostream &operator<<(std::ostream &os, const UserID &uid)
 {
     os << "GpgME::UserID(";
diff --git a/lang/cpp/src/key.h b/lang/cpp/src/key.h
index 3f596a8..b0599c7 100644
--- a/lang/cpp/src/key.h
+++ b/lang/cpp/src/key.h
@@ -152,6 +152,17 @@ public:
      * how long the keylisting takes.*/
     void update();
 
+    /**
+     * @brief Add a user id to this key.
+     *
+     * Needs gnupg 2.1.13 and the key needs to be updated
+     * afterwards to see the new uid.
+     *
+     * @param uid should be fully formated and UTF-8 encoded.
+     *
+     * @returns a possible error.
+     **/
+    Error addUid(const char *uid);
 private:
     gpgme_key_t impl() const
     {
@@ -335,6 +346,13 @@ public:
      * @returns a normalized mail address for this userid
      * or an empty string. */
     std::string addrSpec() const;
+
+    /*! Revoke the user id.
+     *
+     * Key needs update afterwards.
+     *
+     * @returns an error on error.*/
+    Error revoke();
 private:
     shared_gpgme_key_t key;
     gpgme_user_id_t uid;

-----------------------------------------------------------------------

Summary of changes:
 NEWS                                              |  11 ++
 lang/cpp/src/context.cpp                          |  24 ++++
 lang/cpp/src/context.h                            |   6 +
 lang/cpp/src/key.cpp                              |  28 ++++
 lang/cpp/src/key.h                                |  18 +++
 lang/qt/tests/Makefile.am                         |   8 +-
 lang/qt/tests/t-encrypt.cpp                       |  58 ++++----
 lang/qt/tests/t-keylist.cpp                       |  18 +--
 lang/qt/tests/t-keylocate.cpp                     |  26 ++--
 lang/qt/tests/t-ownertrust.cpp                    |  18 +--
 lang/qt/tests/t-tofuinfo.cpp                      | 158 +++++++++++-----------
 lang/qt/tests/{t-ownertrust.cpp => t-various.cpp} | 103 ++++++++------
 lang/qt/tests/t-verify.cpp                        |   8 +-
 lang/qt/tests/t-wkspublish.cpp                    |  52 +++----
 14 files changed, 320 insertions(+), 216 deletions(-)
 copy lang/qt/tests/{t-ownertrust.cpp => t-various.cpp} (54%)


hooks/post-receive
-- 
GnuPG Made Easy
http://git.gnupg.org




More information about the Gnupg-commits mailing list