PHP code example of randrei98 / ecdsaphp
1. Go to this page and download the library: Download randrei98/ecdsaphp library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
randrei98 / ecdsaphp example snippets
use \ECDSA\Key;
use \ECDSA\Curves;
use \ECDSA\Algorithms;
use \ECDSA\ECDSA;
$pem = 'EC PRIVATE KEY PEM FORMAT';
$curve = Curves::NIST256p();
$algorithm = Algorithms::ES256();
$key = new Key($pem, '', $curve, $algorithm);
$message = 'HELLO';
$Signature = ECDSA::Sign($message, $key);
$verif = ECDSA::Verify($message, $Signature, $key);
var_dump($verif);