[ pycrypto-Bugs-1118390 ] RSA encrypt segfaults when used in threads
"SourceForge.net" <[email protected]> Mon, 07 Feb 2005 21:30:17 -0800
| Newsgroups | gmane.comp.python.cryptography.cvs |
|---|---|
| Message-ID | <[email protected]> |
Bugs item #1118390, was opened at 2005-02-08 05:30 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=120937&aid=1118390&group_id=20937 Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Chris Ochs (snacktime) Assigned to: Nobody/Anonymous (nobody) Summary: RSA encrypt segfaults when used in threads Initial Comment: When running encrypt from the following class under threads it causes a segfault. I narrowed it down to the encrypt method as the culprit. I'm not sure if this is actually a pycrypto error or a python error as I'm not familiar enough with threading. You can see my post about this on the twisted-python list which has the rest of the information about the environment at: http://twistedmatrix.com/pipermail/twisted-python/2005- February/009474.html Chris [email protected] ---------------------------------------------------- import pickle import base64 from Crypto.Util.randpool import RandomPool from Crypto.PublicKey import RSA class OTCrypto: def __init__(self,req): self.req = req self.public_key = req.ot['publicKey'] self.private_key = req.ot['privateKey'] def genkey(self): random = RandomPool() random.stir() RSAkey = RSA.generate(2048, random.get_bytes) public = RSAkey.publickey() pickle.dump(public,open(self.public_key,'w')) pickle.dump(RSAkey,open(self.private_key,'w')) def encrypt(self,plaintext): public = pickle.load(open(self.public_key)) random = RandomPool() random.stir() bits = random.get_bytes(160) ciphertext = public.encrypt(plaintext,bits) ciphertext = base64.b64encode(ciphertext[0]) return ciphertext ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=120937&aid=1118390&group_id=20937 ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click