Skip to main content

DJANGO OUTBOX ENCRYPTION

Project description

DJANGO OUTBOX ENCRYPTION


Use For Encrypt Environment Variable and Other Encryption Purpose.

Install to your environment : > pip install outbox-encryption

How to use :

This code for create .env.client file

Test using python shell :
> python manage.py shell

Encryption Process :
> from encryption import OutboxEncryption
> lib = OutboxEncryption()
> mplaint_text = {
        'DB_PASSWORD': '',
        'SECRET_KEY': 'xxg_7me8rl2m#a_h2oresgt2#ni=3_4*!ai*=rtsq)yi!g7_5-51xx'
    }
> lib.encrypt_environ('.env.local', mplaint_text)
> print('Show Hidden File to Show .env.local')  # file .env.local is created


Decryption Process :
Run inside settings.py (django project settings)            
> lib.set_keyword_local('env_outbox_encrypt')   # this is use for local environment, env_outbox_encrypt only exists in local, not in server
> mplaint_key = list(mplaint_text.keys())   # List of key variable that must be encrypt decrypt before set or get data
> mplaint_list = ['ALLOWED_HOSTS']    # variable that must be cast as list from environmnet to settings.py
> mplaint_tuple = ['SECURE_PROXY_SSL_HEADER']   # variable that must be casr 
as tuple from environment to settings.py

# mplaint_list and mplaint_tuple is optional
> lib.decrypt_environ(mplaint_key, mplaint_list, mplaint_tuple)


# Inside settings.py
> from encryption import OutboxEncryption
> mplaint_key = ['DB_PASSWORD', 'SECRET_KEY']
> mplaint_list = ['ALLOWED_HOSTS']
> mplaint_tuple = ['SECURE_PROXY_SSL_HEADER']

> dict1 = lib.decrypt_environ(mplaint_key, mplaint_list, mplaint_tuple)
> DEBUG = dict1['DEBUG']
> UNDER_CONSTRUCTION = dict1['UNDER_CONSTRUCTION']
> DEBUG = dict1['DEBUG']
> SECRET_KEY = dict1['SECRET_KEY']
> ALLOWED_HOSTS = dict1['ALLOWED_HOSTS']
> DATABASES = {
    'default': {
        'ENGINE'    : dict1['DB_ENGINE'],
        'NAME'      : dict1['DB_NAME'],
        'USER'      : dict1['DB_USER'],
        'PASSWORD'  : dict1['DB_PASSWORD'],
        'HOST'      : dict1['DB_HOSTS'],
        'PORT'      : dict1['DB_POST'],
    }
> SECURE_PROXY_SSL_HEADER = dict1['SECURE_PROXY_SSL_HEADER']

}

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

outbox-encryption-1.0.1.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

outbox_encryption-1.0.1-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file outbox-encryption-1.0.1.tar.gz.

File metadata

  • Download URL: outbox-encryption-1.0.1.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.7

File hashes

Hashes for outbox-encryption-1.0.1.tar.gz
Algorithm Hash digest
SHA256 c5849450e1a12e9eee22b79b89192840f78576c1dcba41cb919f3fab90642fc5
MD5 91dce4d1c69060d9bdc04bc21b4758c4
BLAKE2b-256 b1ea340c2782eac9722d7cef9ec421938b6ca0557a5dbde5e78f10f4443a405d

See more details on using hashes here.

Provenance

File details

Details for the file outbox_encryption-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for outbox_encryption-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d8019dfc62b4ed0ca4dd345f22cb280316b18a352029af3c0fda309fd5eeb4d8
MD5 0420a58eef57f7bb5809f66671dfeca4
BLAKE2b-256 603c6891debaa1f4e3914eb25d7ad7c73d293c4eb0c292c887f0af95c1254b2f

See more details on using hashes here.

Provenance

Supported by

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