GithubHelp home page GithubHelp logo

rsa's Introduction

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

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.