{ "info": { "author": "J\u00f6rn Heissler", "author_email": "NOSPAM-cryptokey@joern.heissler.de", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.7" ], "description": "CryptoKey\n=========\n\nPython (>= 3.7) library for asymmetric cryptography with algorithms such as RSA and ECC.\n\nVarious backends implement wrappers around other crypto libraries (such as https://cryptography.io/)\nand makes them available using a unified API. The actual cryptographic operations are carried out\nby those backend libraries.\n\nNo hard dependencies on any non-python libraries such as OpenSSL exist.\n\nCryptoKey is meant to be used by other libraries that need to carry out cryptographic\noperations. That could e.g. be an ACME client, TrustedTimeStamp service or an SSH client.\n\nUsers can implement their own backends to utilise their favourite HSM or smartcard,\ncloud HSMs or their own ECC implementation (don't!), etc.\n\nCryptoKey can thus be seen as a python alternative to PKCS#11.\n\nThere are high-level interfaces such as `key.sign(msg)` which just do the right thing,\nand low-level interfaces such as `rsakey.sign_int` to calculate `s = m ** d % n` which,\nif used incorrectly, opens up security holes.\n\nImplementations for padding schemes such as PSS are given. They can be used for low-level\nplumbing like extracting the salt from a PSS signature or creating a PSS signature with a\nspecific salt.\n\nOne stated goal is to provide interfaces for unsafe operations too.\nIf you want to shoot yourself in the foot, here's the tool to do it!\n\nExamples\n========\n\nSign a message::\n from asyncio import run\n from cryptography.hazmat.primitives import serialization\n from cryptokey.backend.cryptography import backend\n from cryptokey.backend.cryptography.rsa import RsaPrivateKey\n\n # Load a private key using normal cryptography.io operations.\n with open('private.key', 'rb') as fp:\n cryptography_key = serialization.load_pem_private_key(\n fp.read(),\n password=None,\n backend=backend,\n )\n\n # Create wrapper\n key = RsaPrivateKey(cryptography_key)\n\n # Sign a message. By default, PSS and SHA2_256 are used. The\n # signature object also contains the parameters that were used.\n sig = run(key.sign(b'Hello, World!'))\n\n # Write signature to a file.\n with open('hello.sig', 'wb') as fp:\n fp.write(sig.value)\n\nVerifying the signature using openssl::\n echo -n 'Hello, World!' | openssl sha256 -binary | openssl pkeyutl \\\n -verify -inkey private.key -sigfile hello.sig -pkeyopt digest:sha256 \\\n -pkeyopt rsa_padding_mode:pss\n\nSolving homework::\n from asyncio import run\n from cryptokey.backend.textbook.rsa import TextbookRsaPrivateKey\n\n key = TextbookRsaPrivateKey(public_exponent=7, primes=(17, 31))\n print(f'Private exponent: {key.private_exponent}')\n print(f'Signature for M=2: {run(key.sign_int(2)).int_value}')\n\nSecurity\n--------\nThis library is supposed to be just as (in)secure as the used backend.\nIf in doubt, use the `cryptography` backend, which builds upon OpenSSL.\n\nThe `textbook` backend is deliberately insecure and should not be used for\nreal applications.\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/joernheissler/cryptokey", "keywords": "Cryptography", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "cryptokey", "package_url": "https://pypi.org/project/cryptokey/", "platform": "", "project_url": "https://pypi.org/project/cryptokey/", "project_urls": { "Homepage": "https://github.com/joernheissler/cryptokey" }, "release_url": "https://pypi.org/project/cryptokey/0.2.2/", "requires_dist": [ "asn1crypto" ], "requires_python": ">= 3.7", "summary": "Python library for pluggable asymmetric low-level encryption", "version": "0.2.2" }, "last_serial": 4754298, "releases": { "0.2.2": [ { "comment_text": "", "digests": { "md5": "528b4cee9bbbd9ae9d98cf76587163d6", "sha256": "8dc1eff7d3bde5bc89f3a7a17f68b076369747005b7a20b9c24e87609f0c229d" }, "downloads": -1, "filename": "cryptokey-0.2.2-py3-none-any.whl", "has_sig": false, "md5_digest": "528b4cee9bbbd9ae9d98cf76587163d6", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">= 3.7", "size": 32111, "upload_time": "2019-01-29T10:28:45", "url": "https://files.pythonhosted.org/packages/b6/05/0cb6d868f3bb75028b517b32cb3e03d6cf4c978d7adce3845b3b129d46c6/cryptokey-0.2.2-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "528b4cee9bbbd9ae9d98cf76587163d6", "sha256": "8dc1eff7d3bde5bc89f3a7a17f68b076369747005b7a20b9c24e87609f0c229d" }, "downloads": -1, "filename": "cryptokey-0.2.2-py3-none-any.whl", "has_sig": false, "md5_digest": "528b4cee9bbbd9ae9d98cf76587163d6", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">= 3.7", "size": 32111, "upload_time": "2019-01-29T10:28:45", "url": "https://files.pythonhosted.org/packages/b6/05/0cb6d868f3bb75028b517b32cb3e03d6cf4c978d7adce3845b3b129d46c6/cryptokey-0.2.2-py3-none-any.whl" } ] }