Command Line RSA (cliRSA.jl)

This code was developed as project in Coding Theory, taught at the Naval Postgraduate School, Monterey, CA. It is a series of command line functions in Julia to encrypt files with large (>500 bit) RSA, perhaps before uploading to cloud storage or transmitting via email. It works on PDFs, PNGs, JPEGs, ODTs, and probably others.

Instructions for use

Add this package to Julia using Pkg.

julia > ]

Pkg > add git@github.com:mitchellirmer/cliRSA.jl.git

Pkg > <backspace>

Create a storage tree in your file storage

The location of your keys and of the receipient's public key are arguments to the encrypt and decrypt functions.

You will need a folder to save your own private and public keys, and one folder for each of the public keys for anyone you want to send documents to. The folder for your own keys must be called "keys_me". Your method for storing receipient keys has more flexibility.

Generate your keys

In the directory where you would like to create folders for keys and handle file IO, run

julia > using cliRSA

julia > keygen(size_e)

where size_e is the size of the encription exponent, usually a number like 10^7.

cliRSA.keygenMethod

" keygen(size_e)

Generate the public key n, the public encryption exponent e, and the private decryption exponent d. Store these in files to use distribute and use later.

source

Swap keys with friends

You can send public key files over email or other open channels.

Run the program

cliRSA.encryptMethod
encrypt(ptfile,to)

Encrypts a file (pdf,png,odt,etc) using the recipient's public key.

ARGS

ptfile - location of the file to be encrypted

to - location of the recipient's public key

source
cliRSA.decryptMethod
decrypt(ctfile, ext)

Load a ciphertext, use the private key to decrypt, then undo the encoding. Save a recovered message file.

ARGS

ctfile - location of the file to be decrypted

ext - file extension of the resulting file (.pdf, .png, etc)

source