arsgeografica/signing

PHP object signing modeled after django.core.signing

This package's canonical repository appears to be gone and the package has been frozen as a result.

1.1.2 2013-12-10 12:53 UTC

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.

Build Status - master branch

Build Status - development branch