benycode / key-signatory
There is no license information available for the latest version (v1.0.1) of this package.
Validate and sign content with a private and public key
v1.0.1
2023-02-05 19:08 UTC
Requires
- php: ^8.0
This package is not auto-updated.
Last update: 2024-11-11 19:15:21 UTC
README
Validate and sign content with a RSA private and public key
Table of contents
Install
Via Composer
$ composer require benycode/key-signatory
Requires PHP8+.
Usage
Sign a content with a private key
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);
Validate a content with a public key
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);