[Pkg-privacy-commits] [monkeysign] 01/03: gpg: Implemented revoked for OpenPGP Keys

Ximin Luo infinity0 at moszumanska.debian.org
Sat Aug 22 13:34:16 UTC 2015


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

infinity0 pushed a commit to branch dev/revoked
in repository monkeysign.

commit 4a9d978e24455019dc578a29d5423d1ef95d2ad8
Author: Tobias Mueller <muelli at cryptobitch.de>
Date:   Mon Feb 16 11:47:54 2015 +0100

    gpg: Implemented revoked for OpenPGP Keys
    
    The property itself is straight forward to implement, because we already
    have parsed the information from the --list-keys call.
    However, GnuPG does not export that information for secret keys.  Hence,
    if you wanted to know whether the secret key at your hand is revoked,
    you need to find the public key first.
---
 monkeysign/gpg.py | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/monkeysign/gpg.py b/monkeysign/gpg.py
index 456cf3b..8dac868 100644
--- a/monkeysign/gpg.py
+++ b/monkeysign/gpg.py
@@ -566,9 +566,27 @@ class OpenPGPkey():
     Some of this datastructure is taken verbatim from GPGME.
     """
 
-    # the key has a revocation certificate
-    # @todo - not implemented
-    revoked = False
+    @property
+    def revoked(self):
+        '''Returns whether GnuPG thinks the key has been revoked
+        
+        This is the second field of the result of the --list-key --with-colons
+        call.  Note that this information is only present on public keys,
+        i.e. not on secret keys.
+        
+        Returns None if it cannot be determined whether this key has
+        been revoked.'''
+        if self.trust == '-':
+            # We cannot determine whether this key has been revoked.
+            # Locate the public key and try again.
+            is_revoked = None
+        elif self.trust == 'r':
+            is_revoked = True
+        else:
+            is_revoked = False
+            
+        return is_revoked
+
 
     # the expiry date is set and it is passed
     # @todo - not implemented

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/monkeysign.git



More information about the Pkg-privacy-commits mailing list