Skip to content Skip to sidebar Skip to footer

Python Using M2crypto Signing A Message With S/mime

I spent hours now and I can not find my error. I want a simple routine that creates a S/MIME signed message that could be used with smtplib later. This is, what I have so far: #!/u

Solution 1:

This is a few years late but for anyone coming from Google as it features prominently, try this:

p7 = smime.sign(buf, SMIME.PKCS7_DETACHED)

out = BIO.MemoryBuffer()
out.write('From: %s\n' % sender)
out.write('To: %s\n' % to)
out.write('Subject: %s\n' % subject)

buf = BIO.MemoryBuffer(msg_str)

smime.write(out, p7, buf)

Post a Comment for "Python Using M2crypto Signing A Message With S/mime"