Giter Club home page Giter Club logo

tempel's Introduction

Taoensso open source
Documentation | Latest releases | Slack channel

Tempel

Data security framework for Clojure

Tempel is a lightweight encryption framework that wraps the JVM's native crypto facilities to provide a particularly high-level Clojure API for easily protecting your users' data.

More than another collection of crypto utils, Tempel offers a coherent and opinionated API for secure data management and is focused on helping you with the toughest parts of actually using encryption in practice.

Its tiny API and focus on smart keychains helps shield you from unnecessary and error-prone complexity, greatly simplifying the most common data security needs.

Latest release/s

Main tests Graal tests

See here for earlier releases.

Why Tempel?

  • Easy-to-use, high-level API focused on common tasks like logins, encryption, signing, etc.
  • Reasonable defaults including choice of algorithms and work factors.
  • Future-proof data formats with auto-updated algorithms and work factors over time.
  • Support for ⧉ symmetric, ⧉ asymmetric (public-key), and ⧉ end-to-end (E2EE) encryption.
  • Automatic ⧉ scrypt and ⧉ pbkdf2 support for easy password-based key stretching.
  • Simple key management API for password resets, key rotations, etc.
  • Extensive beginner-oriented documentation, docstrings, and error messages.
  • Comprehensive test suite with >60k unit tests.

Note that Tempel is not intended for interop with other cryptographic tools/APIs!

Video demo

See for intro and usage:

Tempel demo video

Quick example

(require
  '[taoensso.tempel :as tempel]
  '[taoensso.nippy  :as nippy])

;; Create a new private `KeyChain`:
(def my-keychain! (tempel/keychain))
;; => {:n-sym 1, :n-prv 2, :n-pub 2, :secret? true}

;; Use our `KeyChain` to encrypt some data:
(def my-encrypted-data
  (tempel/encrypt-with-symmetric-key
    (nippy/freeze "My secret data")
    my-keychain!)) ; => Encrypted bytes

;; Get back the original unencrypted data:
(nippy/thaw
  (tempel/decrypt-with-symmetric-key
    my-encrypted-data my-keychain!)) ; => "My secret data"

;; It's safe to store encrypted `KeyChain`s:
(def my-encrypted-keychain
  (tempel/encrypt-keychain my-keychain!
    {:password "My password"})) ; => Encrypted bytes

;; Get back the original unencrypted `KeyChain`:
(= my-keychain!
  (tempel/decrypt-keychain my-encrypted-keychain
    {:password "My password"})) ; => true

;; `KeyChain`s also support:
;;   - `encrypt-with-1-keypair`
;;   - `encrypt-with-2-keypairs`
;;   - `sign`

;; See docstrings and/or wiki for more info!

Documentation

Roadmap

Tempel has a fixed scope, and is fully complete. I'm happy with its design and implementation, and believe it meets all its objectives in its current form. I'm not anticipating significant changes.

Still, given the sensitivity of the problem domain, I plan to approach Tempel's official stable release as a phased rollout to allow time for feedback before locking things down:

Phase Date Release Appropriate for
2024-02 v1.0-RC1 Staging, with ephemeral or low-value data
2024-05 v1.0 final Production, with real data

v1.0 final will be considered "done"- the library is expected to need+see only minimal maintance from that point.

Disclaimer

Important: while Tempel has been written and tested with care, the nature of the problem domain inevitably means that bugs and/or misuse can be especially harmful and/or easy to make.

Bugs and/or misuse could lead to security vulnerabilities or even permanent data loss.

Please be very careful evaluating Tempel and/or other cryptographic libraries/frameworks before use, especially new libraries/frameworks like Tempel!

Security

See here for security advisories and/or to report security vulnerabilities.

Funding

You can help support continued work on this project, thank you!! 🙏

License

Copyright © 2023-2024 Peter Taoussanis.
Licensed under EPL 1.0 (same as Clojure).

tempel's People

Contributors

ptaoussanis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

iarenaza

tempel's Issues

How would tempel work with delegated authentication - OpenID Connect and MFA / OTP ?

Hi @ptaoussanis ,

I watched the demo https://www.youtube.com/watch?v=sULZVFhR848 and I quite like where the project is heading and that it provides a pretty good flow for solving common problems developers are facing when trying to adopt data encryption at rest.

I am curios how would tempel work with (more common IMO scenarios) of third party authentication systems - like OpenID Connect (SSO in general - social login).

I do imagine one option would be for users to setup a dedicated password for the keystore.
Another things that could be addressed in the docs / future demos would be how tempel will handle multi factor authentication and WebAuthn or one time password systems.

The way I think about it right now it that users setup a dedicated password for the keystore that they have to enter after login.
The password could be an OTP code perhaps ( a pin) ?! .

An example flow of using tempel with OTP would be great as I believe it's a common use case.
As a side note I am doing DevOps and working with these ~ daily .
SSO is quite important for auth and I would not go forward without it.

I did not give these too much thought but from the video I believe you have given security and encryption quite some thought.
I hope you can share your ideas / examples around these subjects.

I am happy that I saw your demo now since I am working on a system where I need to store some JWT tokens encrypted at rest with the option of being able to decrypt them by admin.
I hope to get some time to work with tempel on that soon.

p.s. Than you! for writing tempel !

Thanks,
Eugen

Does it work with babashka?

Hi,

I was curios if there is a plan to have the library compatible with babashka.
I know @borkdude added some crypto stuff when I needed and it might be enough.

Discuss: Support for automated decrypt / remote unlock for apps - clevis / tang ?

This might be in a companion library but Clevis and Tang implement a protocol for automated decryption (remote unlock).

It might be useful for tempel to support at least the client part if not more.

Clevis and Tang provide a way for a system to decrypt secrets if it's in a specific network or has access to TPM.
Seemed quite ingenious to me and worth mentioning in the context of tempel.

Might be useful for starting an application that needs to decrypt a bunch of service (the admin) credentials without requiring user input.

https://github.com/latchset/clevis
https://github.com/latchset/tang

Have you considered the OWASP recommendations for password storage?

Moving a question from @ieugen below:


A different question (maybe another issue?).
Have you considered the OWASP recommendations for password storage?
Would it make sense to have an opinionated module that users can use and get Tempel with pre-configured options following OWASP recommendations ?

I know some people who do compliance find these certifications / recommendations very important.
I know they change over time so adding the year in the name would make it easy to check and switch: :owasp-2024-xxx .

https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html#maximum-password-lengths

Tempel v1.0.0 final

  • Update deps
  • Add MFA stuff?
  • Add extra reserve layer to data formats?
  • Extend docs re: OpenID, OWASP, etc.

Add support for ChaCha20-Poly1305 AEAD

Support for ChaCha20-Poly1305 was added in JDK 11 in 2018 (https://openjdk.org/jeps/329). It's a very popular alternative to AES-GCM, due to its performance [1], and the fact that its used in a lot of security network protocols and tools[2].

[1] Faster than AEC-GCM without hardware AES acceleration, and similar or better performace in multi-core machines even with AES hardware acceleration; see https://en.wikipedia.org/wiki/ChaCha20-Poly1305#Performance
[2] IPSec, TLS 1.2, DTLS 1.2, TLS 1.3, Wireguard, OTRv4 and multipe other protocols (according to https://en.wikipedia.org/wiki/ChaCha20-Poly1305#Use)

Quantum-safe example

If any post-quantum crypto key exchange algorithms are supported by tempel, I'd love to see some examples how to use them.

Inbility to resolve parsed EDN symbol when upgrading to 1.0.0-beta1

Description

When upgrading to 1.0.0-beta1 ( from 1.0.0-alpha1) I noticed if I pass JVM arg
-Dtaoesnsso.timbre.config.edn=some-symbol - some-symbol is not being evaluated.

Steps to reproduce

Gist
(its a clj tools project)

OS/Java version

Description: Ubuntu 22.04.3 LTS
Release: 22.04

openjdk version "17" 2021-09-14
OpenJDK Runtime Environment Temurin-17+35 (build 17+35)
OpenJDK 64-Bit Server VM Temurin-17+35 (build 17+35, mixed mode, sharing)

Notes

If I do a diff on the dependency trees (alpha vs beta) I get :

< com.taoensso/tempel 1.0.0-alpha1
<   . com.taoensso/encore 3.74.0
<     . org.clojure/tools.reader 1.3.6
---
> com.taoensso/tempel 1.0.0-beta1
>   . com.taoensso/encore 3.76.0
>     . org.clojure/tools.reader 1.3.7

In encore between 3.74.0 and 3.76.0 I noticed this .

It looks like the feature that resolves edn symbols was removed ?

Is the feature deprecated or is there another way to achieve the same effect?

I didn't know if I should file this ticket here or not. Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.