summaryrefslogtreecommitdiff
path: root/src/leap/soledad/util.py
diff options
context:
space:
mode:
authorkali <kali@leap.se>2013-01-30 10:42:32 +0900
committerkali <kali@leap.se>2013-01-30 10:42:32 +0900
commitededacbc47861ef9804fe60545087e48e06bfc82 (patch)
treead5c17a4029f7aff2f7587242644d4c140562aed /src/leap/soledad/util.py
parent34abbe9a8b9f6ce7eff1d68d48f5be842868dff8 (diff)
parent8ddd01b8f5bcc14fb7a51bfb95d0eacc83db640e (diff)
Merge branch 'release-0.2.0' into release/v0.2.0
removing soledad + email from release branch created with git flow
Diffstat (limited to 'src/leap/soledad/util.py')
-rw-r--r--src/leap/soledad/util.py55
1 files changed, 0 insertions, 55 deletions
diff --git a/src/leap/soledad/util.py b/src/leap/soledad/util.py
deleted file mode 100644
index 4bc4d2c9..00000000
--- a/src/leap/soledad/util.py
+++ /dev/null
@@ -1,55 +0,0 @@
-import os
-import gnupg
-import re
-
-
-class GPGWrapper(gnupg.GPG):
- """
- This is a temporary class for handling GPG requests, and should be
- replaced by a more general class used throughout the project.
- """
-
- GNUPG_HOME = os.environ['HOME'] + "/.config/leap/gnupg"
- GNUPG_BINARY = "/usr/bin/gpg" # this has to be changed based on OS
-
- def __init__(self, gpghome=GNUPG_HOME, gpgbinary=GNUPG_BINARY):
- super(GPGWrapper, self).__init__(gnupghome=gpghome,
- gpgbinary=gpgbinary)
-
- def find_key(self, email):
- """
- Find user's key based on their email.
- """
- for key in self.list_keys():
- for uid in key['uids']:
- if re.search(email, uid):
- return key
- raise LookupError("GnuPG public key for %s not found!" % email)
-
- def encrypt(self, data, recipient, sign=None, always_trust=True,
- passphrase=None, symmetric=False):
- # TODO: devise a way so we don't need to "always trust".
- return super(GPGWrapper, self).encrypt(data, recipient, sign=sign,
- always_trust=always_trust,
- passphrase=passphrase,
- symmetric=symmetric)
-
- def decrypt(self, data, always_trust=True, passphrase=None):
- # TODO: devise a way so we don't need to "always trust".
- return super(GPGWrapper, self).decrypt(data,
- always_trust=always_trust,
- passphrase=passphrase)
-
- def send_keys(self, keyserver, *keyids):
- """
- Send keys to a keyserver
- """
- result = self.result_map['list'](self)
- gnupg.logger.debug('send_keys: %r', keyids)
- data = gnupg._make_binary_stream("", self.encoding)
- args = ['--keyserver', keyserver, '--send-keys']
- args.extend(keyids)
- self._handle_io(args, data, result, binary=True)
- gnupg.logger.debug('send_keys result: %r', result.__dict__)
- data.close()
- return result