Skip to content

Latest commit

 

History

History
118 lines (79 loc) · 1.71 KB

README.md

File metadata and controls

118 lines (79 loc) · 1.71 KB

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 [email protected] 2016

Laci Kosco [email protected], 2017 (implementation of TODO)