{"id":25692383,"url":"https://github.com/embetrix/pycrypto-helper","last_synced_at":"2026-03-01T04:10:23.922Z","repository":{"id":271894165,"uuid":"914905714","full_name":"embetrix/pycrypto-helper","owner":"embetrix","description":"python crypto operations helper","archived":false,"fork":false,"pushed_at":"2025-01-12T11:40:04.000Z","size":34,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-17T14:54:44.039Z","etag":null,"topics":["cryptography","encryption-decryption","pkcs11","python3","signature"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/embetrix.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,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-01-10T14:53:41.000Z","updated_at":"2025-01-12T11:40:07.000Z","dependencies_parsed_at":"2025-04-24T05:14:59.065Z","dependency_job_id":"77b687bb-938a-4fff-8f7f-3bb93959bb2e","html_url":"https://github.com/embetrix/pycrypto-helper","commit_stats":null,"previous_names":["embetrix/pycrypto-helper"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/embetrix/pycrypto-helper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/embetrix%2Fpycrypto-helper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/embetrix%2Fpycrypto-helper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/embetrix%2Fpycrypto-helper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/embetrix%2Fpycrypto-helper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/embetrix","download_url":"https://codeload.github.com/embetrix/pycrypto-helper/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/embetrix%2Fpycrypto-helper/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29960236,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T01:47:18.291Z","status":"online","status_checked_at":"2026-03-01T02:00:07.437Z","response_time":124,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","encryption-decryption","pkcs11","python3","signature"],"created_at":"2025-02-24T23:09:03.050Z","updated_at":"2026-03-01T04:10:23.889Z","avatar_url":"https://github.com/embetrix.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pycrypto-helper\n\nCryptographic operations can be challenging, especially when handling different key types and PKCS#11. \n`pycrypto-helper` is a helper library designed to simplify cryptographic operations, including signing, verifying, encrypting, and decrypting data using various key types and PKCS#11 tokens.\n\n## Installation\n\n```bash\npip install .\n```\n\n\nTo install the library from PyPI, use the following command:\n\n```bash\npip install pycrypto-helper\n```\n\n## Available Functions\n\n### `crypto_helper.sign(key_desc, data, pin)`\n\nSigns the given data using the specified key.\n\n- `key_desc`: A string describing the key (key file in pem format or pkcs11 uri).\n- `data`: The data to be signed.\n- `pin`: The pin or passphrase for accessing the key (optional).\n\n### `crypto_helper.verify(key_desc, data, signature, pin)`\n\nVerifies the given signature for the specified data using the key.\n\n- `key_desc`: A string describing the key (key file in pem format or pkcs11 uri).\n- `data`: The data whose signature is to be verified.\n- `signature`: The signature to be verified.\n- `pin`: The pin or passphrase for accessing the key (optional).\n\n### `crypto_helper.cms_sign(key_desc, cert, data, pin)`\n\nSigns using CMS the given data using the specified key and certificate.\n\n- `key_desc`: A string describing the key (key file in pem format or pkcs11 uri).\n- `cert`: The certificate file in pem format.\n- `data`: The data to be signed.\n- `pin`: The pin or passphrase for accessing the key (optional).\n\n### `crypto_helper.cms_verify(cert, data, signature)`\n\nVerifies the given CMS signature for the specified data using the certificate.\n\n- `cert`: The certificate file in pem format.\n- `data`: The data to be signed.\n- `signature`: the cms signature to be verified in der format.\n\n### `crypto_helper.encrypt(key_desc, ivt, data, pin)`\n\nEncrypts using AES the given data using the specified key.\n\n- `key_desc`: A string describing the key (key file or pkcs11 uri).\n- `ìvt`: The initialization vector.\n- `data`: The data to be encrypted.\n- `pin`: The pin for accessing the key (optional).\n\n### `crypto_helper.decrypt(key_desc, ivt, encrypted_data, pin)`\n\nDecrypts using AES the given encrypted data using the specified key.\n\n- `key_desc`: A string describing the key (key file or pkcs11 uri).\n- `ìvt`: The initialization vector.\n- `encrypted_data`: The data to be decrypted.\n- `pin`: The pin for accessing the key (optional).\n\n## Example usage\n\n```python\nfrom pycrypto_helper import crypto_helper\n\n# using key file\nkey_desc = \"ecdsa_key.pem\"\ndata = b\"Hello, world!\"\nsignature = crypto_helper.sign(key_desc, data)\nprint(signature.hex())\ncrypto_helper.verify(key_desc, data, signature)\n\n# using pkcs11 token\nkey_desc = \"pkcs11:token=SmartCard-HSM%20%28UserPIN%29;id=%01;object=testkeyECp256\"\ndata = b\"Hello, world!\"\nsignature = crypto_helper.sign(key_desc, data, \"123456\")\nprint(signature.hex())\ncrypto_helper.verify(key_desc, data, signature, \"123456\")\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fembetrix%2Fpycrypto-helper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fembetrix%2Fpycrypto-helper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fembetrix%2Fpycrypto-helper/lists"}