{"id":13828594,"url":"https://github.com/paragonie/easy-ecc","last_synced_at":"2025-03-03T00:09:06.061Z","repository":{"id":29283029,"uuid":"121166114","full_name":"paragonie/easy-ecc","owner":"paragonie","description":"High-Level Usability Wrapper for PHPECC","archived":false,"fork":false,"pushed_at":"2024-09-03T23:44:32.000Z","size":65,"stargazers_count":44,"open_issues_count":0,"forks_count":1,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-02-23T23:11:20.700Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paragonie.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-11T20:53:38.000Z","updated_at":"2024-10-25T09:42:55.000Z","dependencies_parsed_at":"2024-04-28T09:39:29.324Z","dependency_job_id":"4db765ce-e690-41c7-9197-90b6f36703b6","html_url":"https://github.com/paragonie/easy-ecc","commit_stats":{"total_commits":34,"total_committers":1,"mean_commits":34.0,"dds":0.0,"last_synced_commit":"53d6a1c484e6e61e59e6c78718f5ffaf1be76f72"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paragonie%2Feasy-ecc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paragonie%2Feasy-ecc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paragonie%2Feasy-ecc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paragonie%2Feasy-ecc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paragonie","download_url":"https://codeload.github.com/paragonie/easy-ecc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241587930,"owners_count":19986628,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":"2024-08-04T09:02:54.184Z","updated_at":"2025-03-03T00:09:06.041Z","avatar_url":"https://github.com/paragonie.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"# Easy-ECC\n\n[![Build Status](https://github.com/paragonie/easy-ecc/actions/workflows/ci.yml/badge.svg)](https://github.com/paragonie/easy-ecc/actions)\n[![Latest Stable Version](https://poser.pugx.org/paragonie/easy-ecc/v/stable)](https://packagist.org/packages/paragonie/easy-ecc)\n[![Latest Unstable Version](https://poser.pugx.org/paragonie/easy-ecc/v/unstable)](https://packagist.org/packages/paragonie/easy-ecc)\n[![License](https://poser.pugx.org/paragonie/easy-ecc/license)](https://packagist.org/packages/paragonie/easy-ecc)\n[![Downloads](https://img.shields.io/packagist/dt/paragonie/easy-ecc.svg)](https://packagist.org/packages/paragonie/easy-ecc)\n\nA usability wrapper for [PHP ECC](https://github.com/paragonie/phpecc)\nthat also further hardens against timing attacks.\n\n## Installing\n\n```\ncomposer require paragonie/easy-ecc\n```\n\n## Using Easy-ECC\n\n```php\n\u003c?php\nuse ParagonIE\\EasyECC\\EasyECC;\n\n// Generate an instance; defaults to Curve25519\n$ecc = new EasyECC();\n\n// Get a keypair\n$alice_sk = $ecc-\u003egeneratePrivateKey();\n$alice_pk = $alice_sk-\u003egetPublicKey();\n\n// Signing a message (with PEM-formatted signatures):\n$message = 'This is extremely simple to use correctly.';\n$signature = $ecc-\u003esign($message, $alice_sk);\n\nif (!$ecc-\u003everify($message, $alice_pk, $signature)) {\n    throw new Exception('Signature validation failed');\n}\n\n// Let's do a key exchange:\n$bob_sk = $ecc-\u003egeneratePrivateKey();\n$bob_pk = $alice_sk-\u003egetPublicKey();\n\n$alice_to_bob = $ecc-\u003ekeyExchange($alice_sk, $bob_pk, true);\n$bob_to_alice = $ecc-\u003ekeyExchange($bob_sk, $alice_pk, false);\n```\n\n### Other Easy-ECC Modes\n\n#### secp256k1 + SHA256\n\n```php\n\u003c?php\nuse ParagonIE\\EasyECC\\EasyECC;\n\n$ecc = new EasyECC('K256');\n```\n\n#### NIST P256 + SHA256\n\n```php\n\u003c?php\nuse ParagonIE\\EasyECC\\EasyECC;\n\n$ecc = new EasyECC('P256');\n```\n\n#### NIST P384 + SHA384\n\n```php\n\u003c?php\nuse ParagonIE\\EasyECC\\EasyECC;\n\n$ecc = new EasyECC('P384');\n```\n\n#### NIST P521 + SHA512\n\n```php\n\u003c?php\nuse ParagonIE\\EasyECC\\EasyECC;\n\n$ecc = new EasyECC('P521');\n```\n\n### ECDSA-Specific Features\n\n```php\n\u003c?php\nuse ParagonIE\\EasyECC\\EasyECC;\nuse ParagonIE\\EasyECC\\ECDSA\\{PublicKey, SecretKey};\n\n// Generate an instance\n$ecc = new EasyECC('P256');\n\n// Get a keypair\n/** @var SecretKey $alice_sk */\n$alice_sk = $ecc-\u003egeneratePrivateKey();\n/** @var PublicKey $alice_pk */\n$alice_pk = $alice_sk-\u003egetPublicKey();\n\n// Serialize as PEM (for OpenSSL compatibility):\n$alice_sk_pem = $alice_sk-\u003eexportPem();\n$alice_pk_pem = $alice_pk-\u003eexportPem();\n\n// Serialize public key as compressed point (for brevity):\n$alice_pk_cpt = $alice_pk-\u003etoString();\n\n$message = 'This is extremely simple to use correctly.';\n// Signing a message (with IEEE-P1363-formatted signatures):\n$signature = $ecc-\u003esign($message, $alice_sk, true);\nif (!$ecc-\u003everify($message, $alice_pk, $signature, true)) {\n    throw new Exception('Signature validation failed');\n}\n\n// Let's do a key exchange:\n$bob_sk = $ecc-\u003egeneratePrivateKey();\n$bob_pk = $alice_sk-\u003egetPublicKey();\n\n$alice_to_bob = $ecc-\u003ekeyExchange($alice_sk, $bob_pk, true);\n$bob_to_alice = $ecc-\u003ekeyExchange($bob_sk, $alice_pk, false);\n```\n\n### Asymmetric Encryption\n\nWe provide an interface that you can implement for the underlying symmetric\ncryptography to suit your needs. This library provides a built-in integration\nfor [Defuse's PHP encryption library](https://github.com/defuse/php-encryption).\n\n```php\n\u003c?php\nuse ParagonIE\\EasyECC\\EasyECC;\nuse ParagonIE\\EasyECC\\Integration\\Defuse;\nuse Mdanter\\Ecc\\Crypto\\Key\\{\n    PublicKeyInterface,\n    PrivateKeyInterface\n};\n\n/**\n * @var EasyECC $ecc\n * @var PrivateKeyInterface $secretKey\n * @var PublicKeyInterface $publicKey\n */\n\n// Let's load the integration (inject your EasyECC instance):\n$defuse = new Defuse($ecc);\n\n// You can seal/unseal messages (anonymous public-key encryption):\n$superSecret = 'This is a secret message';\n$sealed = $defuse-\u003eseal($superSecret, $publicKey);\n$opened = $defuse-\u003eunseal($sealed, $secretKey);\n\n// Or you can encrypt between two keypairs:\n$otherSecret = $ecc-\u003egeneratePrivateKey();\n$otherPublic = $otherSecret-\u003egetPublicKey();\n$encrypted = $defuse-\u003easymmetricEncrypt($superSecret, $secretKey, $otherPublic);\n$decrypted = $defuse-\u003easymmetricDecrypt($encrypted, $otherSecret, $publicKey);\n```\n\n## Support Contracts\n\nIf your company uses this library in their products or services, you may be\ninterested in [purchasing a support contract from Paragon Initiative Enterprises](https://paragonie.com/enterprise).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparagonie%2Feasy-ecc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparagonie%2Feasy-ecc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparagonie%2Feasy-ecc/lists"}