arsgeografica / signing
PHP object signing modeled after django.core.signing
Installs: 10 325
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Requires
- php: >=5.3
- jms/serializer: >=0.13
Requires (Dev)
- phpunit/phpunit: 3.7.*
- symfony/yaml: >=2.1
This package is not auto-updated.
Last update: 2020-01-20 03:32:48 UTC
README
PHP String signing component modeled after django.core.signing.
This component allows you to sign strings and check their signatures later on. Usefull for passing strings around and checking them later.
Usage
Create a signer object:
$signer = new \ArsGeografica\Signing\Signer('MyPrivateKey');
You may pass a separator (single character, defaults to :) and a salt if you wish.
Sign a string:
$signedValue = $signer->sign('Hello World');
This yields the signed string "Hello World:DqBSurOWfmzwg/yb6GRfWfDvV44" (value, separator, signature) which you can check with
$signer->unsign($signedValue);
If value and signature match, then the value is returned, otherwise a ArsGeografica\Signing\BadSignatureException will be thrown.