Skip to content

replikativ/geheimnis

Repository files navigation

geheimnis

Clojars Project cljdoc badge

Implementation of cross-platform (clj, cljs) cryptography. The library supports AES/CBC/Pkcs7Padding with a 256 bit key and RSA with arbitrary keysize, as well as simple MD5 hashing. If you need something which is not provided, please open an issue. While geheimnis is not supposed to cover all cryptographic options like OpenSSL compatibility with a big set of chiffres, common and useful algorithms to do standard public-private key solutions should be provided with a solid implementation. geheimnis is supposed to be batteries included on Clojure level, so doing the right thing should be easy.

This library is still very young, but encryption methods work between platforms and are initialized with proper upstream/documented parameters. If you hit any problems, open an issue.

Usage

Add this to your project dependencies:

deps.edn:

org.replikativ/geheimnis {:mvn/version "0.1.15"}

Leiningen/Boot:

[org.replikativ/geheimnis "0.1.15"]

RSA Example

(require '[org.replikativ.geheimnis.rsa :refer [gen-key encrypt decrypt]]
         '[org.replikativ.geheimnis.base64 :refer [encode decode]])

(def rsa-key (gen-key 1024))

(decrypt rsa-key (encrypt rsa-key (BigInteger. "123")))

(encode (:pub-key rsa-key)) ;; => #geheimnis/Base64 "AAECAwQFBgcICQ=="

AES Example

(require '[org.replikativ.geheimnis.aes :refer [encrypt decrypt]])

(decrypt "s3cr3T" (encrypt "s3cr3T" (byte-array (range 10))))

MD5 Example

(require '[org.replikativ.geheimnis.md5 :refer [encode]])

(encode "geheimnis") ;; => "525e92c6aa11544a2ab794f8921ecb0f"

Development

Run tests:

clojure -M:test

Format code:

clojure -M:format      # Check formatting
clojure -M:ffix        # Auto-fix formatting

Build JAR:

clojure -T:build jar

Install locally:

clojure -T:build install

Changes from io.replikativ to org.replikativ

This library has been migrated from io.replikativ/geheimnis to org.replikativ/geheimnis.

Namespace changes:

  • geheimnis.*org.replikativ.geheimnis.*

Old (deprecated):

(require '[geheimnis.rsa :refer [gen-key]])

New:

(require '[org.replikativ.geheimnis.rsa :refer [gen-key]])

TODO

License

Copyright © 2016-2025 Christian Weilbach, Konrad Kühne

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

About

Cross-platform cryptography between cljs and clj.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors