{"id":16177617,"url":"https://github.com/raphaelm/django-pgrowcrypt","last_synced_at":"2025-04-07T11:27:53.347Z","repository":{"id":136535801,"uuid":"162849424","full_name":"raphaelm/django-pgrowcrypt","owner":"raphaelm","description":"[EXPERIMENT] Row-level encryption based on pgcrypto for Django","archived":false,"fork":false,"pushed_at":"2018-12-22T23:36:23.000Z","size":19,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-13T14:16:32.604Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/raphaelm.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-12-22T23:31:26.000Z","updated_at":"2018-12-22T23:42:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"f213c6bd-00b6-4b11-ac5f-d78709816846","html_url":"https://github.com/raphaelm/django-pgrowcrypt","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raphaelm%2Fdjango-pgrowcrypt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raphaelm%2Fdjango-pgrowcrypt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raphaelm%2Fdjango-pgrowcrypt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raphaelm%2Fdjango-pgrowcrypt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/raphaelm","download_url":"https://codeload.github.com/raphaelm/django-pgrowcrypt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247642812,"owners_count":20971980,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T05:09:42.365Z","updated_at":"2025-04-07T11:27:53.314Z","avatar_url":"https://github.com/raphaelm.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Row-level encryption based on pgcrypto for Django\n=================================================\n\n**WARNING:** This is an experiment including some nasty ORM hacks and we do not yet recommend to use it in production.\n\n.. image:: https://img.shields.io/pypi/v/django-pgrowcrypt.svg\n   :target: https://pypi.python.org/pypi/django-pgrowcrypt\n\n.. image:: https://travis-ci.com/raphaelm/django-pgrowcrypt.svg?branch=master\n   :target: https://travis-ci.com/raphaelm/django-pgrowcrypt\n\n.. image:: https://codecov.io/gh/raphaelm/django-pgrowcrypt/branch/master/graph/badge.svg\n   :target: https://codecov.io/gh/raphaelm/django-pgrowcrypt\n\n\nThis allows the encryption of values in specific columns using symmetric cryptography with the ``pgcrypto`` extension.\nThis is similar to `django-pgcrypto-expressions`_ and `django-pgcrypto-fields`_, but different in the regard that those\ntwo encrypt all data with the *same* system-wide key and handle encryption fully transparently. In contrast, this library\nallows to use *different* key per row/per query. A common use case would be to encrypt sensitive data with a key specific\nto a user or to a client in a multi-tenant application.\n\nKeep in mind that the actual encryption and decryption is performed in the database and the key is being sent to the database\nin plain text, so this requires the connection to the database to be either local or encrypted and requires you to trust the\ndatabase administrator.\n\nFurther limitations:\n\n* Works only on PostgreSQL (obviously)\n\nUsage\n-----\n\nYou will need to use both a custom model base class and a custom field class::\n\n    from pgrowcrypt.models import EncryptedModel, EncryptedTextField\n\n\n    class Book(EncryptedModel):\n        title = EncryptedTextField()\n\n        def __str__(self):\n            return self.title\n\n\n    from django.db import models\n    from jsonfallback.fields import FallbackJSONField\n\n\nThen, you can work with the model like this:\n\n    \u003e\u003e\u003e b = Book(title='Harry Potter', _key='pgLWLYqQb4zR9K1Im3GUsLXaILnU7q')\n    \u003e\u003e\u003e b.save()\n    \u003e\u003e\u003e Book.objects.with_key('pgLWLYqQb4zR9K1Im3GUsLXaILnU7q').all()\n    \u003cQuerySet[\u003cBook: Harry Potter\u003e]\u003e\n\nLicense\n-------\nThe code in this repository is published under the terms of the Apache License. \nSee the LICENSE file for the complete license text.\n\nThis project is maintained by Raphael Michel \u003cmail@raphaelmichel.de\u003e. See the\nAUTHORS file for a list of all the awesome folks who contributed to this project.\n\n.. _django-pgcrypto-expressions: https://github.com/orcasgit/django-pgcrypto-expressions\n.. _django-pgcrypto-fields: https://github.com/incuna/django-pgcrypto-fields","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraphaelm%2Fdjango-pgrowcrypt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraphaelm%2Fdjango-pgrowcrypt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraphaelm%2Fdjango-pgrowcrypt/lists"}