RSA module for Python

As an assignment for the University of Amsterdam we wrote a pure Python RSA implementation.

It's a module for calculating large primes, and RSA encryption, decryption, signing and verification. Includes generating public and private keys.

Download and install using "easy_install rsa" or use the download links below.

By popular demand, the code is licenced under the Gnu Public Licence (GPL) as well as the European Union Public Licence (EUPL). You're free to use the licence that suits you most, since the two are compatible.

Functions

decrypt(cypher, key)
Decrypts a cypher with the private key 'key'
encrypt(message, key)
Encrypts a string 'message' with the public key 'key'
gen_pubpriv_keys(nbits)
Generates public and private keys, and returns them as (pub, priv).

The public key consists of a dict {e: ..., , n: ....). The private key consists of a dict {d: ...., p: ...., q: ....).
sign(message, key)
Signs a string 'message' with the private key 'key'
verify(cypher, key)
Verifies a cypher with the public key 'key'

Authors

This software was written by Sybren Stüvel, Marloes de Boer and Ivo Tamboer