Skip to content

The RSA Encryption Algorithm written in Common Lisp

Notifications You must be signed in to change notification settings

BusFactor1Inc/rsa

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 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-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")

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

 
 
 

Languages

  • Common Lisp 100.0%