Skip to content

Commit fe51df2

Browse files
committed
Add armor as an option on export_keys
1 parent 7845714 commit fe51df2

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

pretty_bad_protocol/gnupg.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,13 +420,14 @@ def delete_keys(self, fingerprints, secret=False, subkeys=False):
420420
self._collect_output(p, result, stdin=p.stdin)
421421
return result
422422

423-
def export_keys(self, keyids, secret=False, subkeys=False):
423+
def export_keys(self, keyids, secret=False, subkeys=False, armor=True):
424424
"""Export the indicated ``keyids``.
425425
426426
:param str keyids: A keyid or fingerprint in any format that GnuPG will
427427
accept.
428428
:param bool secret: If True, export only the secret key.
429429
:param bool subkeys: If True, export the secret subkeys.
430+
:param bool armor: If False, export the key in binary format.
430431
"""
431432
which = ''
432433
if subkeys:
@@ -437,7 +438,9 @@ def export_keys(self, keyids, secret=False, subkeys=False):
437438
if _is_list_or_tuple(keyids):
438439
keyids = ' '.join(['%s' % k for k in keyids])
439440

440-
args = ["--armor"]
441+
args = []
442+
if armor:
443+
args = ["--armor"]
441444
args.append("--export{0} {1}".format(which, keyids))
442445

443446
p = self._open_subprocess(args)

0 commit comments

Comments
 (0)