1.1 --- a/README.txt Tue Jun 25 18:28:44 2013 +0200
1.2 +++ b/README.txt Tue Jul 09 18:28:56 2013 +0200
1.3 @@ -172,6 +172,12 @@
1.4 server environment. It also uses a modified trust model when invoking gpg in
1.5 order to avoid complaints about the identity of the sender during encryption.
1.6
1.7 +To sign the encrypted message for forwarding, the above command is modified:
1.8 +
1.9 +python tests/test_send.py 1C1AAF83 0891463A --forward 1C1AAF83 \
1.10 + http://localhost/wiki/ShareTest \
1.11 + collection update 'An update to the Wiki.' 'Another update.'
1.12 +
1.13 Below, the mechanisms employed are illustrated through the use of the other
1.14 test programs.
1.15
1.16 @@ -235,6 +241,34 @@
1.17 | gpg --armor -r 0891463A --encrypt --trust-model always \
1.18 | python tests/test_encrypt_wrap.py
1.19
1.20 +Signing and Encrypting then Signing
1.21 +-----------------------------------
1.22 +
1.23 +Where a message is to be forwarded and not decrypted, it will be signed by the
1.24 +author, encrypted, but then signed by the forwarder (perhaps initially the
1.25 +author):
1.26 +
1.27 + python tests/test_message.py collection update 'An update to the Wiki.' \
1.28 + 'Another update.' \
1.29 +| python tests/test_sign.py 1C1AAF83 \
1.30 +| python tests/test_encrypt.py 0891463A \
1.31 +| python tests/test_sign.py 1C1AAF83
1.32 +
1.33 +The complicated recipe based on the individual operations is as follows:
1.34 +
1.35 + python tests/test_message.py collection update 'An update to the Wiki.' \
1.36 + 'Another update.' \
1.37 +> test.txt \
1.38 +&& cat test.txt \
1.39 +| gpg --armor -u 1C1AAF83 --detach-sig \
1.40 +| python tests/test_sign_wrap.py test.txt \
1.41 +| gpg --armor -r 0891463A --encrypt --trust-model always \
1.42 +| python tests/test_encrypt_wrap.py \
1.43 +> test2.txt \
1.44 +&& cat test2.txt \
1.45 +| gpg --armor -u 1C1AAF83 --detach-sig \
1.46 +| python tests/test_sign_wrap.py test2.txt
1.47 +
1.48 Posting a Message
1.49 -----------------
1.50
2.1 --- a/tests/test_send.py Tue Jun 25 18:28:44 2013 +0200
2.2 +++ b/tests/test_send.py Tue Jul 09 18:28:56 2013 +0200
2.3 @@ -8,15 +8,25 @@
2.4 try:
2.5 signer = sys.argv[1]
2.6 recipient = sys.argv[2]
2.7 - url = sys.argv[3] + "?action=PostMessage"
2.8 - type = sys.argv[4]
2.9 - action = sys.argv[5]
2.10 - args = sys.argv[6:]
2.11 + if sys.argv[3] == "--forward":
2.12 + forwarder = sys.argv[4]
2.13 + i = 5
2.14 + else:
2.15 + forwarder = None
2.16 + i = 3
2.17 + url = sys.argv[i] + "?action=PostMessage"
2.18 + type = sys.argv[i+1]
2.19 + action = sys.argv[i+2]
2.20 + args = sys.argv[i+3:]
2.21 except IndexError:
2.22 args = None
2.23
2.24 if not args:
2.25 print >>sys.stderr, "Need a signer, recipient, URL, update type, action and some updates as arguments to this program."
2.26 + print >>sys.stderr, "Syntax:"
2.27 + print >>sys.stderr, sys.argv[0], "<signing keyid> <recipient keyid> " \
2.28 + "[ --forward <signing keyid> ] <URL> " \
2.29 + "<update type> <action> <update>..."
2.30 sys.exit(1)
2.31
2.32 message = Message()
2.33 @@ -40,8 +50,18 @@
2.34
2.35 try:
2.36 signed_message = gpg.signMessage(email_message, signer)
2.37 - encrypted_message = gpg.encryptMessage(signed_message, recipient)
2.38 - print sendMessage(encrypted_message, url)
2.39 + message_to_send = gpg.encryptMessage(signed_message, recipient)
2.40 +
2.41 + # Forwarded messages should be timestamped and must be directed to a
2.42 + # message store.
2.43 +
2.44 + if forwarder:
2.45 + timestamp(message_to_send)
2.46 + message_to_send["Update-Action"] = "store"
2.47 + message_to_send = gpg.signMessage(message_to_send, forwarder)
2.48 +
2.49 + print sendMessage(message_to_send, url)
2.50 +
2.51 except MoinMessageError, exc:
2.52 print exc
2.53