@@ -0,0 +1,2109 @@
+#!/usr/bin/env python3%0A# -*- coding: utf-8 -*-%0A%0Afrom __future__ import absolute_import, division, unicode_literals%0A%0A# Copyright (C) 2018 Ben McGinnes %3Cben@gnupg.org%3E%0A#%0A# This program is free software; you can redistribute it and/or modify it under%0A# the terms of the GNU General Public License as published by the Free Software%0A# Foundation; either version 2 of the License, or (at your option) any later%0A# version.%0A#%0A# This program is free software; you can redistribute it and/or modify it under%0A# the terms of the GNU Lesser General Public License as published by the Free%0A# Software Foundation; either version 2.1 of the License, or (at your option)%0A# any later version.%0A#%0A# This program is distributed in the hope that it will be useful, but WITHOUT%0A# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS%0A# FOR A PARTICULAR PURPOSE.  See the GNU General Public License and the GNU%0A# Lesser General Public Licensefor more details.%0A#%0A# You should have received a copy of the GNU General Public License and the GNU%0A# Lesser General Public along with this program; if not, see%0A# %3Chttp://www.gnu.org/licenses/%3E.%0A%0Aimport gpg%0Aimport os.path%0A%0Aprint(%22%22%22%0AThis script revokes a user ID on an existing key.%0A%0AThe gpg-agent and pinentry are invoked to enter the passphrase.%0A%22%22%22)%0A%0Ac = gpg.Context()%0A%0Ahomedir = input(%22Enter the GPG configuration directory path (optional): %22)%0Afpr0 = input(%22Enter the fingerprint of the key to modify: %22)%0Auid_name = input(%22Enter the name of the user ID: %22)%0Auid_email = input(%22Enter the email address of the user ID: %22)%0Auid_cmnt = input(%22Enter a comment to include (optional): %22)%0A%0Aif homedir.startswith(%22~%22):%0A    if os.path.exists(os.path.expanduser(homedir)) is True:%0A        c.home_dir = os.path.expanduser(homedir)%0A    else:%0A        pass%0Aelif os.path.exists(homedir) is True:%0A    c.home_dir = homedir%0Aelse:%0A    pass%0A%0Afpr = %22%22.join(fpr0.split())%0A%0Aif len(uid_cmnt) %3E 0:%0A    userid = %22%7B0%7D (%7B1%7D) %3C%7B2%7D%3E%22.format(uid_name, uid_cmnt, uid_email)%0Aelse:%0A    userid = %22%7B0%7D %3C%7B2%7D%3E%22.format(uid_name, uid_email)%0A%0Akey = c.get_key(fpr, secret=True)%0Ac.key_revoke_uid(key, userid)%0A

revoke UID