-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '0.3.5-feature-encrypt-by-default-661' into testing
- Loading branch information
Showing
8 changed files
with
90 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Copyright (C) 2015 Patrick Totzke <patricktotzke@gmail.com> | ||
# This file is released under the GNU GPL, version 3 or a later revision. | ||
# For further details see the COPYING file | ||
from twisted.internet.defer import inlineCallbacks, returnValue | ||
|
||
from alot.errors import GPGProblem, GPGCode | ||
from alot import crypto | ||
|
||
|
||
@inlineCallbacks | ||
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) | ||
except GPGProblem as e: | ||
if e.code == GPGCode.AMBIGUOUS_NAME: | ||
possible_keys = crypto.list_keys(hint=keyid) | ||
tmp_choices = [k.uids[0].uid for k in possible_keys] | ||
choices = {str(len(tmp_choices) - x): tmp_choices[x] | ||
for x in range(0, len(tmp_choices))} | ||
keyid = yield ui.choice("ambiguous keyid! Which " + | ||
"key do you want to use?", | ||
choices, cancel=None) | ||
if keyid: | ||
encrypt_keyids.append(keyid) | ||
continue | ||
else: | ||
ui.notify(e.message, priority='error', block=block_error) | ||
continue | ||
keys[crypto.hash_key(key)] = key | ||
returnValue(keys) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters