An open API service indexing awesome lists of open source software.

https://github.com/agilecreativity/encrypted-config

Encrypt configuration library for Clojure
https://github.com/agilecreativity/encrypted-config

clojure configuration encryption-tool security-hardening

Last synced: about 1 year ago
JSON representation

Encrypt configuration library for Clojure

Awesome Lists containing this project

README

          

* encrypted-config

[[https://clojars.org/encrypted-config][https://img.shields.io/clojars/v/encrypted-config.svg]]
[[https://jarkeeper.com/agilecreativity/encrypted-config][https://jarkeeper.com/agilecreativity/encrypted-config/status.svg]]

Easy encrypted your configuration in Clojure using the power of [[https://github.com/funcool/buddy][buddy]].

** Basic Usage

*** What you will need to use this library

- [[https://www.java.com/en/download/][Java SDK]]
- [[http://repo1.maven.org/maven2/org/clojure/clojure/1.8.0/clojure-1.8.0.zip][Clojure]]
- [[http://leiningen.org/][Leiningen]] - Build tools for Clojure
-

*** Use in your project

**** Leiningen/Boot
#+BEGIN_SRC clojure :results nil
[encrypted-config "0.1.1"]
#+END_SRC

**** Gradle

#+BEGIN_EXAMPLE
compile "encrypted-config:encrypted-config:0.1.1"
#+END_EXAMPLE

**** Maven
#+BEGIN_SRC xml :results nil

encrypted-config
encrypted-config
0.1.1

#+END_SRC

** Basic Usage:

**** Encrypt a given text

#+BEGIN_SRC clojure :results nil
;; To encrypted a given input-text using the secret-key
(str->encrypted input-text secret-key)

;; You will get back the map of
;; {:encrypted-key
;; :encrypted-text }
#+END_SRC

**** Decrypt value that previously encrypted

#+BEGIN_SRC clojure :results nil
(str->decrypted encrypted-text encrypted-key secret-key)
#+END_SRC

** Example Usages

#+BEGIN_SRC clojure :results nil
(let [input-text "MyP@ssword!"
secret-key "MySec$tKey@"
{:keys [encrypted-key
encrypted-text]}
(str->encrypted input-text secret-key)
;; Now let's decrypt the text we have just encrypted
decrypted-text (str->decrypted encrypted-text
encrypted-key
secret-key)]
(do
(println (str "FYI: input-text : " input-text))
(println (str "FYI: secret-key : " secret-key))
(println (str "FYI: encrypted-key : " encrypted-key))
(println (str "FYI: encrypted-text : " encrypted-text))))
#+END_SRC

Your result will be like:

#+BEGIN_EXAMPLE
FYI: input-text : MyP@ssword!
FYI: secret-key* : MySec$tKey@
FYI: encrypted-key* : b0ed81af1e42b826ccdcabc3fa059d0c
FYI: encrypted-text : 3e8a19218245b48c5f546c902c75deb98077d7e2d7030afde9f0b10a8e3a6bb0
#+END_EXAMPLE

So you can safely store the =encrypted-text= in the property file and decrypted it back safely.

** Links

- [[https://github.com/weavejester/crypto-random/blob/master/src/crypto/random.clj][crypto-random]]
- [[https://github.com/funcool/buddy][buddy - security for Clojure]]

** License

Copyright © 2017 Burin Choomnuan

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