skillfed

django-cryptography

Easily encrypt data in Django

django-cryptography v1.1 197.1K downloads/30d#9,768 on PyPI408
Permissive license BSD-3-Clause DORMANT released

What it is and what it does

Django Cryptography provides a lightweight wrapper around the cryptography library to encrypt individual Django model fields transparently. When you wrap a field with the encrypt() function, data is automatically encrypted before storage and decrypted on retrieval, using symmetric encryption that supports bidirectional access. The package also offers a drop-in replacement for Django's built-in cryptographic primitives, allowing you to substitute cryptography as the backend provider.

The package is designed for developers who need to protect sensitive data at the field level without managing encryption keys manually or writing custom serialization logic. It integrates directly into Django's ORM, so encrypted fields behave like normal fields in queries and model definitions. Dependencies are minimal: Django, cryptography, and django-appconf for configuration management.

Use it for:

  • Store personally identifiable information (names, emails, phone numbers) encrypted in the database while keeping queries simple.
  • Protect payment card details or financial account numbers in a Django application without custom encryption middleware.
  • Replace Django's default cryptographic backend with cryptography for stronger or more modern algorithms.
  • Encrypt sensitive user preferences or medical data in healthcare or financial Django applications.
  • Add field-level encryption to an existing Django project with minimal code changes.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Wraps Python's cryptography library to add transparent field-level encryption to Django models, and provides a drop-in replacement for Django's own cryptographic primitives.

Yes, if you are using Django 2.2, 3.2, or 4.0 and need straightforward field-level encryption without external key management. The package is stable and has no known vulnerabilities. However, be aware that the last release was in April 2022; if you require support for newer Django versions or active maintenance, evaluate whether the dormant status aligns with your project's lifecycle.

Install

django-cryptography on PyPI

pip

pip install django-cryptography

uv

uv add django-cryptography

poetry

poetry add django-cryptography

Installing django-cryptography

Before you install

Low install friction with a pure-Python wheel. Maintenance is dormant—last release was in April 2022—but the repository remains active and the package is marked Production/Stable. Suitable for projects that do not require frequent updates.

License in practice

BSD-3-Clause is permissive; you may use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.

Quickstart

pip install django-cryptography

from django.db import models
from django_cryptography.fields import encrypt

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

Requires Django 2.2, 3.2, or 4.0 and cryptography 2.0 or later; Python 3.6 or higher.

Verify before relying

  • Whether the package works with Django versions released after 4.0.
  • Current compatibility with cryptography versions beyond 2.0.
  • Performance impact of field-level encryption on query operations.

Package facts

License BSD-3-Clause (permissive)
Python support supports the current Python release (>=3.6)
Install friction low — pure-Python wheel
Runtime dependencies 3 — Django, cryptography, django-appconf
Maintenance dormant — 1,591 days since the last release
Last repo commit
First released
Downloads 197,144/month — #9,768 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: django_cryptography-1.1-py2.py3-none-any.whl

Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentFramework :: DjangoFramework :: Django :: 2.2Framework :: Django :: 3.2Framework :: Django :: 4.0Intended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Internet :: WWW/HTTPTopic :: Security :: Cryptography

Tags

django field encryptionencrypt django model fieldsdatabase encryption djangosymmetric encryption djangodjango cryptography wrapperdjango sensitive data protectionbidirectional field encryption
django-ormfield-encryptiondata-protection

More WWW/HTTP packages