GithubHelp home page GithubHelp logo

shah-dhwanil / django-cryptographicfields Goto Github PK

View Code? Open in Web Editor NEW
7.0 2.0 2.0 153 KB

A Django app for cryptography in Django Models.

Home Page: https://django-cryptographicfields.readthedocs.io/en/latest/

License: BSD 3-Clause "New" or "Revised" License

Python 100.00%
cryptography django orm encryption-decryption cryptographicfields django-crypto-fields encrypted-fields django-models django-cryptographicfields encryption

django-cryptographicfields's Introduction

Django-CryptographicFields

A Django app for using cryptography in Django Models. It support bi-directional cryptography.

Check out the documentation :- Django-CryptographicFields

Requirements

  • Python (3.6+)
  • Pycryptodome (3.9+)
  • Django (3.0+)
  • Timestring (1.6.0+) Mandatory if python < 3.7

Quick start

1.Install Django-CryptographicFields

Install Django CryptographicFields using PIP:-

pip install Django-CryptographicFields

2. Add "CryptographicFields" to your INSTALLED_APPS setting like this:

    INSTALLED_APPS = [
        ...
        'CryptographicFields',
    ]

3.Custom Encryption Key

Set custom Encryption Key in settings.py Make sure that key length is greater than or equal to 50 otherwise it will raise an error

CRYPTOGRAPHIC_KEY="your_key"

Creating Models using CryptographicFields

Cryptography by example

from CryptographicFields import fields
from django.db import models

class CryptogaphicModel(models.Model):
    name=fields.CharField(max_length=120)

The data will now be automatically encrypted when saved to the database.& decrypted when data is retrieved.

Advantages over other projects:-

  1. Supports data retrival
  2. Supports custom query
  3. Supports Q() queries
  4. Supports Ordering data through python functions
  5. Supports Sorting data through python functions
  6. Supports 'startswith' lookups for all String Based Fields
  7. Supports 'date' lookup for Date,DateTime Fields
  8. Supports 'time' lookup for TimeField

For More Information check out the documentation :- Django-CryptographicFields

django-cryptographicfields's People

Contributors

shah-dhwanil avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

suavelad al-bezd

django-cryptographicfields's Issues

Length of Encryption Key is '1' which is less than '50'

Followed Quick start guide entirely, generated my own ENCRYPTION_KEY.
All requirements met

Received ExceptionType: LengthError

Also, small type on import
from CrptographicFields import fields
should be
from CryptographicFields import fields

Error while using Binary Field with memoryview object

Describe the bug
There an error while using Binary Field with input type "memoryview" object

To Reproduce
Steps to reproduce the behavior:

  1. Create a model with Binary Field
  2. Create an instance of "memoryview" with some data
  3. Pass it as argument to your model & save it

Expected behavior
There would be a Attribute error saying "memoryview" object has no attribute 'bytes'
Screenshots
Error)

Version Information

  • Python:- 3.8
  • Package Version:- 2.0.0
  • Database Engine:- SQLite
  • Os:- Windows

Small typo at import

just a heads up, small type at import
from CrptographicFields import fields
should be
from CryptographicFields import fields

Ordering Data

Problem
Ordering data isn't possible as data is stored in encrypted in form in database. So database in unable to order data. Specific order of data is required in some situation

Solution I would like
Ordering function that orders the data when they are in decrypted form

Speed is considerably reduced when fetching large amount of data from encrypted fields.

Is your feature request related to a problem? Please describe.
Fetching large amount of data takes a lot of processing time (CPU)

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Filtering data

Problem
Sorting data isn't possible as data is stored in encrypted in form in database. So database in unable to sort data. Sorting is required in some situation

Solution I would like
Sorting function that sorts the data when they are in decrypted form

Infinite loop in FilePathField

Describe the bug
There is an infinite loop going on when using FilePathField

To Reproduce
Steps to reproduce the behavior:
1.Create a model with model with FilePathField
2.Create a object with the above model
Expected behavior
There in an infinite loop between clean & to_python function
Screenshots
Screenshot (3)

Version Information

  • Python 3.8
  • Package Version 2.0.0
  • Database Engine SQlite
  • Os Windows

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.