Skip to content

The RSA Encryption Algorithm written in Common Lisp

Notifications You must be signed in to change notification settings

burtonsamograd/rsa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

rsa - The RSA Encryption Algorithm in Common Lisp

Encrypt and decrypt messages using a key and the beauty of mathematics.

This library does not solve the key exchange problem.

--

First, get a Common Lisp implementation and install it:

http://sbcl.org

Run your lisp:

    $ ./sbcl

Load this file:

(load "rsa.lisp")

Generate a key:

(defparameter *key* (rsa-gen-key "me"))

Encrypt:

(defparameter *cyphertext* (rsa-encrypt-text *key* "this is a test"))

Decrypt:

(multiple-value-bind (from plaintext)(rsa-decrypt-text *key* *cyphertext*) 
    plaintext)

Encrypt text and store into file

(rsa-encrypt-and-save *key* "Very secret message" "message.enc")

Decrypt text stored in file

(rsa-load-and-decrypt *key* "message.enc")

Key management DB

List keys:

(rsa-list-keys)

Find a key by name:

(rsa-find-key "me")

Load a key into the db:

(rsa-load-key "me.rsa")

Save a key to a file:

(rsa-save-key *key* "me.rsa")

Save key database

(rsa-save-db "db.rsa")

Load key database (please note that function does not clear the internal database before loading, so you are merging keys from file passed to internal DB)

(rsa-load-db "rsa.db")

Bonus

You will also find a fast, self contained impmentation of the Miller Rabkin primality test.

TODO

  • save/load key db to/from file

  • save encrypted message to a file

  • load and decrypt a message from a file

  • make ASDF installable

  • get into quicklisp

-- Burton Samograd burton.samograd@gmail.com 2016

Laci Kosco laci.kosco@gmail.com, 2017 (implementation of TODO)

About

The RSA Encryption Algorithm written in Common Lisp

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published