Metadata-Version: 2.0
Name: django-gpg
Version: 0.2.0
Summary: GPG Support for Django
Home-page: https://github.com/arecker/django-gpg
Author: Alex Recker
Author-email: alex@reckerfamily.com
License: GPLv3
Platform: UNKNOWN
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Requires-Dist: Django (==1.11.2)
Requires-Dist: gnupg (==2.3.0)

#+TITLE: Django GPG

[[https://travis-ci.org/arecker/reckerops][file:https://travis-ci.org/arecker/django-gpg.svg?branch=master]]

A GPG implementation for Django.

* Quick Start

1. Install the =django-gpg= package

   #+BEGIN_SRC sh
     git clone https://github.com/arecker/django-gpg.git && cd django-gpg
     python setup.py install
   #+END_SRC

2. Add "django_gpg" to your INSTALLED_APPS setting

   #+BEGIN_SRC python
     INSTALLED_APPS = [
         # ...
         'django_gpg',
     ]
   #+END_SRC

3. Install [[https://www.gnupg.org/download/index.en.html][GnuPG]] on your system (e.g. =apt-get install gnupg=)

4. Run =python manage.py migrate= to create the new models

* Configuration

Include these settings in your =settings.py= to customize django-gpg.
Or just leave this out entirely to use the defaults shown here.

#+BEGIN_SRC python
  django_gpg = {
      # Require a public key for each user
      'PUBLIC_KEY_REQUIRED': True
  }
#+END_SRC

* Models

Each user will now have an associated GPG Profile.  You can add public
keys via the django admin.

[[file:screenshots/admin.png]]

You can encrypt messages using the model method.

#+BEGIN_SRC python
  friend = User.objects.first()
  secret = me.gpgprofile.encrypt('HOOCHIE MAMA')
  print(secret.split('\n'))
  ['-----BEGIN PGP MESSAGE-----',
   '',
   'hQIMA2DlyYO6tqUPARAAjOUCQZQR4TXwQhxa7x6BcrnGkrwu4iYk5T/6BqHce0Gu',
   '81GBVwm04e2ptHO680y1jFqipdx8YLhP2wIjUurVDvEoLLOz/ILsFh8t3vvEGzJj',
   'NN8GR/OqiYcf66Qr/FnfPvd1+KX0zRy3LC96ovGUp1SVGHvniAW8Er20sQ8lLOvs',
   'MCGH7oIwhGcnE7CeR6RuqPNz2IKCquq6yV3wDffBiuglVAu21woh7FL3UIG2T/Sc',
   'YM9Yn9PIY5P4fdVv3X+6f3LL7chbRmGtttw/9UYt4QgVDouUu5NR5H8ZZ1waqfbs',
   'E0aMn93JYMIVEW3uICyNhfLMBbuJS/a/XGwCc18/j5n6Mst+PAljjQD70V9rCYqZ',
   'LorX/3+lx02GSwdg6Yrz/0wndh2iDx7CEEn1vo0MSF6VV7stjhaOngRFFVhUlV2E',
   'dPNZceVk8mqS/TUQL4Rvp8U6jTB+c8vA3ofS6nYl8AGH9Khd21VEIxzgCk2kkREN',
   'Wknj3r6HUROAhewPrX+oGA/TFkiX1XSlOGP2fUnV09wCVJUPaIl0fWv6CcAH0gZ4',
   'gQNeQnKZTMuRg++f7K+RkXIt9p1xkBd2c3kS24LVin6/G8lY6n68Y02GRJHvq1of',
   'yNvhiufy+Tmu30dwmjPjB+9CnD4QCTvvI7ML3H1cJ62nCjSVKqa1M20+7p6urPrS',
   'RwE7dQd3EInA55CBWJZ4HfPmqEnScwoBO4WC3xqL+CGXlI66L70+IebnVYDncTJX',
   '6h58GjoXS4JJdghP48VZtG5TG+XOsYSs',
   '=inGo',
   '-----END PGP MESSAGE-----',
   '']
#+END_SRC

Use queryset methods to encrypt a message for multiple users.

#+BEGIN_SRC python
  from django_gpg.models import GpgProfile
  message = GpgProfile.objects.filter(user=[...]).encrypt('hoochie mama')
#+END_SRC


