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 securing them. 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 by the IAM? 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?! This is exactly what we do! Please see our Github Repo, our homepage, or continue reading here, in our documentation, for more information.
1.2. What is this?
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.
Secure Storage of Data
FIPS Validated Cryptography (via OpenSSL 3)*
Secure memory wiping (except on PyPy)
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
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
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
APIs for other languages