diff options
Diffstat (limited to 'doc/howto.smime.html')
-rw-r--r-- | doc/howto.smime.html | 11 |
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: |