Add option to delete subkeys with GPG.delete_keys().

* TODO this needs unittests.
testing/mmn/mktime_takes_localtime_not_gmtime
Isis Lovecruft 2013-05-11 18:25:17 +00:00
parent ae0ab0a7c7
commit cfd7b38242
No known key found for this signature in database
GPG Key ID: A3ADB67A2CDB8B35
1 changed files with 7 additions and 1 deletions

View File

@ -524,7 +524,7 @@ class GPG(object):
logger.debug('recv_keys result: %r', result.__dict__)
return result
def delete_keys(self, fingerprints, secret=False):
def delete_keys(self, fingerprints, secret=False, subkeys=False):
"""Delete a key, or list of keys, from the current keyring.
The keys must be refered to by their full fingerprint for GnuPG to
@ -538,11 +538,17 @@ class GPG(object):
:param bool secret: If True, delete the corresponding secret key(s)
also. (default: False)
:param bool subkeys: If True, delete the secret subkey first, then
the public key. Same as
``gpg --delete-secret-and-public-key 0x12345678``
(default: False)
"""
which='keys'
if secret:
which='secret-key'
if subkeys:
which='secret-and-public-key'
if _util._is_list_or_tuple(fingerprints):
fingerprints = ' '.join(fingerprints)