From fdc02ee65765b86bd7b2b0cd456c5c2ceee334c5 Mon Sep 17 00:00:00 2001 From: drebs Date: Tue, 19 Feb 2013 14:36:44 -0300 Subject: Add verification of existence of private key in Soledad. --- __init__.py | 2 +- util.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/__init__.py b/__init__.py index ad7dbbcf..c9c1bedf 100644 --- a/__init__.py +++ b/__init__.py @@ -145,7 +145,7 @@ class Soledad(object): """ # TODO: verify if we have the corresponding private key. try: - self._gpg.find_key_by_email(self._user_email) + self._gpg.find_key_by_email(self._user_email, secret=True) return True except LookupError: return False diff --git a/util.py b/util.py index fe24df39..64c03daa 100644 --- a/util.py +++ b/util.py @@ -60,11 +60,11 @@ class GPGWrapper(gnupg.GPG): options=options) self.result_map['list-packets'] = ListPackets - def find_key_by_email(self, email): + def find_key_by_email(self, email, secret=False): """ Find user's key based on their email. """ - for key in self.list_keys(): + for key in self.list_keys(secret=secret): for uid in key['uids']: if re.search(email, uid): return key -- cgit v1.2.3