Skip to content

Commit 559a4e5

Browse files
committed
Add armor as an option on export_keys
1 parent 769c74d commit 559a4e5

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
@@ -419,13 +419,14 @@ def delete_keys(self, fingerprints, secret=False, subkeys=False):
419419
self._collect_output(p, result, stdin=p.stdin)
420420
return result
421421

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

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

442445
p = self._open_subprocess(args)

0 commit comments

Comments
 (0)