Download the PHP package frbit/message-signer without Composer
On this page you can find all versions of the php package frbit/message-signer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package message-signer
Update
This project is abandoned. This repository is still here for documentation purpose.
Message Signer
A flexible message signing and verification framework.
So what do you do with it? For example: Write a HTTP REST API server. Sign your client requests with a private key. Verify the request with a public key on your API server.
Installing via Composer
Features
- OpenSSL, phpseclib or HMAC as crypto providers.
- Symfony HttpFoundation (including Laravel requests, by inheritance) and Guzzle (both: 3 and 4) request objects as message sources
- Very flexible interface
- Guzzle3 and Guzzle4 plugin included (might be outsourced someday..)
- Easily expandable
Signature transport formats
There are three essential information required to verify the validity of a message:
- Key: To identify the client (the one sending the signed message) and to select the correct key to verify the signature.
- Date: It's not really necessary. It allows the server (the one receiving and validating the message) to accept only "recent" messages - otherwise attackers could at least re-send intercepted messages easily.
- Signature: Well, to proof the validity of the message.
Those signature information can be transported in various formats. There are three formats built-in and additional/custom formats can be easily added.
The formats are implemented in the \Frbit\MessageSigner\Message\Handler\*
classes.
Multiple header
Default format.
Here, each information is stored in a dedicated message header (eg HTTP request header).
Of course, the names of the headers are arbitrary - as long as client and server know both about them.
Single Header
In this format, all information are stored (embedded) in a single, URL encoded header.
Again: the name of the header is arbitrary...
Parameter
In some scenarios it makes sense to store the information in message parameters (eg HTTP request query string).
As before: parameter names (sign
, date
, key
) are arbitrary.
Examples
Have a look in the examples/
folder for additional code examples.
Send a signed request with guzzle
This would send a request like:
Sign a Symfony HttpFoundation request
Would print