From 9437604c719f74847685e09f283450533a49f3bc Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Wed, 22 May 2013 17:05:17 +0000 Subject: [PATCH] Add list-sigs implementation --- src/_parsers.py | 3 ++- src/gnupg.py | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/_parsers.py b/src/_parsers.py index 3662ebc..dcbd59d 100644 --- a/src/_parsers.py +++ b/src/_parsers.py @@ -337,6 +337,7 @@ def _is_allowed(input): '--armour', '--clearsign', '--detach-sign', + '--list-sigs', '--sign', '--verify', ## i/o and files @@ -499,7 +500,7 @@ def _sanitise(*args): log.debug("%s not file: %s" % (flag, val)) elif flag in ['--default-key', '--recipient', '--export', '--export-secret-keys', - '--delete-keys', + '--delete-keys', '--list-sigs', '--export-secret-subkeys',]: if _is_hex(val): safe_option += (val + " ") diff --git a/src/gnupg.py b/src/gnupg.py index 2791a3f..f97b17d 100644 --- a/src/gnupg.py +++ b/src/gnupg.py @@ -1038,7 +1038,21 @@ use_agent: %s :returns: A dictionary whose keys are the original keyid parameters, and whose values are lists of signatures. """ - raise NotImplemented("Functionality for '--list-sigs' not implemented.") + if len(keyids) > self._batch_limit: + raise ValueError( + "List signatures is limited to %d keyids simultaneously" + % self._batch_limit) + + args = ["--with-colons", "--fixed-list-mode", "--list-sigs"] + + for key in keyids: + args.append(key) + + proc = self._open_subprocess(args) + + result = self._result_map['list'](self) + self._collect_output(proc, result, stdin=p.stdin) + return result def gen_key(self, input): """Generate a GnuPG key through batch file key generation. See