1. Krptn

Quick Install:

pip install krptn

Note: we don’t have pre-built extensions for all platforms. Please see the installation section in this documentation for more info.

If after reading this, you like our project, please consider staring on GitHub!

1.1. What problem do we solve?

We all love Django and other web frameworks! However, their primary focus is creating websites - not implementing secure storage for user data. One example is Django’s built-in authentication system. While it hashes the password, it does not encrypt user data for you. Encryption is left to the developer…

Wouldn’t it be nice if encryption would also be handled? Perhaps it could be handled in a zero knowledge model, such that, without the user entering credentials, not even the database administrator can read it?! Maybe it could even use FIPS validated cryptography. This is exactly what we do!

To prove that such is possible, we have a Flask and Django example on GitHub.

Krptn Visual

1.2. What is this?

A user authentication and access management system (IAM) with Zero Knowledge security. It is available as a Python extension module. We, however, have certain limitations.

How do we achieve this?

  • All data is encrypted (any data can be requested by the developer to be secured)

  • Only the appropriate users’ credentials can unlock the cryptosystem (this protects you from server-side attacks)

This gives you Zero Knowledge security (one of the most secure available) without ever needing to even notice it! It protects you from server side attacks.

1.3. Features

  • Secure Storage of Data

  • User Authentication

  • FIPS Validated Cryptography (via OpenSSL 3)*

  • Secure memory wiping (except on PyPy)

  • FIDO Passwordless*

  • Integration with popular web frameworks

* FIDO (passwordless) does not use FIPS validated resolvers

1.3.1. Example usage of the Crypto Class

1from krypton import basic
2# Create an instance of Crypto - a class for encrypting and storing sensitive data.
3myCrypto = basic.Crypto()
4pwd = "Perhaps provided by the user"
5# It supports C.R.U.D. operations:
6id = myCrypto.secureCreate("Example data", pwd) #id is an integer
7print("The data is:")
8print(myCrypto.secureRead(id, pwd)) # prints Example data

1.4. Installation

Recommended: install using PIP:

pip install krptn

Because we do not have pre-built extensions for all platforms, you may need to build from source.

1.5. User Auth

See User Auth.

To use FIDO/WebAuthn with User Auth, please see Krptn’s FIDO Documentation.

1.6. Integration with web frameworks

1.7. Crypto Class

Crypto Class

1.8. Key Management System

This module uses a custom Key Management System for AES-256 Keys. See KMS for more information.

Note: we have considered using HSM as a key management system. We, however, have decided that we will not integrate HSMs because it would be difficult to maintain Zero Knowledge security.

Of course, all data is securely encrypted even if it is not via an HSM!

If you want, you can encrypt the SQL database using HSM managed keys for additional security.

1.9. Use custom databases

Here is an example of how to set the database to be used:

1import krypton
2krypton.configs.SQLDefaultCryptoDBpath = "sqlite+pysqlite:///Path/example.db"
3krypton.configs.SQLDefaultKeyDBpath = "sqlite+pysqlite:///Path/key.db"

To see what these settings strings should contain please see Databases

1.10. Settings


1.11. Planned

  • APIs for other languages

  • Premium features