PHP code example of benycode / key-signatory
1. Go to this page and download the library: Download benycode/key-signatory 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/ */
benycode / key-signatory example snippets
use BenyCode\KeySignatory\Signer;
$content = 'a content to be signed';
$privateKey = '-----BEGIN RSA PRIVATE KEY-----<<....>>-----END RSA PRIVATE KEY-----';
$passphrase = '';
$signature = Signer::signWithPrivateKey($content, $privateKey, $passphrase);
use BenyCode\KeySignatory\Validator;
$content = 'a content to be verified';
$publicKey = '-----BEGIN RSA PUBLIC KEY-----<<....>>-----END RSA PUBLIC KEY-----';
$signature = '';
$signature = Validator::validateWithPublicKey($content, $signature, $publicKey);