Encryption at rest made easy
cf-crypt is a package to help you keep all you data resting on disk secure. It make encrypting your data at rest as easy as reading and writing from a file.
>>> from cfcrypt import CryptFileTextIO
>>> with CryptFileTextIO('./my_file.crpt', 'w', encryption_key, identity_key) as fh:
... fh.write('Super secret, secret squirrel plans.')
Install
Install the package from pypi.org/project/cf-crypt using pip
$ python -m pip install cf-crypt
[...]
Successfully installed cf-crypt
Quick Start
Generate Keys
These keys are generated securely in memory.
Like all in memory variables they will disappear when your script ends. We really need our keys to stick around for as long as we want to decrypt our data.
>>> from cfcrypt.rsa.key_helpers import generate_private_key
>>> encryption_key = generate_private_key()
>>> identity_key = generate_private_key()
Save Keys
Keys can be serialized to the PEM format and saved to disk.
>>> from cfcrypt.rsa.key_helpers import private_key_to_pem_file
>>> private_key_to_pem_file('./my_encryption_key.pem', encryption_key)
>>> private_key_to_pem_file('./my_identity_key.pem', identity_key)
These PEM files are quite literally the keys to your data.
Load Keys
If you set a password on the PEM files you will need it to load them from disk.
>>> from cfcrypt.rsa.key_helpers import pem_file_to_private_key
>>> encryption_key = pem_file_to_private_key('./my_encryption_key.pem')
>>> identity_key = pem_file_to_private_key('./my_identity_key.pem')
Encrypt
Encryption is really easy, just use CryptFileTextIO like a regular file interface.
>>> from cfcrypt import CryptFileTextIO
>>> with CryptFileTextIO('./my_file.crpt', 'w', encryption_key, identity_key) as fh:
... fh.write('Super secret, secret squirrel plans.')
Decrypt
Decryption is also really easy, just use CryptFileTextIO like a regular file interface.
>>> from cfcrypt import CryptFileTextIO
>>> with CryptFileTextIO('./my_file.crpt', 'r', encryption_key, identity_key) as fh:
... data = fh.read()
>>> data
'Super secret, secret squirrel plans.'
More…
There are a bunch of other useful encryption related tools in the module. See the documentation (cf-crypt.readthedocs.io/en/latest) for details.
String encryption
Python object serialization + encryption
RSA signing & verification
File & folder encryption
Key management.
Metadata
Release files for cf-crypt 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cf-crypt-0.1.1.tar.gz | 9.2 MB | Without provenance | Details for cf-crypt-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cf_crypt-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for cf_crypt-0.1.1-py3-none-any.whl |
Total release size: 9.2 MB
Release files / cf-crypt-0.1.1.tar.gz
| Download URL | cf-crypt-0.1.1.tar.gz |
|---|---|
| Size | 9.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
818080f5966dfc1969c181cafad5b20530dee553d29a70ef163a3a2bf5dbe995
|
|
BLAKE2b-256 checksum How to use checksums |
127911a0201bd5115558799de67f664a6092590c4d4321beabbcb208f7465a2f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.5 CPython/3.8.9 Linux/5.4.72-microsoft-standard-WSL2
|
Release files / cf_crypt-0.1.1-py3-none-any.whl
| Download URL | cf_crypt-0.1.1-py3-none-any.whl |
|---|---|
| Size | 26.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
82ae1b13216c01c2021b0265bc2fd5ca044a877942a8e52c038b648c0925df33
|
|
BLAKE2b-256 checksum How to use checksums |
0f99e6ee5add72ae19cb60362e6e6491d96972faaac62fc2b7e0c68f4c39d316
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.5 CPython/3.8.9 Linux/5.4.72-microsoft-standard-WSL2
|
Security for cf-crypt 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.