summaryrefslogtreecommitdiff
path: root/alot/commands/utils.py
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2016-03-24 21:04:15 +0000
committerPatrick Totzke <patricktotzke@gmail.com>2016-03-24 21:04:15 +0000
commit39d214f87c9bf0559d6e360af7b35fe3a6258454 (patch)
treee4b053063a31d289e4fb4e3e0fa671f8709ac435 /alot/commands/utils.py
parent6554345a0523b0221fc54a771ab53682086ef603 (diff)
parent39e4208cd8a677d986cf9489769e19bccec30c8b (diff)
Merge branch '0.3.8-settings-encrypt-by-default-854' into testing
Diffstat (limited to 'alot/commands/utils.py')
-rw-r--r--alot/commands/utils.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/alot/commands/utils.py b/alot/commands/utils.py
index 5ac8a74c..48d7aac9 100644
--- a/alot/commands/utils.py
+++ b/alot/commands/utils.py
@@ -8,7 +8,7 @@ from alot import crypto
@inlineCallbacks
-def get_keys(ui, encrypt_keyids, block_error=False):
+def get_keys(ui, encrypt_keyids, block_error=False, signed_only=False):
"""Get several keys from the GPG keyring. The keys are selected by keyid
and are checked if they can be used for encryption.
@@ -19,6 +19,9 @@ def get_keys(ui, encrypt_keyids, block_error=False):
:param block_error: wether error messages for the user should expire
automatically or block the ui
:type block_error: bool
+ :param signed_only: only return keys whose uid is signed (trusted to belong
+ to the key)
+ :type signed_only: bool
:returns: the available keys indexed by their key hash
:rtype: dict(str->gpgme.Key)
@@ -26,7 +29,8 @@ def get_keys(ui, encrypt_keyids, block_error=False):
keys = {}
for keyid in encrypt_keyids:
try:
- key = crypto.get_key(keyid, validate=True, encrypt=True)
+ key = crypto.get_key(keyid, validate=True, encrypt=True,
+ signed_only=signed_only)
except GPGProblem as e:
if e.code == GPGCode.AMBIGUOUS_NAME:
possible_keys = crypto.list_keys(hint=keyid)