{"id":22970802,"url":"https://github.com/labteral/digsig","last_synced_at":"2025-08-22T05:36:03.331Z","repository":{"id":62568273,"uuid":"338077135","full_name":"labteral/digsig","owner":"labteral","description":"Digital Signature Toolkit for Python","archived":false,"fork":false,"pushed_at":"2021-06-28T14:28:15.000Z","size":55,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-11T01:52:02.391Z","etag":null,"topics":["digital-signature","fmnt","p12","pfx","pkcs12","rsa"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/digsig/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/labteral.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}},"created_at":"2021-02-11T15:59:54.000Z","updated_at":"2021-06-28T14:28:17.000Z","dependencies_parsed_at":"2022-11-03T16:30:42.432Z","dependency_job_id":null,"html_url":"https://github.com/labteral/digsig","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":"labteral/python-package","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labteral%2Fdigsig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labteral%2Fdigsig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labteral%2Fdigsig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labteral%2Fdigsig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/labteral","download_url":"https://codeload.github.com/labteral/digsig/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246763952,"owners_count":20829800,"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":["digital-signature","fmnt","p12","pfx","pkcs12","rsa"],"created_at":"2024-12-14T22:14:40.188Z","updated_at":"2025-04-02T06:15:27.970Z","avatar_url":"https://github.com/labteral.png","language":"Python","readme":"\u003ch1 align=\"center\"\u003e\nDigSig\n\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://pepy.tech/project/digsig/\"\u003e\u003cimg alt=\"Downloads\" src=\"https://img.shields.io/badge/dynamic/json?style=flat-square\u0026maxAge=3600\u0026label=downloads\u0026query=$.total_downloads\u0026url=https://api.pepy.tech/api/projects/digsig\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://pypi.python.org/pypi/digsig/\"\u003e\u003cimg alt=\"PyPi\" src=\"https://img.shields.io/pypi/v/digsig.svg?style=flat-square\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/labteral/digsig/releases\"\u003e\u003cimg alt=\"GitHub releases\" src=\"https://img.shields.io/github/release/labteral/digsig.svg?style=flat-square\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/labteral/digsig/blob/master/LICENSE\"\u003e\u003cimg alt=\"License\" src=\"https://img.shields.io/github/license/labteral/digsig.svg?style=flat-square\u0026color=green\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003ch3 align=\"center\"\u003e\n\u003cb\u003eDigital signatures with Python\u003c/b\u003e\n\u003c/h3\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://www.buymeacoffee.com/brunneis\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/default-orange.png\" alt=\"Buy Me A Coffee\" height=\"35px\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nThe private key detection is automatic with the class `PrivateKey`. It currently works with RSA (`X.509` with `PKCS#12` files: `.p12`, or `.pfx`) and with ECDSA (Ethereum account exported in a `JSON` file).\n\n## Install\n```bash\npip install digsig\n```\n\n# Load keys\n## Automatic detection\nRSA (X.509)\n```python\nfrom digsig import PrivateKey, PublicKey\n\nprivate_key = PrivateKey.get_instance('fnmt.p12', 'p4ssw0rd')\nsignature = private_key.sign('message')\n\n# public_key = private_key.public_key\npublic_key = PublicKey.get_instance('fnmt.pem')\n```\n\nECDSA (Ethereum)\n```python\nfrom digsig import PrivateKey, PublicKey\n\nprivate_key = PrivateKey.get_instance('ethereum.json', 'p4ssw0rd')\n\nsignature = private_key.sign('message')\n\npublic_key = private_key.public_key\n```\n\n## RSA\n```python\nfrom digsig import RsaPrivateKey, RsaModes, RsaFormats\n\nprivate_key = RsaPrivateKey('fnmt.p12', 'p4ssw0rd', mode=RsaModes.PSS_MGF1_SHA3_256)\nsignature = private_key.sign('message')\n\n# public_key = private_key.public_key\npublic_key = RsaPublicKey('fnmt.pem', mode=RsaModes.PSS_MGF1_SHA3_256)\n```\n\n## ECDSA\n```python\nfrom digsig import EcdsaPrivateKey, EcdsaModes\n\nprivate_key = EcdsaPrivateKey('account.json', 'p4ssw0rd', mode=EcdsaModes.SECP256K1_SHA3_256)\nsignature = private_key.sign('message')\n\npublic_key = private_key.public_key\n```\n\n# Verify signature\n```python\nfrom digsig.errors import InvalidSignatureError\n\ntry:\n    public_key.verify(signature)\nexcept InvalidSignatureError:\n    print('Invalid signature.')\n```\n\n# Generate keys\n## RSA\n```python\nfrom digsig import RsaPrivateKey, RsaModes\n\nprivate_key = RsaPrivateKey(mode=RsaModes.PSS_MGF1_SHA256)\npublic_key = private_key.public_key\n```\n\n## ECDSA\n```python\nfrom digsig import EcdsaPrivateKey, EcdsaModes\n\nprivate_key = EcdsaPrivateKey(mode=EcdsaModes.SECP256K1_KECCAK_256_ETHEREUM)\npublic_key = private_key.public_key\n```\n\n# Export keys\n## RSA\n```python\nprivate_pem = private_key.private_pem\npublic_pem = private_key.public_key.public_pem\n```\n\n## ECDSA\n```python\nprivate_value = private_key.private_value\nprivate_value_bytes = private_key.private_value_bytes\nprivate_value_hex = private_key.private_value_hex\nprivate_value_base64 = private_key.private_value_base64\nethereum_keystore = private_key.get_ethereum_account()\n\npublic_value = private_key.public_key.public_value\npublic_bytes = private_key.public_key.public_bytes\npublic_base64 = private_key.public_key.public_base64\nethereum_address = private_key.public_key.ethereum_address\n```\n# Supported modes\n## RSA\n\u003e To-Do\n\n## ECDSA\n\u003e To-Do\n\n\n# Supported formats\n## RSA\n\u003e To-Do\n\n## ECDSA\n\u003e To-Do\n","funding_links":["https://www.buymeacoffee.com/brunneis"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flabteral%2Fdigsig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flabteral%2Fdigsig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flabteral%2Fdigsig/lists"}