jwe-encryptify


Namejwe-encryptify JSON
Version 0.0.3 PyPI version JSON
download
home_pageNone
SummaryA Python package to facilitate JSON Web Encryption (JWE) with enhanced security, leveraging AWS Key Management Service (KMS) and Secrets Manager for secure input and output handling.
upload_time2024-11-20 11:25:04
maintainerNone
docs_urlNone
authorM Santhosh Kumar
requires_python>=3.9
licenseNone
keywords jwe kms secret manager encryption aws cryptography
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # jwe-encryptify

`jwe-encryptify` is a Python package designed for secure encryption and decryption using
JSON Web Encryption (JWE), enhanced by AWS Key Management Service (KMS) and AWS Secrets Manager
integration. This package offers a straightforward solution for handling sensitive data, allowing
encrypted data exchange while securely managing encryption keys through AWS.

## Table of Contents

* [Features](#features)
* [Installation](#installation)
* [Usage](#usage)
    * [Encrypting Data using JWE](#encrypting-data-using-jwe)
    * [Encrypting Data using KMS](#encrypting-data-using-kms)
    * [Decrypting Data using JWE](#decrypting-data-using-jwe)
    * [Decrypting Data using KMS](#decrypting-data-using-kms)
* [AWS Permissions](#aws-permissions)
* [Dependencies](#dependencies)
* [License](#license)
* [Contributing](#contributing)
* [Authors](#authors)

## Features

* **Robust Data Encryption**: Uses JSON Web Encryption (JWE) to ensure data security and integrity.
* **AWS KMS Integration**: Leverages AWS KMS for secure key encryption and decryption.
* **AWS Secrets Manager**: Efficiently manages public and private key pairs for encryption
  processes.
* **User-Friendly API**: Simplified methods for secure JSON payload encryption and decryption.

## Installation

You can install the package via `pip` from PyPI:

```bash
pip install jwe-encryptify
```

## Usage

* **AWS Configuration**: Ensure that your AWS credentials and region are set up. The package
  requires AWS permissions to access KMS and Secrets Manager.
* **Environment Variable**: Set `AWS_DEFAULT_REGION` as an environment variable or configure it in
  your AWS settings.

## Encrypting Data using JWE

Use the `encrypt` method to secure JSON data with a public key stored in AWS Secrets Manager.

```python
from jwe_crypto import encrypt

# Data to encrypt
data_to_encrypt = {"user": "John Doe", "account_id": "123456"}

# Encrypt the data
jwe_encrypted_token = encrypt(
  kms_id="your-kms-key-id",  # AWS KMS key ID for encryption
  secret_name="your-secret-name",  # AWS Secrets Manager secret name
  secret_key="public-key",  # Key name in the secret (public key)
  api_response=data_to_encrypt  # JSON data to encrypt
)
print("Encrypted JWE Token:", jwe_encrypted_token)

```

## Encrypting Data using KMS

Use the `encrypt` method to secure JSON data using an AWS KMS key.

```python
from kms_crypto import encrypt

# Data to encrypt
data_to_encrypt = {"user": "John Doe", "account_id": "123456"}

# Encrypt the data using KMS
kms_encrypted_value = encrypt(
  kms_id="your-kms-key-id",  # AWS KMS key ID used for encryption
  plaintext=str(data_to_encrypt)  # Convert the JSON data to a string
)

print("Encrypted KMS Value:", kms_encrypted_value)

```

## Decrypting Data using JWE

Use the `decrypt` method to decrypt an encrypted JWE token using a private key from AWS Secrets
Manager.

```python
from jwe_crypto import decrypt

# JWE token to decrypt
jwe_token = "your-encrypted-jwe-token"

# Decrypt the data
decrypted_data = decrypt(
  kms_id="your-kms-key-id",  # AWS KMS key ID
  secret_name="your-secret-name",  # AWS Secrets Manager secret name
  secret_key="private-key",  # Key name in the secret (private key)
  jwe_payload=jwe_token  # Encrypted JWE payload
)

print("Decrypted Data:", decrypted_data)
```

## Decrypting Data using KMS

Use the `decrypt` method to decrypt an encrypted value using an AWS KMS key and encryption context.

```python
from kms_crypto import decrypt

# Encrypted value to decrypt
encrypted_value = "your-encrypted-kms-value"

# Decrypt the data using KMS
decrypted_data = decrypt(
  kms_id="your-kms-key-id",  # AWS KMS key ID used for decryption
  lambda_function_name="your-lambda-function-name",  # Encryption context
  encrypted_value=encrypted_value  # Encrypted value to decrypt
)

print("Decrypted Data:", decrypted_data)
```

## AWS Permissions

Ensure the following permissions are assigned to your AWS IAM role or user:

* KMS Permissions:
    * `kms:Encrypt`
    * `kms:Decrypt`
* Secrets Manager Permissions:
    * `secretsmanager:GetSecretValue`

## Dependencies

The package requires the following dependencies:

* [`jwcrypto`](https://pypi.org/project/jwcrypto/): For JWE encoding and decoding.
* [`boto3`](https://pypi.org/project/boto3/): AWS SDK for Python.
* [`botocore`](https://pypi.org/project/botocore/): Core library used by boto3.
  Install all dependencies automatically via pip install jwe-encryptify.

## License

This project is licensed under the MIT License.

## Contributing

Contributions are welcome! Submit issues or pull requests to enhance the package. For major changes,
please open a discussion first.

## Authors

M Santhosh Kumar
Initial work
santhoshse7en@gmail.com



            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "jwe-encryptify",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "JWE, KMS, Secret Manager, Encryption, AWS, Cryptography",
    "author": "M Santhosh Kumar",
    "author_email": "santhoshse7en@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/94/1b/5a5e9f43b94e19edd0860bd118a490b9c58d6a3a7067a0a605699372697b/jwe_encryptify-0.0.3.tar.gz",
    "platform": null,
    "description": "# jwe-encryptify\n\n`jwe-encryptify` is a Python package designed for secure encryption and decryption using\nJSON Web Encryption (JWE), enhanced by AWS Key Management Service (KMS) and AWS Secrets Manager\nintegration. This package offers a straightforward solution for handling sensitive data, allowing\nencrypted data exchange while securely managing encryption keys through AWS.\n\n## Table of Contents\n\n* [Features](#features)\n* [Installation](#installation)\n* [Usage](#usage)\n    * [Encrypting Data using JWE](#encrypting-data-using-jwe)\n    * [Encrypting Data using KMS](#encrypting-data-using-kms)\n    * [Decrypting Data using JWE](#decrypting-data-using-jwe)\n    * [Decrypting Data using KMS](#decrypting-data-using-kms)\n* [AWS Permissions](#aws-permissions)\n* [Dependencies](#dependencies)\n* [License](#license)\n* [Contributing](#contributing)\n* [Authors](#authors)\n\n## Features\n\n* **Robust Data Encryption**: Uses JSON Web Encryption (JWE) to ensure data security and integrity.\n* **AWS KMS Integration**: Leverages AWS KMS for secure key encryption and decryption.\n* **AWS Secrets Manager**: Efficiently manages public and private key pairs for encryption\n  processes.\n* **User-Friendly API**: Simplified methods for secure JSON payload encryption and decryption.\n\n## Installation\n\nYou can install the package via `pip` from PyPI:\n\n```bash\npip install jwe-encryptify\n```\n\n## Usage\n\n* **AWS Configuration**: Ensure that your AWS credentials and region are set up. The package\n  requires AWS permissions to access KMS and Secrets Manager.\n* **Environment Variable**: Set `AWS_DEFAULT_REGION` as an environment variable or configure it in\n  your AWS settings.\n\n## Encrypting Data using JWE\n\nUse the `encrypt` method to secure JSON data with a public key stored in AWS Secrets Manager.\n\n```python\nfrom jwe_crypto import encrypt\n\n# Data to encrypt\ndata_to_encrypt = {\"user\": \"John Doe\", \"account_id\": \"123456\"}\n\n# Encrypt the data\njwe_encrypted_token = encrypt(\n  kms_id=\"your-kms-key-id\",  # AWS KMS key ID for encryption\n  secret_name=\"your-secret-name\",  # AWS Secrets Manager secret name\n  secret_key=\"public-key\",  # Key name in the secret (public key)\n  api_response=data_to_encrypt  # JSON data to encrypt\n)\nprint(\"Encrypted JWE Token:\", jwe_encrypted_token)\n\n```\n\n## Encrypting Data using KMS\n\nUse the `encrypt` method to secure JSON data using an AWS KMS key.\n\n```python\nfrom kms_crypto import encrypt\n\n# Data to encrypt\ndata_to_encrypt = {\"user\": \"John Doe\", \"account_id\": \"123456\"}\n\n# Encrypt the data using KMS\nkms_encrypted_value = encrypt(\n  kms_id=\"your-kms-key-id\",  # AWS KMS key ID used for encryption\n  plaintext=str(data_to_encrypt)  # Convert the JSON data to a string\n)\n\nprint(\"Encrypted KMS Value:\", kms_encrypted_value)\n\n```\n\n## Decrypting Data using JWE\n\nUse the `decrypt` method to decrypt an encrypted JWE token using a private key from AWS Secrets\nManager.\n\n```python\nfrom jwe_crypto import decrypt\n\n# JWE token to decrypt\njwe_token = \"your-encrypted-jwe-token\"\n\n# Decrypt the data\ndecrypted_data = decrypt(\n  kms_id=\"your-kms-key-id\",  # AWS KMS key ID\n  secret_name=\"your-secret-name\",  # AWS Secrets Manager secret name\n  secret_key=\"private-key\",  # Key name in the secret (private key)\n  jwe_payload=jwe_token  # Encrypted JWE payload\n)\n\nprint(\"Decrypted Data:\", decrypted_data)\n```\n\n## Decrypting Data using KMS\n\nUse the `decrypt` method to decrypt an encrypted value using an AWS KMS key and encryption context.\n\n```python\nfrom kms_crypto import decrypt\n\n# Encrypted value to decrypt\nencrypted_value = \"your-encrypted-kms-value\"\n\n# Decrypt the data using KMS\ndecrypted_data = decrypt(\n  kms_id=\"your-kms-key-id\",  # AWS KMS key ID used for decryption\n  lambda_function_name=\"your-lambda-function-name\",  # Encryption context\n  encrypted_value=encrypted_value  # Encrypted value to decrypt\n)\n\nprint(\"Decrypted Data:\", decrypted_data)\n```\n\n## AWS Permissions\n\nEnsure the following permissions are assigned to your AWS IAM role or user:\n\n* KMS Permissions:\n    * `kms:Encrypt`\n    * `kms:Decrypt`\n* Secrets Manager Permissions:\n    * `secretsmanager:GetSecretValue`\n\n## Dependencies\n\nThe package requires the following dependencies:\n\n* [`jwcrypto`](https://pypi.org/project/jwcrypto/): For JWE encoding and decoding.\n* [`boto3`](https://pypi.org/project/boto3/): AWS SDK for Python.\n* [`botocore`](https://pypi.org/project/botocore/): Core library used by boto3.\n  Install all dependencies automatically via pip install jwe-encryptify.\n\n## License\n\nThis project is licensed under the MIT License.\n\n## Contributing\n\nContributions are welcome! Submit issues or pull requests to enhance the package. For major changes,\nplease open a discussion first.\n\n## Authors\n\nM Santhosh Kumar\nInitial work\nsanthoshse7en@gmail.com\n\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A Python package to facilitate JSON Web Encryption (JWE) with enhanced security, leveraging AWS Key Management Service (KMS) and Secrets Manager for secure input and output handling.",
    "version": "0.0.3",
    "project_urls": {
        "Documentation": "https://github.com/santhoshse7en/jwe-encryptify#readme",
        "Source": "https://github.com/santhoshse7en/jwe-encryptify",
        "Tracker": "https://github.com/santhoshse7en/jwe-encryptify/issues"
    },
    "split_keywords": [
        "jwe",
        " kms",
        " secret manager",
        " encryption",
        " aws",
        " cryptography"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ecab09944ee3321bd3b4baaede664891668c983752ddd80e66c1ffe230b6508d",
                "md5": "259aadf7302fdfbc44296e5ab40976ab",
                "sha256": "109350a856d83ba7058407b7f41f0bac088000a0872d062461420e84af454809"
            },
            "downloads": -1,
            "filename": "jwe_encryptify-0.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "259aadf7302fdfbc44296e5ab40976ab",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 5346,
            "upload_time": "2024-11-20T11:25:02",
            "upload_time_iso_8601": "2024-11-20T11:25:02.678775Z",
            "url": "https://files.pythonhosted.org/packages/ec/ab/09944ee3321bd3b4baaede664891668c983752ddd80e66c1ffe230b6508d/jwe_encryptify-0.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "941b5a5e9f43b94e19edd0860bd118a490b9c58d6a3a7067a0a605699372697b",
                "md5": "3508a99c4992e929cfb9e1fc69775824",
                "sha256": "5e65c028c59c08f9838499c4b152ee8aaaad648ce52999ad31f8c32cf2070439"
            },
            "downloads": -1,
            "filename": "jwe_encryptify-0.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "3508a99c4992e929cfb9e1fc69775824",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 5241,
            "upload_time": "2024-11-20T11:25:04",
            "upload_time_iso_8601": "2024-11-20T11:25:04.625239Z",
            "url": "https://files.pythonhosted.org/packages/94/1b/5a5e9f43b94e19edd0860bd118a490b9c58d6a3a7067a0a605699372697b/jwe_encryptify-0.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-20 11:25:04",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "santhoshse7en",
    "github_project": "jwe-encryptify#readme",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "jwe-encryptify"
}
        
Elapsed time: 0.37519s