aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorIngo Klöcker <[email protected]>2024-05-24 08:47:15 +0000
committerIngo Klöcker <[email protected]>2024-05-24 08:47:15 +0000
commitf0d1f2c4c746d6f98643772b4864c09f3642cd83 (patch)
tree6348dacfbb5f42e946902dc42436d165fb8df904 /tests
parentqt,cpp: Implement adding ADSKs to existing keys (diff)
parentcpp: Add information about revocation keys to Key (diff)
downloadgpgme-f0d1f2c4c746d6f98643772b4864c09f3642cd83.tar.gz
gpgme-f0d1f2c4c746d6f98643772b4864c09f3642cd83.zip
Merge branch 'ikloecker/t7118-revkeys'
Diffstat (limited to 'tests')
-rw-r--r--tests/json/Makefile.am6
-rw-r--r--tests/json/key-with-revokers.asc19
-rw-r--r--tests/json/t-json.c1
-rw-r--r--tests/json/t-keylist-revokers.in.json5
-rw-r--r--tests/json/t-keylist-revokers.out.json97
-rw-r--r--tests/run-keylist.c9
6 files changed, 136 insertions, 1 deletions
diff --git a/tests/json/Makefile.am b/tests/json/Makefile.am
index 90fba79e..0484cb74 100644
--- a/tests/json/Makefile.am
+++ b/tests/json/Makefile.am
@@ -88,9 +88,13 @@ gpg-sample.stamp: $(private_keys)
done
echo x > ./gpg-sample.stamp
-pubring-stamp: $(top_srcdir)/tests/gpg/pubdemo.asc gpg-sample.stamp
+pubring-stamp: $(top_srcdir)/tests/gpg/pubdemo.asc \
+ $(top_srcdir)/tests/json/key-with-revokers.asc \
+ gpg-sample.stamp
$(TESTS_ENVIRONMENT) $(GPG) --batch --no-permission-warning \
--import $(top_srcdir)/tests/gpg/pubdemo.asc
+ $(TESTS_ENVIRONMENT) $(GPG) --batch --no-permission-warning \
+ --import $(top_srcdir)/tests/json/key-with-revokers.asc
-$(TESTS_ENVIRONMENT) $(GPG) --batch --no-permission-warning \
--import $(top_srcdir)/tests/gpg/secdemo.asc
-$(TESTS_ENVIRONMENT) gpgconf --kill all
diff --git a/tests/json/key-with-revokers.asc b/tests/json/key-with-revokers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qVpyeWZ52bBD0pH/Eu8N
+=JTll
+-----END PGP PUBLIC KEY BLOCK-----
diff --git a/tests/json/t-json.c b/tests/json/t-json.c
index 4fe74ed7..80aeaabc 100644
--- a/tests/json/t-json.c
+++ b/tests/json/t-json.c
@@ -41,6 +41,7 @@ static const char*tests[] = { "t-config", "t-version",
"t-encrypt", "t-encrypt-sign", "t-sign", "t-verify",
"t-decrypt-verify", "t-export", "t-createkey",
"t-export-secret-info", "t-chunking", "t-sig-notations",
+ "t-keylist-revokers",
/* For these two the order is important
* as t-import imports the deleted key from t-delete */
"t-delete", "t-import",
diff --git a/tests/json/t-keylist-revokers.in.json b/tests/json/t-keylist-revokers.in.json
new file mode 100644
index 00000000..a3f28296
--- /dev/null
+++ b/tests/json/t-keylist-revokers.in.json
@@ -0,0 +1,5 @@
+{
+ "op": "keylist",
+ "keys": [ "[email protected]" ],
+ "with-secret": false
+}
diff --git a/tests/json/t-keylist-revokers.out.json b/tests/json/t-keylist-revokers.out.json
new file mode 100644
index 00000000..be8f633b
--- /dev/null
+++ b/tests/json/t-keylist-revokers.out.json
@@ -0,0 +1,97 @@
+{
+ "keys": [
+ {
+ "revoked": false,
+ "expired": false,
+ "disabled": false,
+ "invalid": false,
+ "can_encrypt": true,
+ "can_sign": true,
+ "can_certify": true,
+ "can_authenticate": false,
+ "secret": false,
+ "is_qualified": false,
+ "protocol": "OpenPGP",
+ "fingerprint": "C95C864B775F71D02F52CEF6BD07B828B2F75071",
+ "owner_trust": "unknown",
+ "origin": 0,
+ "last_update": 0,
+ "subkeys": [
+ {
+ "revoked": false,
+ "expired": false,
+ "disabled": false,
+ "invalid": false,
+ "can_encrypt": false,
+ "can_sign": true,
+ "can_certify": true,
+ "can_authenticate": false,
+ "secret": false,
+ "is_qualified": false,
+ "is_cardkey": false,
+ "is_de_vs": false,
+ "pubkey_algo_name": "EdDSA",
+ "pubkey_algo_string": "ed25519",
+ "keyid": "BD07B828B2F75071",
+ "curve": "ed25519",
+ "pubkey_algo": 303,
+ "length": 255,
+ "timestamp": 1715782979,
+ "expires": 1810390979
+ },
+ {
+ "revoked": false,
+ "expired": false,
+ "disabled": false,
+ "invalid": false,
+ "can_encrypt": true,
+ "can_sign": false,
+ "can_certify": false,
+ "can_authenticate": false,
+ "secret": false,
+ "is_qualified": false,
+ "is_cardkey": false,
+ "is_de_vs": false,
+ "pubkey_algo_name": "ECDH",
+ "pubkey_algo_string": "cv25519",
+ "keyid": "94C2E4C722CADAF9",
+ "curve": "cv25519",
+ "pubkey_algo": 302,
+ "length": 255,
+ "timestamp": 1715782979,
+ "expires": 0
+ }
+ ],
+ "userids": [
+ {
+ "revoked": false,
+ "invalid": false,
+ "validity": "unknown",
+ "uid": "[email protected]",
+ "name": "",
+ "email": "[email protected]",
+ "comment": "",
+ "address": "[email protected]",
+ "origin": 0,
+ "last_update": 0
+ }
+ ],
+ "revocation_keys": [
+ {
+ "sensitive": true,
+ "fingerprint": "A0FF4590BB6122EDEF6E3C542D727CC768697734",
+ "pubkey_algo_name": "DSA",
+ "pubkey_algo": 17,
+ "key_class": 192
+ },
+ {
+ "sensitive": false,
+ "fingerprint": "23FD347A419429BACCD5E72D6BC4778054ACD246",
+ "pubkey_algo_name": "DSA",
+ "pubkey_algo": 17,
+ "key_class": 128
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/run-keylist.c b/tests/run-keylist.c
index a9d4b6aa..9ecf380b 100644
--- a/tests/run-keylist.c
+++ b/tests/run-keylist.c
@@ -308,9 +308,11 @@ main (int argc, char **argv)
gpgme_user_id_t uid;
gpgme_tofu_info_t ti;
gpgme_key_sig_t ks;
+ gpgme_revocation_key_t revkey;
int nuids;
int nsub;
int nsigs;
+ int nrevkeys;
printf ("keyid : %s\n", key->subkeys?nonnull (key->subkeys->keyid):"?");
printf ("can_cap : %s%s%s%s\n",
@@ -425,6 +427,13 @@ main (int argc, char **argv)
}
}
+ revkey = key->revocation_keys;
+ for (nrevkeys=0; revkey; revkey = revkey->next, nrevkeys++)
+ {
+ printf ("revkey%2d: %s\n", nrevkeys, revkey->fpr);
+ printf (" class: %x\n", revkey->key_class);
+ }
+
putchar ('\n');
if (import)