Clj-crypto is a wrapper for Bouncy Castle which allows you to easily use cryptography in your clojure app.
Switch branches/tags
Nothing to show
Latest commit 2ed7b22 Nov 10, 2016 @macourtney macourtney Merge pull request #8 from pupeno/master
Upgrade to Bouncy Castle 1.55. All tests seem to pass.


The clj-crypto library is a Clojure wrapper for the Java Bouncy Castle encryption library.


clj-crypto is available is available as a Maven artifact from Clojars Project

To use, simply add [clj-crypto "1.0.2"] to your project.clj


(:require [clj-crypto.core :as crypto])

To read your pkcs12 certificate store:

(def keypair (crypto/get-key-pair-pkcs12 pkcs12-store passwd alias))

This will use the 'Bouncy Castle' as your crypto-provider. If you want to use another, you can supply that as well like so:

(def keypair (crypto/get-key-pair-pkcs12 pkcs12-store passwd alias crypto/sun-provider)) ; use SunJSSE

To obtain your private-key from a key-pair, drop in to java, like so:

(def private-key (.getPrivate keypair)

To sign a message with your private key:

(crypto/sign private-key msg

Of course, you also have your standard functions for base64 encoding

(crypto/decode-base64 (crypto/encode-base64-as-str (.getBytes "sikrit")))


Copyright (C) 2012 Matt Courtney

Distributed under the Eclipse Public License, the same as Clojure.