Skip to main content

Easily encrypt data in Django

Project description

Django Cryptography 5

Note: This is a fork of the official django-cryptography project, which appears to be abandoned. The only change made in this fork that the patch that fixes Django 5 compatibility has been applied and pushed to pypi as a new project.

You can install the forked version from pypi with the following command:

pip install django-cryptography-5

The rest of this README is the original README from the official project.

Django Cryptography

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_cryptography_5-2.0.3.tar.gz (34.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_cryptography_5-2.0.3-py2.py3-none-any.whl (13.3 kB view details)

Uploaded Python 2Python 3

File details

Details for the file django_cryptography_5-2.0.3.tar.gz.

File metadata

File hashes

Hashes for django_cryptography_5-2.0.3.tar.gz
Algorithm Hash digest
SHA256 f4e140a9339e14785fd6c2cbb836c370dcd00099279181fb98b002728dbdd63e
MD5 f61135b5a3dd54a8f906fdaf242a2e49
BLAKE2b-256 ae8b214ea0d3726eeb99654213aae57463f38b2b82b3e10a746df35bd8361656

See more details on using hashes here.

File details

Details for the file django_cryptography_5-2.0.3-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django_cryptography_5-2.0.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 0f53a688e111c1b015475a80c54d74d5c84b62ffbaba50577cb767dd2fc9c1c3
MD5 07387527c1c594ed861ce3390d626fbf
BLAKE2b-256 f3a65dd7c0fc1e4af6db2df1fb779e271059d7a942039bf82670924c08d37dfb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page