onqlave-python-sdk-pilot


Nameonqlave-python-sdk-pilot JSON
Version 0.0.20 PyPI version JSON
download
home_pagehttps://github.com/onqlavelabs/onqlave-python/tree/dev
SummaryThis Python SDK is designed to help developers easily integrate Onqlave Encryption As A Service into their python backend.
upload_time2023-07-27 03:35:53
maintainerDC
docs_urlNone
authorOnqlave Pty
requires_python
licenseMIT
keywords encryption privacy sdk
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Description
This Python SDK is designed to help developers easily integrate Onqlave `Encryption As A Service` into their python backend.


[![License](https://img.shields.io/github/license/onqlavelabs/onqlave-go)](https://github.com/onqlavelabs/onqlave-go/blob/main/LICENSE)


# Table of Contents

- [Description](#description)
- [Table of Contents](#table-of-contents)
	- [Features](#features)
	- [Installation](#installation)
		- [Requirements](#requirements)
		- [Configuration](#configuration)
		- [Usage](#usage)
		- [Encrypt](#encrypt)
		- [Decrypt](#decrypt)
		- [Encrypt Stream](#encrypt-stream)
		- [Decrypt Stream](#decrypt-stream)
	- [Reporting a Vulnerability](#reporting-a-vulnerability)

## Features
- Encrypt/decrypt pieces of information
- Encrypt/decrypt stream of data

## Installation

### Requirements

- Python 3.8 and above

### Configuration
To install, simply using this command:

```bash
pip install onqlave-python-sdk-pilot
```
You can also check the [package detail on PyPI](https://pypi.org/project/onqlave-python-sdk-pilot)

## Usage
To use this SDK, you firstly need to obtain credentials to access an Onqlave Arx by signing up to [Onqlave](https://onqlave.com) and following instruction to create your first Onqlave Arx. Documentation can be found at [Onqlave Technical Documentation](https://docs.onqlave.com).

The [Onqlave Python](https://github.com/onqlavelabs/onqlave-python) module is used to perform operations on the configured Arx such as encrypting and decryptin for an Onqlave Arx. 

To use this module, an Onqlave client should be initialized as follows.
(Please note that there are 3 ways of loading configurations specified in the **examples/** directory.)

```python
from onqlave.encryption import options
from onqlave.encryption.encryption import Encryption
from onqlave.credentials.credentials import Credential
from onqlave.connection.client import RetrySettings

cred_file_path = "credentials.json"

arx_option = options.ArxOption()
credential_option = Credential()

arx_option.load_arx_url_from_json(cred_file_path)
credential_option.load_config_from_json(cred_file_path)

retry_option = RetrySettings(count=1,wait_time=1,max_wait_time=2) 

encryption_engine = Encryption(
    debug_option=debug_option,
    arx_option=arx_option,
    credential_option=credential_option,
    retry_setting=retry_option
)
```


### Encrypt

To encrypt data, use the **encrypt(plaintext: bytearray, associated_data: bytearray)** method of the `Encryption` service. The **plaintext** parameter is the `bytearray` representation of data you are wishing to encrypt. The **associated_data** parameter the `bytearray` representation of associated data which can be used to improve the authenticity of the data (it is not mandatory), as shown below.

```python
plaintext = "hello world" # your data goes here
associated_data = "auth" # your authentication data goes here
cipher_text = encryption_engine.encrypt(plaintext.encode(), associated_data.encode())
```

### Decrypt

To decrypt data, use the **decrypt(cipher_data: bytearray, associated_data: bytearray)** method of the `Encryption` service. The **cipher_data** parameter is the `bytearray` representation of data you are wishing to decrypt (previousely encrypted). The **associated_data** parameter the `bytearray` representation of associated data which can be used to improve the authenticity of the data (it is not mandatory), as shown below.

```python
decrypted_ciphertext = encryption_engine.decrypt(cipher_text,associated_data.encode())
```

### Encrypt Stream
To encrypt stream of data, use the **encrypt_stream(plain_stream io.Reader, cipher_stream io.Writer, associated_data bytearray)** method of the `Encryption` service. The **plain_stream** parameter is the `io.Reader` stream of data you are wishing to encrypt. The **cipher_stream** parameter is the `io.Write` stream you are wishing to write the cipher data to. The **associated_data** parameter the `bytearray` representation of associated data which can be used to improve the authenticity of the data (it is not mandatory), as shown below.

```python
plain_file_stream = open("path to your plaintext file","rb")
plain_stream = io.BytesIO(plain_file_stream.read())
cipher_stream = io.BytesIO()
    
encryption_engine.encrypt_stream(plain_stream,cipher_stream,associated_data.encode())
cipher_stream.seek(0)
```

### Decrypt Stream
To decrypt data, use the **decrypt_stream(cipher_stream io.io.BytesIO, plain_stream io.BytesIO, associated_data []byte)** method of the `Encryption` service. The **cipher_stream** parameter is the `io.BytesIO()` stream of data you are wishing to decrypt and it was originally encrypted using [encrypt_stream](#encrypt-stream). The **plain_stream** parameter is the `io.BytesIO()` stream you are wishing to write the plain data back to. The **associated_data** parameter the `bytearray` representation of associated data which can be used to improve the authenticity of the data (it is not mandatory), as shown below.

```python
decrypted_stream = io.BytesIO()
encryption_engine.decrypt_stream(
    cipher_stream=cipher_stream,
    plain_stream=decrypted_stream,
    associated_data=associated_data.encode()
)
decrypted_stream.seek(0)

with open(
    "path to your decrypted file",
    "wb"
) as result:
    result.write(decrypted_stream.read())
```

## Reporting a Vulnerability

If you discover a potential security issue in this project, please reach out to us at security@onqlave.com. Please do not create public GitHub issues or Pull Requests, as malicious actors could potentially view them.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/onqlavelabs/onqlave-python/tree/dev",
    "name": "onqlave-python-sdk-pilot",
    "maintainer": "DC",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "dc@onqlave.com",
    "keywords": "encryption,privacy,sdk",
    "author": "Onqlave Pty",
    "author_email": "contact@onqlave.com",
    "download_url": "https://files.pythonhosted.org/packages/0b/30/3989a277ce312e0515afcdb0d29f435b116aed0617a7091b45283dda0c33/onqlave-python-sdk-pilot-0.0.20.tar.gz",
    "platform": null,
    "description": "# Description\nThis Python SDK is designed to help developers easily integrate Onqlave `Encryption As A Service` into their python backend.\n\n\n[![License](https://img.shields.io/github/license/onqlavelabs/onqlave-go)](https://github.com/onqlavelabs/onqlave-go/blob/main/LICENSE)\n\n\n# Table of Contents\n\n- [Description](#description)\n- [Table of Contents](#table-of-contents)\n\t- [Features](#features)\n\t- [Installation](#installation)\n\t\t- [Requirements](#requirements)\n\t\t- [Configuration](#configuration)\n\t\t- [Usage](#usage)\n\t\t- [Encrypt](#encrypt)\n\t\t- [Decrypt](#decrypt)\n\t\t- [Encrypt Stream](#encrypt-stream)\n\t\t- [Decrypt Stream](#decrypt-stream)\n\t- [Reporting a Vulnerability](#reporting-a-vulnerability)\n\n## Features\n- Encrypt/decrypt pieces of information\n- Encrypt/decrypt stream of data\n\n## Installation\n\n### Requirements\n\n- Python 3.8 and above\n\n### Configuration\nTo install, simply using this command:\n\n```bash\npip install onqlave-python-sdk-pilot\n```\nYou can also check the [package detail on PyPI](https://pypi.org/project/onqlave-python-sdk-pilot)\n\n## Usage\nTo use this SDK, you firstly need to obtain credentials to access an Onqlave Arx by signing up to [Onqlave](https://onqlave.com) and following instruction to create your first Onqlave Arx. Documentation can be found at [Onqlave Technical Documentation](https://docs.onqlave.com).\n\nThe [Onqlave Python](https://github.com/onqlavelabs/onqlave-python) module is used to perform operations on the configured Arx such as encrypting and decryptin for an Onqlave Arx. \n\nTo use this module, an Onqlave client should be initialized as follows.\n(Please note that there are 3 ways of loading configurations specified in the **examples/** directory.)\n\n```python\nfrom onqlave.encryption import options\nfrom onqlave.encryption.encryption import Encryption\nfrom onqlave.credentials.credentials import Credential\nfrom onqlave.connection.client import RetrySettings\n\ncred_file_path = \"credentials.json\"\n\narx_option = options.ArxOption()\ncredential_option = Credential()\n\narx_option.load_arx_url_from_json(cred_file_path)\ncredential_option.load_config_from_json(cred_file_path)\n\nretry_option = RetrySettings(count=1,wait_time=1,max_wait_time=2) \n\nencryption_engine = Encryption(\n    debug_option=debug_option,\n    arx_option=arx_option,\n    credential_option=credential_option,\n    retry_setting=retry_option\n)\n```\n\n\n### Encrypt\n\nTo encrypt data, use the **encrypt(plaintext: bytearray, associated_data: bytearray)** method of the `Encryption` service. The **plaintext** parameter is the `bytearray` representation of data you are wishing to encrypt. The **associated_data** parameter the `bytearray` representation of associated data which can be used to improve the authenticity of the data (it is not mandatory), as shown below.\n\n```python\nplaintext = \"hello world\" # your data goes here\nassociated_data = \"auth\" # your authentication data goes here\ncipher_text = encryption_engine.encrypt(plaintext.encode(), associated_data.encode())\n```\n\n### Decrypt\n\nTo decrypt data, use the **decrypt(cipher_data: bytearray, associated_data: bytearray)** method of the `Encryption` service. The **cipher_data** parameter is the `bytearray` representation of data you are wishing to decrypt (previousely encrypted). The **associated_data** parameter the `bytearray` representation of associated data which can be used to improve the authenticity of the data (it is not mandatory), as shown below.\n\n```python\ndecrypted_ciphertext = encryption_engine.decrypt(cipher_text,associated_data.encode())\n```\n\n### Encrypt Stream\nTo encrypt stream of data, use the **encrypt_stream(plain_stream io.Reader, cipher_stream io.Writer, associated_data bytearray)** method of the `Encryption` service. The **plain_stream** parameter is the `io.Reader` stream of data you are wishing to encrypt. The **cipher_stream** parameter is the `io.Write` stream you are wishing to write the cipher data to. The **associated_data** parameter the `bytearray` representation of associated data which can be used to improve the authenticity of the data (it is not mandatory), as shown below.\n\n```python\nplain_file_stream = open(\"path to your plaintext file\",\"rb\")\nplain_stream = io.BytesIO(plain_file_stream.read())\ncipher_stream = io.BytesIO()\n    \nencryption_engine.encrypt_stream(plain_stream,cipher_stream,associated_data.encode())\ncipher_stream.seek(0)\n```\n\n### Decrypt Stream\nTo decrypt data, use the **decrypt_stream(cipher_stream io.io.BytesIO, plain_stream io.BytesIO, associated_data []byte)** method of the `Encryption` service. The **cipher_stream** parameter is the `io.BytesIO()` stream of data you are wishing to decrypt and it was originally encrypted using [encrypt_stream](#encrypt-stream). The **plain_stream** parameter is the `io.BytesIO()` stream you are wishing to write the plain data back to. The **associated_data** parameter the `bytearray` representation of associated data which can be used to improve the authenticity of the data (it is not mandatory), as shown below.\n\n```python\ndecrypted_stream = io.BytesIO()\nencryption_engine.decrypt_stream(\n    cipher_stream=cipher_stream,\n    plain_stream=decrypted_stream,\n    associated_data=associated_data.encode()\n)\ndecrypted_stream.seek(0)\n\nwith open(\n    \"path to your decrypted file\",\n    \"wb\"\n) as result:\n    result.write(decrypted_stream.read())\n```\n\n## Reporting a Vulnerability\n\nIf you discover a potential security issue in this project, please reach out to us at security@onqlave.com. Please do not create public GitHub issues or Pull Requests, as malicious actors could potentially view them.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "This Python SDK is designed to help developers easily integrate Onqlave Encryption As A Service into their python backend.",
    "version": "0.0.20",
    "project_urls": {
        "Homepage": "https://github.com/onqlavelabs/onqlave-python/tree/dev",
        "Issue Tracker": "https://github.com/onqlavelabs/onqlave-python/issues",
        "Source Code": "https://github.com/onqlavelabs/onqlave-python/tree/dev"
    },
    "split_keywords": [
        "encryption",
        "privacy",
        "sdk"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e4caefddf9d0e194c1a8a08c13dda5eeb3afb9b131007be341eade97762b27dd",
                "md5": "8f871147af89b49b0edf205abfc4b0e5",
                "sha256": "42ed49bc80389ae9751880539a8d1f0650cb12c1466feebde3057fd85f9f9750"
            },
            "downloads": -1,
            "filename": "onqlave_python_sdk_pilot-0.0.20-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8f871147af89b49b0edf205abfc4b0e5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 40507,
            "upload_time": "2023-07-27T03:35:50",
            "upload_time_iso_8601": "2023-07-27T03:35:50.890784Z",
            "url": "https://files.pythonhosted.org/packages/e4/ca/efddf9d0e194c1a8a08c13dda5eeb3afb9b131007be341eade97762b27dd/onqlave_python_sdk_pilot-0.0.20-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0b303989a277ce312e0515afcdb0d29f435b116aed0617a7091b45283dda0c33",
                "md5": "63b5682333c5208d4aea2d03aa6a7811",
                "sha256": "bf7113d25f6a732b0966f40222d90750208a5342e31440b90a28d171df82f7b0"
            },
            "downloads": -1,
            "filename": "onqlave-python-sdk-pilot-0.0.20.tar.gz",
            "has_sig": false,
            "md5_digest": "63b5682333c5208d4aea2d03aa6a7811",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 29987,
            "upload_time": "2023-07-27T03:35:53",
            "upload_time_iso_8601": "2023-07-27T03:35:53.242878Z",
            "url": "https://files.pythonhosted.org/packages/0b/30/3989a277ce312e0515afcdb0d29f435b116aed0617a7091b45283dda0c33/onqlave-python-sdk-pilot-0.0.20.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-27 03:35:53",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "onqlavelabs",
    "github_project": "onqlave-python",
    "github_not_found": true,
    "lcname": "onqlave-python-sdk-pilot"
}
        
Elapsed time: 0.11675s