A minimal RSA library in zepto. Port of the chibi implementation.
There are quite a few functions and a rsa-key record type implemented. Here are a few example:
(load "rsa/rsa")
(define encrypt (import "rsa:encrypt"))
(define decrypt (import "rsa:decrypt"))
(define keygen (import "rsa:keygen"))
(define key (key-gen)) ; will yield a rsa key type with the fields bits (number of bits), n, e and d
; If you don't know what these are, don't bother with them
(decrypt key (encrypt key 1000)) ; => 1000
(byte-vector->string (decrypt key (encrypt key "hello rsa"))) ; => "hello rsa"
Additional methods include key-gen-from-primes
if you want to supply
your own primes instead of randomly generating them, pub-key
for getting
the public key part, sign
for signing a document, verify
for verifying this
signature and returning the message and verify?
to test signature and message right away.
Have fun!