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

Release files for django-cryptography 1.1

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

Built distribution (wheel)

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

Release files / django_cryptography-1.1-py2.py3-none-any.whl

Download URL django_cryptography-1.1-py2.py3-none-any.whl
Size 11.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
93702fcf0d75865d55362f20ecd95274c4eef60ccdce46cbdade0420acee07cb
BLAKE2b-256 checksum
How to use checksums
e4bad5e1264c60a86cebb4b63f1dae8220e15dd751e46d24229ee0803f19a66b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.10.2
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