{"id":43352247,"url":"https://github.com/dimagi/pyfidelius","last_synced_at":"2026-02-02T02:32:46.809Z","repository":{"id":196436925,"uuid":"696095944","full_name":"dimagi/pyfidelius","owner":"dimagi","description":"ECDSA Key Generation and AES-GCM Encryption/Decryption","archived":false,"fork":false,"pushed_at":"2024-01-25T05:16:00.000Z","size":15,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":16,"default_branch":"master","last_synced_at":"2024-05-01T11:28:12.403Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dimagi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-09-25T04:30:50.000Z","updated_at":"2024-03-17T13:57:37.000Z","dependencies_parsed_at":"2024-01-25T06:26:26.504Z","dependency_job_id":"1c2ff20c-68d6-4a9f-b7d5-629141f818e0","html_url":"https://github.com/dimagi/pyfidelius","commit_stats":null,"previous_names":["dimagi/pyfidelius"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dimagi/pyfidelius","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimagi%2Fpyfidelius","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimagi%2Fpyfidelius/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimagi%2Fpyfidelius/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimagi%2Fpyfidelius/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dimagi","download_url":"https://codeload.github.com/dimagi/pyfidelius/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimagi%2Fpyfidelius/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29001654,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-02T01:32:03.847Z","status":"online","status_checked_at":"2026-02-02T02:00:07.448Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2026-02-02T02:32:46.741Z","updated_at":"2026-02-02T02:32:46.804Z","avatar_url":"https://github.com/dimagi.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"pyFidelius\n==========\n\nThis is a Python port of a Java project called Fidelius-CLI https://github.com/mgrmtech/fidelius-cli/ which has utilities to generate ECDH keys based on a custom ECDSA Curve 25519 and perform encryption and decryption. Refer to the Java project's README.md for implementation details.\n\nThis project uses the below two Python libraries to implement the \nequivalent cryptographic functionalities that the Java project implements.\n\n1. [fastecdsa](https://github.com/AntonKueltz/fastecdsa) - this is used for generating public and private key pairs. This library implements the custom curve 25519 from the BouncyCastle Java library that Fidelius uses. The only difference being in the curve's `gy` parameter. We define a new custom curve named BC25519 with `gy` value taken from BouncyCastle.\n2. [pyCryptodome](https://github.com/Legrandin/pycryptodome) - this is one of the popular cryptographic libraries, used here to perform encryption and decryption following the same process as Fidelius-CLI follows.\n\n\nInstallation\n============\n\nAdd it as a pip-requirement in your requirements.txt and do a `pip install`.\n\n```\nfidelius @ git+https://github.com/dimagi/pyfidelius.git@master\n```\n\nUsage\n=====\n\nGenerate a key pair.\n--------------------\n\n```\nfrom fidelius import KeyMaterial\n\nkey_material = KeyMaterial.generate()\nprint(key_material.private_key)\nprint(key_material.public_key)\nprint(key_material.x509_public_key)\nprint(key_material.nonce)\n\n```\n\nPerform encryption.\n-------------------\n\n```\nfrom fidelius import CryptoController, EncryptionRequest\n\nencryption_request = EncryptionRequest(\n    sender_nonce=\"lmXgblZwotx+DfBgKJF0lZXtAXgBEYr5khh79Zytr2Y=\",\n    requester_nonce=\"6uj1RdDUbcpI3lVMZvijkMC8Te20O4Bcyz0SyivX8Eg=\",\n    sender_private_key=\"AYhVZpbVeX4KS5Qm/W0+9Ye2q3rnVVGmqRICmseWni4=\",\n    requester_public_key=\"BAheD5rUqTy4V5xR4/6HWmYpopu5CO+KO8BECS0udNqUTSNo91TIqIIy1A4Vh+F94c+n9vAcwXU2bGcfsI5f69Y=\",\n    string_to_encrypt=\"Wormtail should never have been Potter cottage's secret keeper.\"\n)\ncontroller = CryptoController()\nencrypted_string = controller.encrypt(encryption_request)\nprint(encrypted_string)\n```\n\nYou can also pass string_to_encrypt_base64 instead of string_to_encrypt for encrypting base64 strings\n\nPerform decryption.\n-------------------\n\n```\nfrom fidelius import CryptoController, DecryptionRequest\n\ndecryption_request = DecryptionRequest(\n    sender_nonce=\"lmXgblZwotx+DfBgKJF0lZXtAXgBEYr5khh79Zytr2Y=\",\n    requester_nonce=\"6uj1RdDUbcpI3lVMZvijkMC8Te20O4Bcyz0SyivX8Eg=\",\n    requester_private_key=\"DMxHPri8d7IT23KgLk281zZenMfVHSdeamq0RhwlIBk=\",\n    sender_public_key=\"BABVt+mpRLMXiQpIfEq6bj8hlXsdtXIxLsspmMgLNI1SR5mHgDVbjHO2A+U4QlMddGzqyEidzm1AkhtSxSO2Ahg=\",\n    encrypted_data=\"pzMvVZNNVtJzqPkkxcCbBUWgDEBy/mBXIeT2dJWI16ZAQnnXUb9lI+S4k8XK6mgZSKKSRIHkcNvJpllnBg548wUgavBa0vCRRwdL6kY6Yw==\"\n)\ncontroller = CryptoController()\ndecrypted_string = controller.decrypt(decryption_request)\nprint(decrypted_string)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdimagi%2Fpyfidelius","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdimagi%2Fpyfidelius","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdimagi%2Fpyfidelius/lists"}