summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorMiloslav Trmač <mitr@redhat.com>2011-03-28 19:55:15 +0200
committerMatěj Cepl <mcepl@cepl.eu>2015-10-13 15:23:20 +0200
commite5beb894caf9ed629fde67ca5bf39e7518f49c28 (patch)
treebe1338fcdc62281a2e5eb4bece0db43b5ac54d48 /doc
parent0f195b9f973eaa7c89c4d88ae76f084a7d1a8738 (diff)
downloadm2crypto-e5beb894caf9ed629fde67ca5bf39e7518f49c28.tar.gz
Fix S/MIME examples and documentation.
See https://bugzilla.redhat.com/show_bug.cgi?id=618500 for more. Rather large reproducer is also included in the bug report.
Diffstat (limited to 'doc')
-rw-r--r--doc/howto.smime.html11
1 files changed, 7 insertions, 4 deletions
diff --git a/doc/howto.smime.html b/doc/howto.smime.html
index ae8612e..3e77ad2 100644
--- a/doc/howto.smime.html
+++ b/doc/howto.smime.html
@@ -646,7 +646,7 @@ CLASS="PROGRAMLISTING"
# Instantiate an SMIME object; set it up; sign the buffer.
s = SMIME.SMIME()
s.load_key('signer_key.pem', 'signer.pem')
- p7 = s.sign(buf)
+ p7 = s.sign(buf, SMIME.PKCS7_DETACHED)
</PRE
><P
><TT
@@ -780,7 +780,7 @@ CLASS="PROGRAMLISTING"
# Load the data, verify it.
p7, data = SMIME.smime_load_pkcs7('sign.p7')
- v = s.verify(p7)
+ v = s.verify(p7, data)
print v
print data
print data.read()
@@ -991,7 +991,7 @@ CLASS="PROGRAMLISTING"
tmp = BIO.MemoryBuffer()
# Write the signed message into the temporary buffer.
- s.write(tmp, p7, buf)
+ s.write(tmp, p7)
# Encrypt the temporary buffer.
p7 = s.encrypt(tmp)
@@ -1158,7 +1158,10 @@ CLASS="PROGRAMLISTING"
s = SMIME.SMIME()
if sign:
s.load_key(from_key, from_cert)
- p7 = s.sign(msg_bio, flags=SMIME.PKCS7_TEXT)
+ if encrypt:
+ p7 = s.sign(msg_bio, flags=SMIME.PKCS7_TEXT)
+ else:
+ p7 = s.sign(msg_bio, flags=SMIME.PKCS7_TEXT|SMIME.PKCS7_DETACHED)
msg_bio = BIO.MemoryBuffer(msg) # Recreate coz sign() has consumed it.
if encrypt: