{"id":21874544,"url":"https://github.com/smoren/encryptiontools-pypi","last_synced_at":"2025-04-15T01:24:14.706Z","repository":{"id":225221953,"uuid":"765404775","full_name":"Smoren/encryptiontools-pypi","owner":"Smoren","description":"Tools for encryption and decryption, signing and verification. Use symmetric and asymmetric (RSA-based) encryption.","archived":false,"fork":false,"pushed_at":"2024-03-17T14:49:32.000Z","size":37,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T13:21:16.440Z","etag":null,"topics":["cryptography","decryption","encryption","pypi-package","rsa","rsa-cryptography","signing","verification"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Smoren.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-02-29T21:16:42.000Z","updated_at":"2024-07-15T11:58:53.000Z","dependencies_parsed_at":"2024-02-29T22:05:55.064Z","dependency_job_id":null,"html_url":"https://github.com/Smoren/encryptiontools-pypi","commit_stats":null,"previous_names":["smoren/encryptiontools-pypi"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Smoren%2Fencryptiontools-pypi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Smoren%2Fencryptiontools-pypi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Smoren%2Fencryptiontools-pypi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Smoren%2Fencryptiontools-pypi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Smoren","download_url":"https://codeload.github.com/Smoren/encryptiontools-pypi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248986852,"owners_count":21194132,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cryptography","decryption","encryption","pypi-package","rsa","rsa-cryptography","signing","verification"],"created_at":"2024-11-28T07:12:40.605Z","updated_at":"2025-04-15T01:24:14.667Z","avatar_url":"https://github.com/Smoren.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Encryption Tools for Python 3\n\n[![PyPI package](https://img.shields.io/badge/pip%20install-encryptiontools-brightgreen)](https://pypi.org/project/encryptiontools/)\n[![version number](https://img.shields.io/pypi/v/encryptiontools?color=green\u0026label=version)](https://github.com/Smoren/encryptiontools-pypi/releases)\n[![Coverage Status](https://coveralls.io/repos/github/Smoren/encryptiontools-pypi/badge.svg?branch=master)](https://coveralls.io/github/Smoren/encryptiontools-pypi?branch=master)\n[![Actions Status](https://github.com/Smoren/encryptiontools-pypi/workflows/Test/badge.svg)](https://github.com/Smoren/encryptiontools-pypi/actions)\n[![License](https://img.shields.io/github/license/Smoren/encryptiontools-pypi)](https://github.com/Smoren/encryptiontools-pypi/blob/master/LICENSE)\n\nTools for encryption and decryption, signing and verification. Use symmetric and asymmetric (RSA-based) encryption.\n\n## Installation\n\n```\npip install encryptiontools\n```\n\n## Usage\n\n### Asymmetric encryption and decryption\n\n```python\nfrom encryptiontools.encryption import AsymmetricEncrypter, AsymmetricDecrypter\nfrom encryptiontools.utils import generate_key_pair\n\npublic_key, private_key = generate_key_pair(512)\n\ndata = {'message': 'hello asymmetric encryption'}\n\nencrypter = AsymmetricEncrypter.create(public_key.save_pkcs1())  # or AsymmetricEncrypter(public_key)\ndecrypter = AsymmetricDecrypter.create(private_key.save_pkcs1())  # or AsymmetricDecrypter(private_key)\n\nencrypted = encrypter.encrypt(data)\ndecrypted = decrypter.decrypt(encrypted)\n\nassert decrypted['message'] == 'hello asymmetric encryption'\n```\n\n### Symmetric encryption and decryption\n\n```python\nfrom encryptiontools.encryption import SymmetricEncrypter\n\nkey = b'0123456789abcdef'\n\ndata = {'message': 'hello symmetric encryption'}\n\nencrypter = SymmetricEncrypter.create(key)  # or SymmetricEncrypter(key)\n\nencrypted = encrypter.encrypt(data)\ndecrypted = encrypter.decrypt(encrypted)\n\nassert decrypted['message'] == 'hello symmetric encryption'\n```\n\n### Combined encryption and decryption\n\nAsymmetric key pair is used to encrypt/decrypt internal (symmetric) key, internal key is used to decrypt data.\n\n```python\nfrom encryptiontools.encryption import CombinedEncrypter, CombinedDecrypter\nfrom encryptiontools.utils import generate_key_pair\n\npublic_key, private_key = generate_key_pair(512)\n\ndata = {'message': 'hello combined encryption'}\n\nencrypter = CombinedEncrypter.create(public_key.save_pkcs1())  # or CombinedEncrypter(public_key)\ndecrypter = CombinedDecrypter.create(private_key.save_pkcs1())  # or CombinedDecrypter(private_key)\n\nencrypted = encrypter.encrypt(data)\ndecrypted = decrypter.decrypt(encrypted)\n\nassert decrypted['message'] == 'hello combined encryption'\n```\n\n### Signing and verification\n\n```python\nfrom encryptiontools.signature import Signer, Verifier\nfrom encryptiontools.utils import generate_key_pair\nfrom encryptiontools.exceptions import VerificationError\n\npublic_key, private_key = generate_key_pair(512)\n\ndata = {'message': 'hello signing and verification'}\n\nsigner = Signer.create(private_key.save_pkcs1())  # or Signer(private_key)\nverifier = Verifier.create(public_key.save_pkcs1())  # or Verifier(public_key)\n\nsignature = signer.sign(data)\n\ntry:\n  verifier.verify(data, signature)\n  assert True\nexcept VerificationError:\n  assert False\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmoren%2Fencryptiontools-pypi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmoren%2Fencryptiontools-pypi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmoren%2Fencryptiontools-pypi/lists"}