Hi all, just a quick heads up for those who might want to integrate
some encryption features into their projects and not struggle with a
complex Java API to do so. This small library provides some utility
functions atop of Bouncycastle's OpenPGP provider:

http://thi.ng/crypto

Example:

(require '[thi.ng.crypto.core :refer :all])

;; generate a new RSA keypair, private w/ identity & passphrase, save
as armored files
(-> (rsa-keypair 2048)
    (generate-secret-key "[email protected]" "hello")
    (export-keypair "alice.pub.asc" "alice.sec.asc" true))
; => nil

;; create dummy file
(spit "foo.txt" "hello world!")
; => nil

;; note: for files `encrypt-file` can be used alternatively,
;; but `encrypt-stream` is more general purpose
(encrypt-stream "foo.txt" "foo.gpg" (public-key "alice.pub.asc"))
; => nil

;; decrypt with secret key & passphrase
(decrypt-stream "foo.gpg" "foo-decrypted.txt" (secret-key
"alice.sec.asc") "hello")
; => #<BufferedOutputStream java.io.BufferedOutputStream@5dbe43af>

(slurp "foo-decrypted.txt")
; => "hello world!"

Best, K.
-- 
Karsten Schmidt
http://postspectacular.com

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to