diff options
Diffstat (limited to 'demo/smime.howto/sign.py')
-rw-r--r-- | demo/smime.howto/sign.py | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/demo/smime.howto/sign.py b/demo/smime.howto/sign.py deleted file mode 100644 index 38c4bab..0000000 --- a/demo/smime.howto/sign.py +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env python - -"""S/MIME HOWTO demo program. - -Copyright (c) 1999-2001 Ng Pheng Siong. All rights reserved.""" - -from M2Crypto import BIO, Rand, SMIME - -def makebuf(text): - return BIO.MemoryBuffer(text) - -# Make a MemoryBuffer of the message. -buf = makebuf('a sign of our times') - -# Seed the PRNG. -Rand.load_file('randpool.dat', -1) - -# 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) - -# Recreate buf. -buf = makebuf('a sign of our times') - -# Output p7 in mail-friendly format. -out = BIO.MemoryBuffer() -out.write('From: sender@example.dom\n') -out.write('To: recipient@example.dom\n') -out.write('Subject: M2Crypto S/MIME testing\n') -s.write(out, p7, buf) - -print out.read() - -# Save the PRNG's state. -Rand.save_file('randpool.dat') - |