forked from mailpile/Mailpile
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added PGP example builder, outputs mbox
- Loading branch information
Smári McCarthy
committed
Oct 14, 2014
1 parent
f25bd41
commit 2969b61
Showing
12 changed files
with
55 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import os | ||
import email | ||
import mailbox | ||
from subprocess import Popen, PIPE | ||
|
||
def getSourceFiles(): | ||
return os.listdir("sources") | ||
|
||
def getProcesses(): | ||
return ["--armor --sign", "--armor --clearsign", "--recipient 0x5AB5B329 --armor --encrypt", | ||
"--sign", "--recipient 0x5AB5B329 --encrypt"] | ||
|
||
def runPGP(input, params): | ||
print "Running PGP" | ||
params = params.split(" ") | ||
params.insert(0, "../gpg-keyring/") | ||
params.insert(0, "--home") | ||
params.insert(0, "gpg") | ||
pr = Popen(params, stdin=PIPE, stdout=PIPE) | ||
pr.stdin.write(input) | ||
pr.stdin.close() | ||
pr.wait() | ||
m = pr.stdout.read() | ||
return m | ||
|
||
def genExamples(): | ||
output = mailbox.mbox("output.mbox") | ||
for source in getSourceFiles(): | ||
contents = open("sources/" + source, "r").read() | ||
language, charset = source.split(".") | ||
for process in getProcesses(): | ||
print "Creating %s mail with %s encoding and %s PGP" % (language, | ||
charset, process) | ||
string = runPGP(contents, process) | ||
e = email.message_from_string(string) | ||
e.set_charset(charset) | ||
e["from"] = "sender@test.mailpile.is" | ||
e["to"] = "recipient@test.mailpile.is" | ||
output.add(e) | ||
|
||
output.close() | ||
|
||
if __name__ == "__main__": | ||
genExamples() |
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 @@ | ||
���� ���� ����� ������� ������� �� ������� �������. ��� ����� ����� ������� ������ �� ����� ����� ����� ���� ������. |
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 @@ | ||
يولد جميع الناس أحرارًا متساوين في الكرامة والحقوق. وقد وهبوا عقلاً وضميرًا وعليهم أن يعامل بعضهم بعضًا بروح الإخاء. |
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 @@ | ||
���� ���� ����� ������� ������� �� ������� �������. ��� ����� ����� ������� ������ �� ����� ����� ����� ���� ������. |
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 @@ | ||
人人生而自由,在尊严和权利上一律平等。他们赋有理性和良心,并应以兄弟关系的精神相对待。 |
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 @@ | ||
���� �� �������� ����������� ��� ���� ���� ����������� ��� ��� ����������. ����� ������������ �� ������ ��� ���������, ��� �������� �� ��������������� ������ ���� �� ������ �����������. |
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 @@ | ||
Ολοι οι άνθρωποι γεννιούνται και ίσοι στην αξιοπρέπεια και στα δικαιώματα. Είναι προικισμένοι με λογική και συνείδηση, και οφείλουν να συμπεριφέρονται μεταξύ τους με πνεύμα αδελφοσύνης. |
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 @@ | ||
���� �� �������� ����������� ��� ���� ���� ����������� ��� ��� ����������. ����� ������������ �� ������ ��� ���������, ��� �������� �� ��������������� ������ ���� �� ������ �����������. |
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 @@ | ||
��� ���� ��������� ���������� � ������� � ����� ����������� � ������. ��� �������� ������� � �������� � ������ ��������� � ��������� ���� ����� � ���� ��������. |
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 @@ | ||
Все люди рождаются свободными и равными в своем достоинстве и правах. Они наделены разумом и совестью и должны поступать в отношении друг друга в духе братства. |
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 @@ | ||
��� ���� ��������� ���������� � ������� � ����� ����������� � ������. ��� �������� ������� � �������� � ������ ��������� � ��������� ���� ����� � ���� ��������. |
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 @@ | ||
Tất cả mọi người sinh ra đều được tự do và bình đẳng về nhân phẩm và quyền. Mọi con người đều được tạo hóa ban cho lý trí và lương tâm và cần phải đối xử với nhau trong tình bằng hữu. |