PyRSA

      PyRSA is a command line utility that allows users to digitally encrypt and sign messages using the public key encryption scheme, RSA. There are three basic functions that PyRSA performs: encryption, decryption, and the key generation.

Downloads:

Source: pyrsa.py       Readme: README

Sample Use:

1. Generate a public and private key. In this example, we will specify a key of length 1024 bits. Allow several seconds of CPU time for the generation of the keys.

./pyrsa.py -g 1024 Enter file identifier (i.e. first name): brandon

2. Now the files brandon_privateKey.txt and brandon_publicKey.txt are in the current directory. Next place the text we want to encrypt in a text file.

echo "The sky above the port was the color of television, tuned to a dead channel." > message.txt

3. Encrypt the message using the public key and redirect the output to a text file.

./pyrsa.py -e message.txt -k brandon_publicKey.txt > ciphertext.txt

4. At this point the file ciphertext.txt contains the encrypted message. The file can safely be sent to a recipient, i.e. as an email attachment, the contents utterly unreadable to anyone without the private key.

cat ciphertext.txt 324640479987047310867034588607637206288831252018407354482927816118 694246005467400555922351111718700586647513268914160309929111652221 950483038465163319391890360326629815736832106727850537350774004332 225537805719147299934851537797106894977013483862142779887809137214 53283666357504772556433129612632786845350983

5. Next we will assume the message has been sent to the individual who posesses the corresponding private key and he wants to decrypt the message.

./pyrsa.py -d ciphertext.txt -k brandon_privateKey.txt
Decrypted text:
The sky above the port was the color of television, tuned to a dead channel.

East Bay Psychotherapist
Licensed Clinical Social Worker provides psychotherapy and counseling services for couples and individuals in the East Bay Area.