{ "info": { "author": "Blockcerts", "author_email": "info@blockcerts.org", "bugtrack_url": null, "classifiers": [], "description": "[![Build Status](https://travis-ci.org/blockchain-certificates/cert-tools.svg?branch=master)](https://travis-ci.org/blockchain-certificates/cert-tools)\n\n# cert-tools\nCommand line tools for designing certificate templates, instantiating a certificate batch, and import/export tasks\n\nsee example of certificate template and batch creation in sample_data \n\n## Install\n\n1. Ensure you have an python environment. [Recommendations](https://github.com/blockchain-certificates/cert-issuer/blob/master/docs/virtualenv.md)\n\n2. Git clone the repository and change to the directory\n\n ```bash\n git clone https://github.com/blockchain-certificates/cert-tools.git && cd cert-tools\n ```\n\n3. Run the setup script\n\n ```bash\n pip install .\n ```\n\n## Scripts\n\nThe cert-tools setup script installs 2 scripts, which are described below:\n\n\n### create_certificate_template.py\n\n#### Run\n\n```bash\ncreate-certificate-template -c conf.ini\n```\n\n#### Configuration\n\nThe `conf.ini` fields are described below. Optional arguments are in brackets\n\n```\ncreate-certificate-template --help\n\nusage: create_v2_certificate_template.py [-h] [-c MY_CONFIG]\n [--data_dir DATA_DIR]\n [--issuer_logo_file ISSUER_LOGO_FILE]\n [--cert_image_file CERT_IMAGE_FILE]\n [--issuer_url ISSUER_URL]\n [--issuer_certs_url ISSUER_CERTS_URL]\n --issuer_email ISSUER_EMAIL\n --issuer_name ISSUER_NAME\n --issuer_id ISSUER_ID [--issuer_key ISSUER_KEY]\n [--certificate_description CERTIFICATE_DESCRIPTION]\n --certificate_title CERTIFICATE_TITLE\n --criteria_narrative CRITERIA_NARRATIVE\n [--template_dir TEMPLATE_DIR]\n [--template_file_name TEMPLATE_FILE_NAME]\n [--hash_emails]\n [--revocation_list REVOCATION_LIST]\n [--issuer_public_key ISSUER_PUBLIC_KEY]\n --badge_id BADGE_ID\n [--issuer_signature_lines ISSUER_SIGNATURE_LINES]\n [--additional_global_fields ADDITIONAL_GLOBAL_FIELDS]\n [--additional_per_recipient_fields ADDITIONAL_PER_RECIPIENT_FIELDS]\n\n\nArgs that start with '--' (eg. --data_dir) can also be set in a config file (./cert-tools/conf.ini or specified via -c). Config file syntax allows: key=value, flag=true, stuff=[a,b,c] (for details, see syntax at https://goo.gl/R74nmi). If an arg is specified in more than one place, then commandline values override config file values which override defaults.\n\n\nArgument details:\n -h, --help show this help message and exit\n -c MY_CONFIG, --my-config MY_CONFIG\n config file path (default: None)\n --data_dir DATA_DIR where data files are located (default: None)\n --issuer_logo_file ISSUER_LOGO_FILE\n issuer logo image file, png format (default: None)\n --cert_image_file CERT_IMAGE_FILE\n issuer logo image file, png format (default: None)\n --issuer_url ISSUER_URL\n issuer URL (default: None)\n --issuer_certs_url ISSUER_CERTS_URL\n issuer certificates URL (default: None)\n --issuer_email ISSUER_EMAIL\n issuer email (default: None)\n --issuer_name ISSUER_NAME\n issuer name (default: None)\n --issuer_id ISSUER_ID\n issuer profile (default: None)\n --issuer_key ISSUER_KEY\n issuer issuing key (default: None)\n --certificate_description CERTIFICATE_DESCRIPTION\n the display description of the certificate (default:\n None)\n --certificate_title CERTIFICATE_TITLE\n the title of the certificate (default: None)\n --criteria_narrative CRITERIA_NARRATIVE\n criteria narrative (default: None)\n --template_dir TEMPLATE_DIR\n the template output directory (default: None)\n --template_file_name TEMPLATE_FILE_NAME\n the template file name (default: None)\n --hash_emails whether to hash emails in the certificate (default:\n False)\n --revocation_list REVOCATION_LIST\n issuer revocation list (default: None)\n --issuer_public_key ISSUER_PUBLIC_KEY\n issuer public key (default: None)\n --badge_id BADGE_ID badge id (default: None)\n --issuer_signature_lines ISSUER_SIGNATURE_LINES\n issuer signature lines (default: None)\n --additional_global_fields ADDITIONAL_GLOBAL_FIELDS\n additional global fields (default: None)\n --additional_per_recipient_fields ADDITIONAL_PER_RECIPIENT_FIELDS\n additional per-recipient fields (default: None)\n\n\n```\n\n#### About\n\nCreates a certificate template populated with the setting you provide in the conf.ini file. This will not contain recipient-specific data; such fields will be populated with merge tags.\n \n\n### instantiate_certificate_batch.py\n\n#### Run\n\n```\ninstantiate-certificate-batch -c conf.ini\n```\n\n\n#### About\n\nPopulates the certificate template (created by the previous script) with recipient data from a csv file. It generates a certificate per recipient based on the values in the csv file.\n\nThe csv file location is configurable via the conf.ini file.\n\nThe csv file must always contain:\n\n- name\n- pubkey\n- identity\n\n#### Configuration\n\nThe `conf.ini` fields are described below. Optional arguments are in brackets\n\n\n```\ninstantiate-certificate-batch --help\n\nusage: instantiate_v2_certificate_batch.py [-h] [-c MY_CONFIG]\n [--data_dir DATA_DIR]\n [--issuer_certs_url ISSUER_CERTS_URL]\n [--template_dir TEMPLATE_DIR]\n [--template_file_name TEMPLATE_FILE_NAME]\n [--hash_emails]\n [--additional_per_recipient_fields ADDITIONAL_PER_RECIPIENT_FIELDS]\n [--unsigned_certificates_dir UNSIGNED_CERTIFICATES_DIR]\n [--roster ROSTER]\n\nArgs that start with '--' (eg. --data_dir) can also be set in a config file (./cert-tools/conf.ini or specified via -c). Config file syntax allows: key=value, flag=true, stuff=[a,b,c] (for details, see syntax at https://goo.gl/R74nmi). If an arg is specified in more than one place, then commandline values override config file values which override defaults.\n\nArgument details:\n -h, --help show this help message and exit\n -c MY_CONFIG, --my-config MY_CONFIG\n config file path (default: None)\n --data_dir DATA_DIR where data files are located (default: None)\n --issuer_certs_url ISSUER_CERTS_URL\n issuer certificates URL (default: None)\n --template_dir TEMPLATE_DIR\n the template output directory (default: None)\n --template_file_name TEMPLATE_FILE_NAME\n the template file name (default: None)\n --hash_emails whether to hash emails in the certificate (default:\n False)\n --additional_per_recipient_fields ADDITIONAL_PER_RECIPIENT_FIELDS\n additional per-recipient fields (default: None)\n --unsigned_certificates_dir UNSIGNED_CERTIFICATES_DIR\n output directory for unsigned certificates (default:\n None)\n --roster ROSTER roster file name (default: None)\n\n```\n\n### Adding custom fields\n\nYou can specify additional global fields (fields that apply for every certificate in the batch) and additional per-recipient fields (fields that you will specify per-recipient).\n\n#### Important: defining your custom fields in a JSON-LD context\nWhen adding either global or per-recipient custom fields, you must define each of your new terms in a [JSON-LD context](https://json-ld.org/spec/latest/json-ld/). You can either point to an existing JSON-LD context, or embed them directly in the context of the certificate. For an example of the latter, see the [JSON-LD specification section 3.1](https://json-ld.org/spec/latest/json-ld/#the-context). In this case, the `@context` value would be an array listing the existing context links, and your new definition.\n\nExamples of both options are below:\n```\n{\n \"@context\": [\n \"https://w3id.org/openbadges/v2\",\n \"https://w3id.org/blockcerts/v2\",\n \"https://your-custom-context/v1\", <-- option 1: point to custom JSON-LD context\n { <-- option 2: directly embed in certificate\n \"xyz_custom_field\": \"http://path/to/xyz_custom_field\",\n ... // and all other custom fields\n }\n ]\n}\n```\n\n#### Custom global fields\n\nYou can specify custom global fields in the conf.ini file with the `additional_global_fields` entry\n\nFor each additional global field, you must indicate:\n\n- the jsonpath to the field\n- the global value to use\n\nExample:\n\nconf.ini:\n```\nadditional_global_fields = {\"fields\": [{\"path\": \"$.certificate.subtitle\",\"value\": \"custom subtitle\"}]}\n```\n\nor, expanded for readability:\n```\n additional_global_fields = {\n \"fields\": \n [\n {\n \"path\": \"$.certificate.subtitle\",\n \"value\": \"custom subtitle\"\n }\n ]\n }\n\n```\n\n#### Custom per-recipient fields\n\nSee above note on (current) manual step of defining custom JSON-LD context.\n\nPer-recipient fields are specified in a combination of the conf.ini file, with the `additional_per_recipient_fields` entry, and the .csv file containing per-recipient data. Per-recipient fields are used in both template creation and certificate instantiaion. During the template creation process, we apply placeholder merge tags as values. This helps you preview your template before running `instantiate_certificate_batch.py`. \n\nFor each additional per-recipient field, you must indicate the following in the `additional_per_recipient_fields` config field:\n\n- the jsonpath to the field\n- the merge_tag placeholder to use\n- the csv column where the value (per recipient) can be found. This is used by instantiate_certificate_batch\n\nExample:\n\nconf.ini version:\n```\n additional_per_recipient_fields = {\"fields\": [{\"path\": \"$.xyz_custom_field\",\"value\": \"*|THIS WILL CONTAIN XYZ CUSTOM VALUES|*\",\"csv_column\": \"xyz_custom_field\"}]}\n```\n\nabove expanded for readability:\n```\nTODO\n```\n \n \n### create_revocation_addresses.py (currently unused)\n\n#### Run (optional)\n```\ncreate-revocation-addresses -k tpubD6NzV...H66KUZEBkf\n```\n\n#### About\n\nGenerates Bitcoin addresses using an HD extended public (or private) key to be used as the issuer's revocation addresses for the certificates. This would be useful only if the issuer requires to be able to revoke specific certificates later on. It creates a list of addresses that could then be easily merged with the roster file, e.g. using unix's paste command.\n\nTo create 20 revocation address for a testnet extended public key for the first batch of 2016 certificates run:\n\n```\necho \"revkey\" > rev_addresses.txt\n\ncreate-revocation-addresses -n 20 -p \"2016/1\" -k tpubD6NzV...H66KUZEBkf >> rev_addresses.txt\n```\n\nTo merge to roster (in unix) run:\n\n```\npaste -d , roster.txt rev_addresses.txt > roster_with_rev.txt\n```\n\n## Example\n\nSee sample_data for example configuration and output. `conf-mainnet.ini` was used to create a batch of 2 unsigned certificates on the Bitcoin blockchain. \n\nThe steps were:\n- Create the template\n - Update the config file to contain the correct data to populate the certificates\n - Place the needed images in `images/` and point to them in the config file\n - Run `create_certificate_template.py`, which resulted in the certificate template `/certificate_templates/test.json`\n- Instantiate the batch\n - Add the recipient roster (in this case `rosters/roster_testnet.csv`) with the recipient's Bitcoin addresses.\n - Run 'instantiate_certificate_batch.py', which resulted in the files in `unsigned_certificates`\n \nThen the unsigned certificates were copied to cert-issuer for signing and issuing on the blockchain.\n\n## Contact\n\nContact us at [the Blockcerts community forum](http://community.blockcerts.org/).\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/blockchain-certificates/cert-tools", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "cert-tools", "package_url": "https://pypi.org/project/cert-tools/", "platform": "", "project_url": "https://pypi.org/project/cert-tools/", "project_urls": { "Homepage": "https://github.com/blockchain-certificates/cert-tools" }, "release_url": "https://pypi.org/project/cert-tools/2.0.11/", "requires_dist": null, "requires_python": "", "summary": "creates blockchain certificates", "version": "2.0.11" }, "last_serial": 4118940, "releases": { "1.2.1": [ { "comment_text": "", "digests": { "md5": "76221765ac7c321258538a46ded291a7", "sha256": "45dea4cef13838d9968c94874a4dc64cf18e370f29ec3b315fd3fe0c96c9d88f" }, "downloads": -1, "filename": "cert-tools-1.2.1.tar.gz", "has_sig": false, "md5_digest": "76221765ac7c321258538a46ded291a7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9675, "upload_time": "2017-01-12T02:27:09", "url": "https://files.pythonhosted.org/packages/63/5e/2594938c70812d7c303fa0ea02e48871f8e71b3ceca309e333d1d967ee83/cert-tools-1.2.1.tar.gz" } ], "1.2.2": [ { "comment_text": "", "digests": { "md5": "8d1a849c6ad36b9de587825c78dd37e2", "sha256": "591ecca6df49dc4be4d7da7854c34d572669465fb8951b0c91f43277d6ac8139" }, "downloads": -1, "filename": "cert-tools-1.2.2.tar.gz", "has_sig": false, "md5_digest": "8d1a849c6ad36b9de587825c78dd37e2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9855, "upload_time": "2017-01-17T19:45:18", "url": "https://files.pythonhosted.org/packages/a4/55/83194d7e16497047a6c2e3229f1089c514f237ac5c6d1c49b604420482de/cert-tools-1.2.2.tar.gz" } ], "2.0.1": [ { "comment_text": "", "digests": { "md5": "55677d50d4499d28814218c773b4e8c5", "sha256": "548bd170dbb6328b29b5cd89235eb155d6f376207e84069227c77b282ff75ddb" }, "downloads": -1, "filename": "cert-tools-2.0.1.tar.gz", "has_sig": false, "md5_digest": "55677d50d4499d28814218c773b4e8c5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11382, "upload_time": "2017-07-20T16:34:20", "url": "https://files.pythonhosted.org/packages/86/3c/be3f7c99c660d83e578d62b521307b394838e30e57091c57cbd41a6ff60d/cert-tools-2.0.1.tar.gz" } ], "2.0.10": [ { "comment_text": "", "digests": { "md5": "f20375703c140727a1a24fff35470543", "sha256": "13f3ab790029dec4e140437d6ec1811381e598915c0c926e95fd68711e4d21df" }, "downloads": -1, "filename": "cert-tools-2.0.10.tar.gz", "has_sig": false, "md5_digest": "f20375703c140727a1a24fff35470543", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16417, "upload_time": "2018-04-29T19:54:38", "url": "https://files.pythonhosted.org/packages/71/b9/e856f958d6e31941f80b45745d17ef5339fe042d4120c872eb805740fced/cert-tools-2.0.10.tar.gz" } ], "2.0.11": [ { "comment_text": "", "digests": { "md5": "8915721befd34395ebeed5f50e0c11f9", "sha256": "5b537ef6af868a2f41bdc5bf4a62b41761f655aa2ff8e303c8cc0896dbee2d90" }, "downloads": -1, "filename": "cert-tools-2.0.11.tar.gz", "has_sig": false, "md5_digest": "8915721befd34395ebeed5f50e0c11f9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16463, "upload_time": "2018-05-11T21:59:21", "url": "https://files.pythonhosted.org/packages/c0/3e/c315c261fa6df5b253084da52fffa27cdf995cad0f990ffbfba18277974f/cert-tools-2.0.11.tar.gz" } ], "2.0.2": [ { "comment_text": "", "digests": { "md5": "84ca45e555308fab2e50de901be3687e", "sha256": "45771d26e03105cf751a48f29712abcf28bbd76dd6a2b7bcff3b1a2f8932885f" }, "downloads": -1, "filename": "cert-tools-2.0.2.tar.gz", "has_sig": false, "md5_digest": "84ca45e555308fab2e50de901be3687e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11395, "upload_time": "2017-08-31T22:55:38", "url": "https://files.pythonhosted.org/packages/02/54/fe98d56caecc8d86e711d1ea1ddc6bc3de77914d88f4cf4bee6bae79938c/cert-tools-2.0.2.tar.gz" } ], "2.0.3": [ { "comment_text": "", "digests": { "md5": "9f501bd18d908cbe3f4c1fd609a6694d", "sha256": "2f3ba7e612c300357d9f59b5b3fa8a39ccdf021ee58db76b7ca854e065676335" }, "downloads": -1, "filename": "cert-tools-2.0.3.tar.gz", "has_sig": false, "md5_digest": "9f501bd18d908cbe3f4c1fd609a6694d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11387, "upload_time": "2017-09-02T17:50:17", "url": "https://files.pythonhosted.org/packages/b8/cf/ec7639e54ac426334a17ce18a7a7e0a8991d93332b70cd3d14eb480c965b/cert-tools-2.0.3.tar.gz" } ], "2.0.4": [ { "comment_text": "", "digests": { "md5": "84abb357650f7dec120f3769c1f8e1d1", "sha256": "6c4ef8d786ae6af81ebc03ab4f045d574f3ef8d4a7d30fd612a2e6df3f3cc6c6" }, "downloads": -1, "filename": "cert-tools-2.0.4.tar.gz", "has_sig": false, "md5_digest": "84abb357650f7dec120f3769c1f8e1d1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13334, "upload_time": "2017-09-25T20:57:28", "url": "https://files.pythonhosted.org/packages/01/42/705d0f91b584d363beefdb711fc7829c9c5df7143d8f493df0bddf2cdab0/cert-tools-2.0.4.tar.gz" } ], "2.0.5": [ { "comment_text": "", "digests": { "md5": "39f8eb9765d1b9140e944e2af2a5a8d9", "sha256": "86015332f3b818fe8321e75c935326a7231ac502ce8392bac7906b37a142758a" }, "downloads": -1, "filename": "cert-tools-2.0.5.tar.gz", "has_sig": false, "md5_digest": "39f8eb9765d1b9140e944e2af2a5a8d9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13353, "upload_time": "2017-10-12T18:06:54", "url": "https://files.pythonhosted.org/packages/01/41/ffa14868e643ab43141187d902a695060f76f4e090fd82bac71e70b2cd81/cert-tools-2.0.5.tar.gz" } ], "2.0.6": [ { "comment_text": "", "digests": { "md5": "4853d501378f1d2a8e2e226dd862edd4", "sha256": "50e22a465036456f86b8fa75cd7c96bbc2af85d0360bdf24d9a419277b2fd0ae" }, "downloads": -1, "filename": "cert-tools-2.0.6.tar.gz", "has_sig": false, "md5_digest": "4853d501378f1d2a8e2e226dd862edd4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13363, "upload_time": "2017-10-15T15:15:09", "url": "https://files.pythonhosted.org/packages/b0/bd/269fb0cdf18024c4d3cf34a2e476100eca0f4986890e7444cc385d245d7d/cert-tools-2.0.6.tar.gz" } ], "2.0.7": [ { "comment_text": "", "digests": { "md5": "567d0c9c230ddbd398555f639899f8c3", "sha256": "6046d2557540d2a90a865b89cab5fbf0848cbf7431a0af3d43cd9aedd7b6f802" }, "downloads": -1, "filename": "cert-tools-2.0.7.tar.gz", "has_sig": false, "md5_digest": "567d0c9c230ddbd398555f639899f8c3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13375, "upload_time": "2017-10-15T15:43:02", "url": "https://files.pythonhosted.org/packages/d2/c6/5413aac5b6e4161dc83b5218d81467524789c33cd0ffe47519568db0c540/cert-tools-2.0.7.tar.gz" } ], "2.0.8": [ { "comment_text": "", "digests": { "md5": "09d32e0dd50188287362950c59203e29", "sha256": "5745e5b85e236b70585f1d467d29a1e8863506dd66b97a22d7ea3f1c679dca97" }, "downloads": -1, "filename": "cert-tools-2.0.8.tar.gz", "has_sig": false, "md5_digest": "09d32e0dd50188287362950c59203e29", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13377, "upload_time": "2017-10-15T16:23:30", "url": "https://files.pythonhosted.org/packages/b8/41/73c7f9173895f529bec33e8dfeca119fce0d76ad8fc27009f16140e62625/cert-tools-2.0.8.tar.gz" } ], "2.0.9": [ { "comment_text": "", "digests": { "md5": "13ca90fff5da62d2b165417d298670f3", "sha256": "6f4657a896601ce0031fb0595b577aea2d82c07e5287e8ae698e61d045eb8e48" }, "downloads": -1, "filename": "cert-tools-2.0.9.tar.gz", "has_sig": false, "md5_digest": "13ca90fff5da62d2b165417d298670f3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13392, "upload_time": "2017-10-24T18:34:38", "url": "https://files.pythonhosted.org/packages/d7/87/fdf2a0a22aa21a7e931230668e6c0f5f587c09f356ecfaaf5d4ccfa6118e/cert-tools-2.0.9.tar.gz" } ], "2.0b4": [ { "comment_text": "", "digests": { "md5": "4af940be9568ede00596dc1b4af5a30f", "sha256": "d95c7d17403f5329f0ec7d9e50ce822d2f4e4ad9e7696888128eba4de34cee31" }, "downloads": -1, "filename": "cert-tools-2.0b4.tar.gz", "has_sig": false, "md5_digest": "4af940be9568ede00596dc1b4af5a30f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11239, "upload_time": "2017-05-23T00:51:15", "url": "https://files.pythonhosted.org/packages/b4/ea/12f88c67487c67714ca0b58c9f721bdd2e6e459ee6883ff2731941fe551d/cert-tools-2.0b4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "8915721befd34395ebeed5f50e0c11f9", "sha256": "5b537ef6af868a2f41bdc5bf4a62b41761f655aa2ff8e303c8cc0896dbee2d90" }, "downloads": -1, "filename": "cert-tools-2.0.11.tar.gz", "has_sig": false, "md5_digest": "8915721befd34395ebeed5f50e0c11f9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16463, "upload_time": "2018-05-11T21:59:21", "url": "https://files.pythonhosted.org/packages/c0/3e/c315c261fa6df5b253084da52fffa27cdf995cad0f990ffbfba18277974f/cert-tools-2.0.11.tar.gz" } ] }