skillfed

django-fernet-encrypted-fields

Symmetrically encrypted model fields for Django

django-fernet-encrypted-fields v0.4.0 359.1K downloads/30d#7,253 on PyPI149
License unclear Active released

What it is and what it does

django-fernet-encrypted-fields adds transparent encryption to Django model fields using Fernet symmetric encryption from the cryptography library. When you define an encrypted field, data is automatically encrypted before storage and decrypted on retrieval, with the encryption key managed via Django settings.

The package supports key rotation through SALT_KEY, which can be a list where the first key encrypts new data and all keys are tried for decryption. It also supports SECRET_KEY rotation via SECRET_KEY_FALLBACKS for Django >=4.1. The encrypted fields maintain the same APIs as their unencrypted Django counterparts.

Use it for:

  • Encrypt personally identifiable information in a Django database without changing application code.
  • Implement key rotation policies by maintaining a list of SALT_KEY values and re-saving records to migrate to new encryption keys.
  • Store sensitive data encrypted at rest while maintaining Django ORM access.
  • Migrate from an older django-encrypted-fields package to a maintained successor.
  • Comply with data protection requirements by encrypting specific model fields without a separate encryption layer.

Worth the install?

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

Provides Django model fields that encrypt data at rest using Fernet symmetric encryption, storing encrypted values in the database while maintaining a standard Django field API.

Yes, with conditions. The package is actively maintained, has low install friction, and solves a real problem for encrypting sensitive Django model fields. However, verify the license status before use—the metadata shows no SPDX or raw license text. Requires Python >=3.10 and Django 4.2+, so confirm compatibility with your project's versions.

Install

django-fernet-encrypted-fields on PyPI

pip

pip install django-fernet-encrypted-fields

uv

uv add django-fernet-encrypted-fields

poetry

poetry add django-fernet-encrypted-fields

Installing django-fernet-encrypted-fields

Before you install

Low install friction with only two runtime dependencies (Django and cryptography). The package is actively maintained with a recent release and no known vulnerabilities.

License in practice

License status is unclear—no SPDX identifier or raw license text is available in the package metadata. Verify the actual license before use in commercial or proprietary projects.

Quickstart

pip install django-fernet-encrypted-fields

# In settings.py
SALT_KEY = '0123456789abcdefghijklmnopqrstuvwxyz'

# In models.py
from django.db import models

class MyModel(models.Model):
    text_field = EncryptedTextField()

Requires Python >=3.10 and Django 4.2 or later.

Verify before relying

  • Which specific encrypted field types are available and their exact APIs.
  • Whether key rotation via SALT_KEY list works with all supported Django versions.
  • Performance impact of encryption/decryption on query performance and bulk operations.
  • How SECRET_KEY_FALLBACKS interacts with the SALT_KEY rotation mechanism.

Package facts

License not declared (unclear)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 2 — Django, cryptography
Maintenance actively maintained — 122 days since the last release
Last repo commit
First released
Downloads 359,135/month — #7,253 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: django_fernet_encrypted_fields-0.4.0-py3-none-any.whl

Tags

django encrypted fieldsfernet encryption djangodatabase field encryptiondjango data at rest encryptionsymmetric encryption django modelsencrypted model fieldsdjango cryptography fields
django-ormencryption-at-restkey-rotation

More Cryptography packages