[Python-modules-commits] [python-gnupg] 01/04: Correctly capture subkey fingerprints.

Elena Grandi valhalla-guest at moszumanska.debian.org
Sun Nov 29 15:14:16 UTC 2015


This is an automated email from the git hooks/post-receive script.

valhalla-guest pushed a commit to branch master
in repository python-gnupg.

commit fd6835d8beec6703c412c06d2cca6e8c74d8f417
Author: Elena Grandi <valhalla-d at trueelena.org>
Date:   Sun Nov 29 15:03:57 2015 +0100

    Correctly capture subkey fingerprints.
---
 gnupg.py      | 7 +++++--
 test_gnupg.py | 3 ++-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/gnupg.py b/gnupg.py
index ec70661..01f86ff 100644
--- a/gnupg.py
+++ b/gnupg.py
@@ -455,7 +455,6 @@ class ListKeys(SearchKeys):
 
         crt = X.509 certificate
         crs = X.509 certificate and private key available
-        ssb = secret subkey (secondary key)
         uat = user attribute (same as user id except for field 10).
         sig = signature
         rev = revocation signature
@@ -500,6 +499,10 @@ class ListKeys(SearchKeys):
         self.curkey['subkeys'].append(subkey)
         self.in_subkey = True
 
+    def ssb(self, args):
+        subkey = [args[4], None]    # keyid, type
+        self.curkey['subkeys'].append(subkey)
+        self.in_subkey = True
 
 class ScanKeys(ListKeys):
     ''' Handle status messages for --with-fingerprint.'''
@@ -1121,7 +1124,7 @@ class GPG(object):
         self._collect_output(p, result, stdin=p.stdin)
         lines = result.data.decode(self.encoding,
                                    self.decode_errors).splitlines()
-        valid_keywords = 'pub uid sec fpr sub'.split()
+        valid_keywords = 'pub uid sec fpr sub ssb'.split()
         for line in lines:
             if self.verbose:
                 print(line)
diff --git a/test_gnupg.py b/test_gnupg.py
index f6325ef..55a3c8e 100644
--- a/test_gnupg.py
+++ b/test_gnupg.py
@@ -240,6 +240,7 @@ class GPGTestCase(unittest.TestCase):
         private_keys = self.gpg.list_keys(secret=True)
         self.assertTrue(is_list_with_len(private_keys, 1),
                         "1-element list expected")
+        self.assertEqual(len(private_keys.fingerprints), 1)
         # Now do the same test, but using keyring and secret_keyring arguments
         hd = os.path.join(os.getcwd(), 'keys')
         gpg = gnupg.GPG(gnupghome=hd, gpgbinary=GPGBINARY,
@@ -689,7 +690,7 @@ def suite(args=None):
 
 def init_logging():
     logging.basicConfig(level=logging.DEBUG, filename="test_gnupg.log",
-                        filemode="w", format="%(asctime)s %(levelname)-5s %(name)-10s %(threadName)-10s %(message)s")
+                        filemode="w", format="%(asctime)s %(levelname)-5s %(name)-10s %(threadName)-10s %(lineno)4d %(message)s")
 
 def main():
     init_logging()

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-gnupg.git



More information about the Python-modules-commits mailing list