From 8ec2353d688a6064e5c2cd69745e246c12707b95 Mon Sep 17 00:00:00 2001 From: drebs Date: Thu, 20 Dec 2012 12:42:34 -0200 Subject: Fix OpenPGP key generation. --- src/leap/soledad/__init__.py | 6 ++++-- src/leap/soledad/util.py | 6 ++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/leap/soledad/__init__.py b/src/leap/soledad/__init__.py index 9f5d6e22..6a3707ea 100644 --- a/src/leap/soledad/__init__.py +++ b/src/leap/soledad/__init__.py @@ -53,9 +53,11 @@ class Soledad(object): def _has_openpgp_keypair(self): - if self._gpg.find_key(self._user_email): + try: + self._gpg.find_key(self._user_email) return True - return False + except LookupError: + return False def _gen_openpgp_keypair(self): params = self._gpg.gen_key_input( diff --git a/src/leap/soledad/util.py b/src/leap/soledad/util.py index 1485fce1..41fd4548 100644 --- a/src/leap/soledad/util.py +++ b/src/leap/soledad/util.py @@ -38,6 +38,12 @@ class GPGWrapper(): def import_keys(self, data): return self.gpg.import_keys(data) + def gen_key_input(self, **kwargs): + return self.gpg.gen_key_input(**kwargs) + + def gen_key(self, input): + return self.gpg.gen_key(input) + #---------------------------------------------------------------------------- # u1db Transaction and Sync logs. -- cgit v1.2.3