1. Go to this page and download the library: Download i-avatar777/service-ecdsa 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/ */
# Generate new Keys
use iAvatar777\services\EllipticCurve\PrivateKey;
use iAvatar777\services\EllipticCurve\Ecdsa;
$privateKey = new PrivateKey;
$publicKey = $privateKey->publicKey();
$message = "My test message";
# Generate Signature
$signature = Ecdsa::sign($message, $privateKey);
# Verify if signature is valid
echo "\n" . Ecdsa::verify($message, $signature, $publicKey);
use iAvatar777\services\EllipticCurve\Utils\File;
use iAvatar777\services\EllipticCurve\PublicKey;
use iAvatar777\services\EllipticCurve\Signature;
use iAvatar777\services\EllipticCurve\Ecdsa;
$publicKeyPem = File::read("publicKey.pem");
$signatureDer = File::read("signatureDer.txt");
$message = File::read("message.txt");
$publicKey = PublicKey::fromPem($publicKeyPem);
$signature = Signature::fromDer($signatureDer);
echo "\n" . Ecdsa::verify($message, $signature, $publicKey);
use iAvatar777\services\EllipticCurve\Utils\File;
use iAvatar777\services\EllipticCurve\Signature;
$signatureDer = File::read("signatureDer.txt");
$signature = Signature::fromDer($signatureDer);
echo "\n" . $signature->toBase64();
sh
php tests/test.php
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.