Download the PHP package sagifire/phpecc without Composer
On this page you can find all versions of the php package sagifire/phpecc. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sagifire/phpecc
More information about sagifire/phpecc
Files in sagifire/phpecc
Package phpecc
Short Description PHP Elliptic Curve Cryptography library
License MIT
Homepage https://github.com/mdanter/phpecc
Informations about the package phpecc
Pure PHP Elliptic Curve DSA and DH
Information
This library is a rewrite/update of Matyas Danter's ECC library. All credit goes to him.
For more information on Elliptic Curve Cryptography please read this fine article.
License
This package is released under the MIT license.
Requirements
- PHP 5.4+
- composer
- ext-gmp
- ext-mcrypt
Installation
You can install this library via Composer :
composer require mdanter/ecc
Contribute
When sending in pull requests, please make sure to run the make
command.
The default target runs all PHPUnit and PHPCS tests. All tests must validate for your contribution to be accepted.
It's also always a good idea to check the results of the Scrutinizer analysis for your pull requests.
Usage
WARNING Though this library is tested for compliance to standards, it is subject to at least one documented vulnerability in public-key derivation, which can potentially allow attackers to grab your private keys. USE AT YOUR OWN RISK. You've been warned.
WARNING All following documentation is based off the master branch, not the tagged versions.
Key generation
The lazy way
You're in luck, there's a command line tool ! The examples assume that phpecc (found in the bin/ folder) is on your path.
Generate a private/public keypair:
Alternately, you can pipe the output to file:
The generated keys should be compatible with OpenSSL. However, if you find cases where OpenSSL cannot parse a key generated using phpecc
, please submit an issue with the parameters used to generate your key.
Note: you don't actually need the public key part from the output, it's also encoded in the private key segment.
To get the list of supported curves :
The developer way
TODO...
Asymmetric encryption
The dead simple example:
A lesser dead simple example
A more realistic example, assumes you are Alice, and that your private key is stored (unencrypted) in PEM format on file. You will of course also need Bob's public key in PEM format on file. This example clearly shows that this library can be improved...
You want to encrypt a message for Bob --and only Bob-- to read.
Alice encodes the data
Now you can email/snail mail/whatever the encrypted message to Bob, and he will be able to decrypt your secret data (assuming he already has your public key, and his private key...)
Bob decodes the encrypted data
All versions of phpecc with dependencies
ext-gmp Version *
ext-mcrypt Version *
fgrosse/phpasn1 Version ~1.3.1
symfony/console Version ~2.6