Skip to main content

Cryptographic utilities for Musicfox Python applications.

Project description

mfcrypt

AES encryption and decryption utilities for Musicfox JavaScript + Python applications and services.

Motivation

The JavaScript and Python mfcrypt utilities are particularly simple/straightforward implementations of multi-layerd encryption within Musicfox software. In particular, it is important to be able to doubly encrypt data during application data SSL transport, at-rest under major-3rd party encryption (Google), and to separate concerns/implementations via completely different systems.

Combined with access restrictions underneath fortified enterprise authorization schemes, users' data are separated, encrypted, and always inaccessible by default. Multiple layers of service authorization and identification are required prior to any data utilized in plaintext.

See PR #8 for model/architecture details for our fan-b00st application usage.

Installation

JavaScript

Install via npm or yarn, e.g.

npm i --save-dev @musicfox/mfcrypt.

&#128161 Remove --save-dev if this is an upstream dependency of your lib/app, rather thanone compiled.

Python

Install via fury.io. You'll need to populate your environment with a token via FURY_TOKEN, available within your fury account.

FURY_TOKEN="<your_token>" pipenv install --dev # assuming you're developing

&#128161 Remove --dev if this is an upstream dependency of your lib/app, rather than your dev environment.

Quick start JavaScript

For detailed usage examine the code in examples/javascript/ within the repo and the test suitefound in src/test/.

But the gist (we'll generate a simple bytes PDKDF2 key using the library):

// myEncryptionScript.js
import { createBytesKey, encrypt } from '@musicfox/mfcrypt';

const mySecretPassphrase = 'really I should encrypt this too, and generate it randomly. DO NOT use words like this. Tha NSA will break me.';
const salt = 'randomly generated salt';

const secretKeyBytes = await createBytesKey(mySecretPassphrase);
// Now you can use the bytes key to encrypt/decrypt things
const encStringData = await encrypt('TOP SECRET STRING DATA', secretKeyBytes);
const decStringData = await decrypt(encStringData, secretKeyBytes, 'string'); // give it a type hint at the end, you'll be happy you did ;-)

Quick start Python

For detailed usage examine the code in examples/python, which contains a Python Flask application you can test out. In addition, you can always examine usage via the test suite found in the test directory.

import mfcrypt

if __name__ == '__main__':
    b_key = mfcrypt.create_bytes_key('your secret passphrase', 'your random salt')
    print(b_key.hex())

Over-the-wire

This particular implementation is meant to work with Python Flask-based HTTP webservices. As such, you should be able to use your code above to send encrypted data which may be decrypted via a Python service.

Support

File an issue or ask a question herein on our Issues Board.

Development

Check out this repository: git clone git@githug.com:musicfox/cryptography && cd crypto/cryptography

All source is located in the src directory and language-specific, within the appropriate Python or Javascript directories.

Reference/Source Materials

As cryptography is a detailed, mission-critical application security subject please review the below references prior to usage of this library.

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

mfcrypt-0.0.4.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

mfcrypt-0.0.4-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file mfcrypt-0.0.4.tar.gz.

File metadata

  • Download URL: mfcrypt-0.0.4.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.5

File hashes

Hashes for mfcrypt-0.0.4.tar.gz
Algorithm Hash digest
SHA256 dc400f0c16f7d425cbfe054269a3a0b41c74f65e24bc5b95ff508f4c18222231
MD5 d4e1e83ee6bf5cd66c6aed0d3c0b0280
BLAKE2b-256 dffade90ef5b61481a031d819a58bea8c7645ed2325fb582b041aaccae9769c4

See more details on using hashes here.

File details

Details for the file mfcrypt-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: mfcrypt-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.5

File hashes

Hashes for mfcrypt-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 602065b529940b0314b1b22325345f6dc85f2d7a9b5fa498ea39b067efe9fcf1
MD5 0258ab1c2810c82d194afc5006f8a6ad
BLAKE2b-256 ed893aeebe6e5710f24d18b7d0fee795fa7af5e4c1ce1bbfbaab5027e61d8d33

See more details on using hashes here.

Supported by

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