Skip to content

Commit

Permalink
Indicate untrusted PGP signatures in thread view.
Browse files Browse the repository at this point in the history
  • Loading branch information
lucc authored and pazz committed Mar 24, 2016
1 parent 39d214f commit db13e51
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions alot/db/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,17 @@ def add_signature_headers(mail, sigs, error_msg):
error_msg = error_msg or 'no signature found'
else:
try:
sig_from = crypto.get_key(sigs[0].fpr).uids[0].uid
key = crypto.get_key(sigs[0].fpr)
for uid in key.uids:
if crypto.check_uid_validity(key, uid.email):
sig_from = uid.uid
uid_trusted = True
break
else:
# No trusted uid found, we did not break but drop from the
# for loop.
uid_trusted = False
sig_from = key.uids[0].uid
except:
sig_from = sigs[0].fpr

Expand All @@ -54,7 +64,9 @@ def add_signature_headers(mail, sigs, error_msg):
X_SIGNATURE_MESSAGE_HEADER,
u'Invalid: {0}'.format(error_msg)
if error_msg else
u'Valid: {0}'.format(sig_from),
u'Valid: {0}'.format(sig_from)
if uid_trusted else
u'Untrusted: {0}'.format(sig_from)
)


Expand Down

0 comments on commit db13e51

Please sign in to comment.