Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Implementing full RSA in Python

I am currently working on a project using python to implement p2p communication between two (or more) computers. Although I am pretty proficient with python, I am by no means an expert; programming and encryption are by no means my profession, simply a hobby. However, in working on this project I have been attempting to learn more about encryption as well as network programming.

As of right now I have written a pretty powerful class that communicates well over a network and I am trying to improve it by implementing RSA to encrypt the connections between peers on the network; this is where I've run into some difficulty.

I have previously used pycrypto to do some basic encryption/decryption in python and am thus-far quite comfortable with all of the tools involved -- including the necessary public-key ciphers. Moreover, I am also aware that pycrypto has some shortcomings, in the fact that it only implements the bare-bones, low level encryption/decryption algorithms needed to implement RSA and does not implement a full protocol for public-key encryption. I also know that pycrypto contains some other useful tools such as an AllOrNothing transform which can be used for padding the communication, etc. However, my question is: can anyone recommend any online articles, books, blog posts, projects, etc. which can help me in my quest to implement an effective RSA protocol?

Lastly, I understand that this is a touchy subject with cryptologists in that amateur-implemented protocols usually mean less security in the program. As I noted above, this project is a mere learning experience; if I was completing this project professionally I would surely use M2Crypto or some other professionally-implemented, secure protocol -- i.e. SSL/TLS. Alas, I am merely trying to learn more about encryption by implementing my own model of a proven protocol to create a secure connection between two peers.

Thanks, Kevin

like image 847
Kevin C Avatar asked Feb 01 '12 08:02

Kevin C


2 Answers

Take a look at Raymond Hettinger recipe: Public Key Encryption (RSA)

like image 118
reclosedev Avatar answered Sep 21 '22 18:09

reclosedev


Why not take a look at my pure-Python RSA library? It may be just what you need: http://stuvel.eu/rsa

like image 37
dr. Sybren Avatar answered Sep 23 '22 18:09

dr. Sybren