]>
Commit | Line | Data |
---|---|---|
f12b80ea MM |
1 | import popen2 |
2 | import re | |
3 | ||
4 | def verify_sig(email): | |
5 | """Check signature. | |
6 | ||
7 | Given email as list of strings, return (signer-emails, signed-body). | |
8 | where both are lists of strings. | |
9 | """ | |
10 | (gpg_out, gpg_in, gpg_err) = popen2.popen3("LC_ALL=C gpg --decrypt") | |
11 | for l in email: | |
12 | gpg_in.write(l) | |
13 | gpg_in.close() | |
14 | body = gpg_out.readlines() | |
15 | rx = re.compile("^gpg: Good signature from .*<([^>]+)>") | |
16 | emails = [] | |
17 | for l in gpg_err.readlines(): | |
18 | m = rx.match(l) | |
19 | if m: | |
20 | emails.append(m.group(1)) | |
21 | return (emails, body) |