{ "info": { "author": "Kirill Kirikov", "author_email": "kk@4irelabs.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "Strict DER signature encoding/decoding.\n\nSee [bip66](https://github.com/bitcoin/bips/blob/master/bip-0066.mediawiki).\n\n- This module **works only with [two's complement](https://en.wikipedia.org/wiki/Two's_complement) numbers**.\n- BIP66 doesn't check that `r` or `s` are fully valid.\n - `check`/`decode` doesn't check that `r` or `s` great than 33 bytes or that this number represent valid point on elliptic curve.\n - `encode` doesn't check that `r`/`s` represent valid point on elliptic curve.\n\n## Example\n\n``` python\nimport bip66\nr = \"29db2d5f4e1dcc04e19266cce3cb135865784c62ab653b307f0e0bb744f5c2aa\"\ns = \"00a97f5826912cac8b44d9f577a26f169a2f8db781f2ddb7de2bc886e93b6844\"\nencoded = bip66.encode(binascii.unhexlify(r), binascii.unhexlify(s))\nsignature = binascii.hexlify(encoded).decode()\n# > 00a97f5826912cac8b44d9f577a26f169a2f8db781f2ddb7de2bc886e93b6844\n\nDER = \"3044022029db2d5f4e1dcc04e19266cce3cb135865784c62ab653b307f0e0bb\" \\\n \"744f5c2aa022000a97f5826912cac8b44d9f577a26f169a2f8db781f2ddb7de2bc886e93b6844\"\nr, s = bip66.decode(binascii.unhexlify(DER))\nprint(binascii.hexlify(r).decode())\nprint(binascii.hexlify(s).decode())\n\n# > 29db2d5f4e1dcc04e19266cce3cb135865784c62ab653b307f0e0bb744f5c2aa\n# > 00a97f5826912cac8b44d9f577a26f169a2f8db781f2ddb7de2bc886e93b6844\n```\n\nA catch-all exception regex:\n``` python\n/Expected DER (integer|sequence)|(R|S) value (excessively padded|is negative)|(R|S|DER sequence) length is (zero|too short|too long|invalid)/\n```\n\n## LICENSE [MIT](LICENSE)\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/KiriKiri/bip66", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "bip66", "package_url": "https://pypi.org/project/bip66/", "platform": "", "project_url": "https://pypi.org/project/bip66/", "project_urls": { "Homepage": "https://github.com/KiriKiri/bip66" }, "release_url": "https://pypi.org/project/bip66/0.4/", "requires_dist": null, "requires_python": "", "summary": "Strict DER signature encoding/decoding.", "version": "0.4" }, "last_serial": 4622992, "releases": { "0.4": [ { "comment_text": "", "digests": { "md5": "187859bbb1b0208b5e4598fcb51ba608", "sha256": "aa79b753db54bdf57cabcf68315700316bab7da30561e810603c1c01c74df350" }, "downloads": -1, "filename": "bip66-0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "187859bbb1b0208b5e4598fcb51ba608", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7929, "upload_time": "2018-12-20T23:44:43", "url": "https://files.pythonhosted.org/packages/ec/39/b383faec6f161c9a5f22a41ab4e2e7ea4439ab17a7730f9c667a35089761/bip66-0.4-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "187859bbb1b0208b5e4598fcb51ba608", "sha256": "aa79b753db54bdf57cabcf68315700316bab7da30561e810603c1c01c74df350" }, "downloads": -1, "filename": "bip66-0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "187859bbb1b0208b5e4598fcb51ba608", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7929, "upload_time": "2018-12-20T23:44:43", "url": "https://files.pythonhosted.org/packages/ec/39/b383faec6f161c9a5f22a41ab4e2e7ea4439ab17a7730f9c667a35089761/bip66-0.4-py3-none-any.whl" } ] }