{ "info": { "author": "Guardtime", "author_email": "info@guardtime.com", "bugtrack_url": null, "classifiers": [], "description": "KSI Python SDK\n==============\n\nThis is a thin wrapper on top of KSI C SDK. Experimental, non-supported code.\n\nSynopsis\n--------\n\nExample of synchronous singing and verification.\n\n.. code-block:: python\n\n import ksi\n import hashlib\n\n # Instantiate service parameters from the environment\n KSI = ksi.KSI(**ksi.ksi_env())\n\n # Sign a text string\n sig = KSI.sign_hash(hashlib.sha256(b\"Tere!\"))\n # Print some signature properties\n print(sig.get_signing_time(), sig.get_signer_id())\n\n # Now verify this text string, first obtaining a data hasher\n h = sig.get_hasher()\n h.update(b\"Tere!\")\n print(KSI.verify_hash(sig, h))\n\n # Obtain a binary blob which can be stored for long term\n serialized_signature = sig.get_binary()\n\n # Some time have passed, fetch the signature and verify again\n sig2 = KSI.new_signature_object(serialized_signature)\n print(KSI.verify_hash(sig2, h))\n\nNote that asynchronous signing can provide a significant speedup when multiple signatures are requested.\nExample of asynchronous singing with gevent.\n\n.. code-block:: python\n\n import ksi\n import hashlib\n from gevent.pool import Pool\n\n # Instantiate service parameters from the environment\n KSI = ksi.KSI(**ksi.ksi_env())\n\n # Multiple strings to be signed\n string_list = [\"This\", \"is\", \"a\", \"list\", \"of\", \"strings\"]\n\n # Define a signer function.\n def sign_hash(h):\n sig = KSI.sign_hash(h)\n # Verification and/or storing could be done here\n print(KSI.verify_hash(sig, h))\n\n # Create a gevent pool. Note that for optimal efficiency\n # pool size should not be smaller than\n # ``KSI.get_async_config()['max_pending_count']``\n pool = Pool(100)\n\n # Sign all strings asynchronously\n for string in string_list:\n pool.spawn(sign_hash, hashlib.sha256(string.encode()))\n pool.join()\n\nClient-side aggregation (signing in blocks) is also possible if the KSI Gateway allows it. This means\nthat multiple hashes can be individually signed by a single request to the Gateway server. In addition, if\nblock signing is allowed, the asynchronous signing service will by default dynamically sign in blocks depending\non if the signing requests demand becomes too large to efficiently sign them one-by-one.\nExample of signing a block of hashes synchronously (asynchronous block signing is supported as well).\n\n.. code-block:: python\n\n import ksi\n import hashlib\n\n # Instantiate service parameters from the environment\n KSI = ksi.KSI(**ksi.ksi_env())\n\n # Multiple strings to be signed\n string_list = [\"This\", \"is\", \"a\", \"list\", \"of\", \"strings\"]\n\n # Hashes of strings\n hash_list = [hashlib.sha256(string.encode()) for string in string_list]\n\n # Sign hashes in a block\n sigs = KSI.sign_hash_list(hash_list)\n\n # Verify hashes\n for i in range(len(sigs)):\n print(KSI.verify_hash(sigs[i], hash_list[i]))\n\n\nInstall\n-------\n\n#. Requirements: Python 2.7+ or Python 3.1+. Jython, IronPython are not supported.\n\n#. Install fresh libksi aka KSI C SDK; see https://github.com/guardtime/libksi/\n\n#. Install python-devel package\n\n#. Run::\n\n > pip install ksi-python\n\nor\n\n > easy_install ksi-python\n\n\n\nTests\n-----\nSpecify KSI Gateway access parameters and run\n::\n\n > python setup.py test\n\nTo test if KSI Python SDK signs asynchronously with gevent, make sure gevent is installed.\n\nDocumentation\n-------------\n\nhttp://guardtime.github.io/ksi-python/\n\nType::\n\n > pydoc ksi\n\nto read the documentation after installation. Generating html or pdf documentation:\nmake sure that dependencies like sphinx (``pip install sphinx``) are installed, extension\nis built (``python setup.py build``) and run::\n\n > cd docs\n > make html\n or\n > make latexpdf\n\n\n\nLicense\n-------\nApache 2.0. Please contact Guardtime for supported options.", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/guardtime/ksi-python", "keywords": "", "license": "Apache 2.0", "maintainer": "", "maintainer_email": "", "name": "ksi-python", "package_url": "https://pypi.org/project/ksi-python/", "platform": "any", "project_url": "https://pypi.org/project/ksi-python/", "project_urls": { "Homepage": "https://github.com/guardtime/ksi-python" }, "release_url": "https://pypi.org/project/ksi-python/1.0.0/", "requires_dist": null, "requires_python": "", "summary": "Python wrapper for libksi, a library for accessing Guardtime KSI service", "version": "1.0.0" }, "last_serial": 4363797, "releases": { "0.3.1": [ { "comment_text": "", "digests": { "md5": "931cfd216d31f1c6202a66c53c20c6ca", "sha256": "6e5b7b2283f7e2dada20b95e894a1f58ab86bbc87cb529bd2b1aa29d48639e64" }, "downloads": -1, "filename": "ksi-python-0.3.1.tar.gz", "has_sig": false, "md5_digest": "931cfd216d31f1c6202a66c53c20c6ca", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12906, "upload_time": "2018-02-19T16:32:49", "url": "https://files.pythonhosted.org/packages/d5/00/b95de25d670eb5f5ac496250486883e4471e118ec89e2837f1edd718268d/ksi-python-0.3.1.tar.gz" } ], "0.3.2": [ { "comment_text": "", "digests": { "md5": "02e099794688f2d65dde597623041309", "sha256": "565c8acf2d4882e845fed4abe22d69fc273214bfdaefa63c142f6443ad1d1bc0" }, "downloads": -1, "filename": "ksi-python-0.3.2.tar.gz", "has_sig": false, "md5_digest": "02e099794688f2d65dde597623041309", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13041, "upload_time": "2018-02-19T21:09:31", "url": "https://files.pythonhosted.org/packages/f6/de/07fed3066cdd6b00a18a4907b70351753af6a9249ad12a5a650a7af5a9c1/ksi-python-0.3.2.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "7ccd0de4f32d3f36c678a6c89a953757", "sha256": "69645d3711616a86d20d57655ce655bee5389102f96f5dff927c635bffdd8357" }, "downloads": -1, "filename": "ksi-python-1.0.0.tar.gz", "has_sig": false, "md5_digest": "7ccd0de4f32d3f36c678a6c89a953757", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22843, "upload_time": "2018-10-11T10:33:31", "url": "https://files.pythonhosted.org/packages/75/89/85e4802ce4ef5467b6001b240147dc8c1b25e300036de1c30f0daeb54be2/ksi-python-1.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7ccd0de4f32d3f36c678a6c89a953757", "sha256": "69645d3711616a86d20d57655ce655bee5389102f96f5dff927c635bffdd8357" }, "downloads": -1, "filename": "ksi-python-1.0.0.tar.gz", "has_sig": false, "md5_digest": "7ccd0de4f32d3f36c678a6c89a953757", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22843, "upload_time": "2018-10-11T10:33:31", "url": "https://files.pythonhosted.org/packages/75/89/85e4802ce4ef5467b6001b240147dc8c1b25e300036de1c30f0daeb54be2/ksi-python-1.0.0.tar.gz" } ] }