summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTails developers <amnesia@boum.org>2012-08-19 15:25:20 +0200
committerTails developers <amnesia@boum.org>2012-08-19 21:55:16 +0200
commitd671f912d6eba6b847652a066669de0ee3912358 (patch)
tree18f78d5116574fa3d2e9726e44de7d0443c98f57
parent2aefbcf7a3a1bee5b1b17e385b31bc4de2c19467 (diff)
Use an external keyring instead of a dedicated gnupg homedir
Using a dedicated gnupg homedir is a false good idea as it must be writable by the user running WhisperBack.
-rw-r--r--doc/config.py.sample10
-rw-r--r--whisperBack/encryption.py8
-rw-r--r--whisperBack/whisperback.py4
3 files changed, 11 insertions, 11 deletions
diff --git a/doc/config.py.sample b/doc/config.py.sample
index 38752ac..0c19abf 100644
--- a/doc/config.py.sample
+++ b/doc/config.py.sample
@@ -45,13 +45,13 @@ a public PGP key enables us to encrypt such future
communication.</p>
""")
-# KEYRING
+# ENCRYPTION
#
-# This section defines keyring parameters
+# This section defines encryption parameters
-# The path to the OpenPGP home directory to use. If None, use OpenPGP default
-# $GUNPGHOME
-gnupg_homedir = None
+# The path to the OpenPGP keyring to use. If None, use OpenPGP default
+# keyring.
+gnupg_keyring = None
# RECIPIENT
#
diff --git a/whisperBack/encryption.py b/whisperBack/encryption.py
index 94ba484..7119a47 100644
--- a/whisperBack/encryption.py
+++ b/whisperBack/encryption.py
@@ -32,8 +32,8 @@ import whisperBack.exceptions
class Encryption (GnuPGInterface.GnuPG):
"""Some tools for encryption"""
-
- def __init__ (self, gnupg_homedir=None):
+
+ def __init__ (self, keyring=None):
"""Initialize the encryption mechanism"""
GnuPGInterface.GnuPG.__init__(self)
@@ -42,8 +42,8 @@ class Encryption (GnuPGInterface.GnuPG):
self.options.meta_interactive = False
self.options.always_trust = True
- if gnupg_homedir and os.path.exists(gnupg_homedir):
- self.options.homedir = gnupg_homedir
+ if keyring and os.path.exists(keyring):
+ self.options.extra_args = ["--keyring", keyring, "--no-default-keyring"]
def encrypt (self, data, to_fingerprints):
"""Encrypts data for a list of recepients
diff --git a/whisperBack/whisperback.py b/whisperBack/whisperback.py
index a7810d4..6d6f2d6 100644
--- a/whisperBack/whisperback.py
+++ b/whisperBack/whisperback.py
@@ -97,7 +97,7 @@ class WhisperBack(object):
# Initialize config variables
self.html_help = ""
- self.gnupg_homedir = None
+ self.gnupg_keyring = None
self.to_address = None
self.to_fingerprint = None
self.from_address = None
@@ -243,7 +243,7 @@ class WhisperBack(object):
def get_encrypted_message_body(self):
"""Returns the encrypted body of the email to be send"""
- encryption = whisperBack.encryption.Encryption(gnupg_homedir=self.gnupg_homedir)
+ encryption = whisperBack.encryption.Encryption(keyring=self.gnupg_keyring)
return encryption.encrypt(self.get_message_body(), [self.to_fingerprint])
def save(self, path):