Recommend this page to a friend! |
Classes of Scott Arciszewski | PHP PASeTo | README.md | Download |
|
DownloadPASETO: Platform-Agnostic Security TokensPaseto is everything you love about JOSE (JWT, JWE, JWS) without any of the many design deficits that plague the JOSE standards. What follows is a reference implementation. Requires PHP 7 or newer. What is Paseto?Paseto (Platform-Agnostic SEcurity TOkens) is a specification and reference implementation for secure stateless tokens. Key Differences between Paseto and JWTUnlike JSON Web Tokens (JWT), which gives developers more than enough rope with which to hang themselves, Paseto only allows secure operations. JWT gives you "algorithm agility", Paseto gives you "versioned protocols". It's incredibly unlikely that you'll be able to use Paseto in an insecure way. > Caution: Neither JWT nor Paseto were designed for > stateless session management. > Paseto is suitable for tamper-proof cookies, but cannot prevent replay attacks > by itself. PasetoPaseto Example 1
This decodes to:
Paseto Example 2
This decodes to:
To learn what each version means, please see this page in the documentation. JWTAn example JWT (taken from JWT.io) might look like this:
This decodes to: Header:
Body:
Signature:
MotivationAs you can see, with JWT, you get to specify an There have been ways to exploit JWT libraries by replacing RS256 with HS256 and using the known public key as the HMAC-SHA256 key, thereby allowing arbitrary token forgery. With Paseto, your options are
Paseto only allows you to use authenticated modes. Regardless of the purpose selected, the header (and an optional footer, which is always cleartext but base64url-encoded) is included in the signature or authentication tag. How to Use this LibrarySee the documentation. The section dedicated to this PHP implementation may be more relevant. Other ImplementationsThe curation of other implementations has been moved to paseto.io. See https://github.com/paragonie/paseto-io for the website source code. Support ContractsIf your company uses this library in their products or services, you may be interested in purchasing a support contract from Paragon Initiative Enterprises. |