we have a Django Rest app with PostgreSQL db that in some parts business force us to encrypt data. but what I need is searching and heavy queries on data to be executed, I've used django-pgcrypto-fields but it's not updated until 2021 and have some bugs for production,what can I do?encrypting data directly does't allow me to execute queries for search the data,also I can't find any other library to help me.
CodePudding user response:
You can use django-cryptography package. The data will be automatically encrypted when saved to the database. It uses an encryption that allows for bi-directional data retrieval.
CodePudding user response:
Use the Sign package to encrypt the certain field of data
It's an inbuilt Django package so it is safe & secure also.
DB field can be charfield
from django.core.signing import Signer
signer = Signer()
value = signer.sign('My string')
to decrypt just use
original = signer.unsign(value)
can add additional security with
signer = Signer(salt='extra')
Check the below link for reference