aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDaniel Kahn Gillmor <[email protected]>2016-06-16 22:05:57 +0000
committerWerner Koch <[email protected]>2016-06-30 09:45:13 +0000
commit55d112eeb0743e90be46d15dbae67368ee7d4b50 (patch)
treeb1003a33d68ffa514179c391313ba693a93cb640 /tests
parenttools: Add gpg-wks-client and gpg-wks-server. (diff)
downloadgnupg-55d112eeb0743e90be46d15dbae67368ee7d4b50.tar.gz
gnupg-55d112eeb0743e90be46d15dbae67368ee7d4b50.zip
g10: Implement gpg --quick-revuid
* g10/revoke.c (get_default_uid_revocation_reason): New. * g10/keyedit.c (menu_revuid): Break out creation of uid revocation into new function core_revuid. * g10/keyedit.c (keyedit_quick_revuid): New. Selects key and uid, invokes core_revuid. * g10/gpg.c (main): Handle --quick-revuid argument. * doc/gpg.texi: Document --quick-revuid. -- This functionality is a counterpart to --quick-adduid, and will be useful for projects that depend programmatically on gpg to revoke user IDs (one such example is "monkeysphere-host revoke-servicename"). Signed-off-by: Daniel Kahn Gillmor <[email protected]> - Minor re-indentation work. - Changed a "0 == memcmp" to "!memcmp" - Removed tests/openpgp/quick-key-manipulation.test from the Makefile. This test needs to be converted to gpgscm. - Removed example from whats-new-in-2.1.txt because that is generated. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to '')
-rwxr-xr-xtests/openpgp/quick-key-manipulation.test70
1 files changed, 70 insertions, 0 deletions
diff --git a/tests/openpgp/quick-key-manipulation.test b/tests/openpgp/quick-key-manipulation.test
new file mode 100755
index 000000000..4185601bb
--- /dev/null
+++ b/tests/openpgp/quick-key-manipulation.test
@@ -0,0 +1,70 @@
+#!/bin/sh
+# Copyright 2016 Free Software Foundation, Inc.
+# This file is free software; as a special exception the author gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved. This file is
+# distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY, to the extent permitted by law; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+. $srcdir/defs.inc || exit 3
+
+export PINENTRY_USER_DATA=test
+
+alpha="Alpha <[email protected]>"
+bravo="Bravo <[email protected]>"
+
+$GPG --with-colons --with-fingerprint --list-secret-keys ="$alpha" &&
+ error "User ID '$alpha'exists when it should not!"
+$GPG --with-colons --with-fingerprint --list-secret-keys ="$bravo" &&
+ error "User ID '$bravo' exists when it should not!"
+
+#info verify that key creation works
+$GPG --quick-gen-key "$alpha" || \
+ error "failed to generate key"
+
+fpr=$($GPG --with-colons --with-fingerprint --list-secret-keys ="$alpha" | \
+ grep '^fpr:' | cut -f10 -d: | head -n1)
+
+$GPG --check-trustdb
+
+cleanup() {
+ $GPG --batch --yes --delete-secret-key "0x$fpr"
+ $GPG --batch --yes --delete-key "0x$fpr"
+}
+
+count_uids_of_secret() {
+ if ! [ $($GPG --with-colons --list-secret-keys ="$1" | \
+ grep -c '^uid:u:') = "$2" ] ; then
+ cleanup
+ error "wrong number of user IDs for '$1' after $3"
+ fi
+}
+
+count_uids_of_secret "$alpha" 1 "key generation"
+
+#info verify that we can add a user ID
+if ! $GPG --quick-adduid ="$alpha" "$bravo" ; then
+ cleanup
+ error "failed to add user id"
+fi
+
+$GPG --check-trustdb
+
+count_uids_of_secret "$alpha" 2 "adding User ID"
+count_uids_of_secret "$bravo" 2 "adding User ID"
+
+#info verify that we can revoke a user ID
+if ! $GPG --quick-revuid ="$bravo" "$alpha"; then
+ cleanup
+ error "failed to revoke user id"
+fi
+
+$GPG --check-trustdb
+
+count_uids_of_secret "$bravo" 1 "revoking user ID"
+
+cleanup
+
+! $GPG --with-colons --list-secret-keys ="$bravo" ||
+ error "key still exists when it should not!"