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:
$ ./sbclLoad 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")
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-key")Save a key to a file:
(rsa-save-key *key* "me.rsa-key")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")Added utility function 'encrypt-file' and 'decrypt-file':
(encrypt-file "me.rsa-key" "infile" "infile.rsa")
(decrypt-file "me.rsa-key" "infile.rsa" "infile,2")You will also find a fast, self contained impmentation of the Miller Rabkin primality test.
-
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)