Skip to main content

A set of primitives for easily encrypting data in Django, wrapping the Python Cryptography library. Also provided is a drop in replacement for Django’s own cryptographic primitives, using Cryptography as the backend provider.

Do not forget to read the documentation.

GitHub Workflow Status (branch) Codecov branch

Cryptography by example

Using symmetrical encryption to store sensitive data in the database. Wrap the desired model field with encrypt to easily protect its contents.

from django.db import models

from django_cryptography.fields import encrypt


class MyModel(models.Model):
    name = models.CharField(max_length=50)
    sensitive_data = encrypt(models.CharField(max_length=50))

The data will now be automatically encrypted when saved to the database. encrypt uses an encryption that allows for bi-directional data retrieval.

Requirements

Installation

pip install django-cryptography

Metadata

Release files for django-cryptography-django5 2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-cryptography-django5 2.2
File Size Uploaded
django_cryptography_django5-2.2.tar.gz 33.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-cryptography-django5 2.2
File Interpreter ABI Platform
django_cryptography_django5-2.2-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 62.2 kB

Release files / django_cryptography_django5-2.2.tar.gz

Download URL django_cryptography_django5-2.2.tar.gz
Size 33.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b149685032cbbaf8b88c1b3ff6d8de7a107bb1b3cff9e84e9b32d0c61ca08346
BLAKE2b-256 checksum
How to use checksums
68e40e412ef4fa219db4e0a5f0042aba832030261eab0d7ceb3c5c91df3b74e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.0.0 CPython/3.12.3

Release files / django_cryptography_django5-2.2-py2.py3-none-any.whl

Download URL django_cryptography_django5-2.2-py2.py3-none-any.whl
Size 28.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
73b5d4597d2fd4accca0c971dad7aacfcef24cb7322512f4f94b020cd55b57ff
BLAKE2b-256 checksum
How to use checksums
800c874f03885f20d70ee116cbffb4ea7434fb4c3325baa4015c7bbeb3b7fa6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

2.2 This release

2 release files

2.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page