This is a follow-up to our 2017 blog post that [made the case for avoiding JSON Web Tokens (JWT) and its related standards](https://paragonie.com/blog/2017/03/jwt-json-web-tokens-is-bad-standard-that-everyone-should-avoid). Many developers responded to our post with the same question: "What should we use instead of JWT?" Today, I'm happy to announce a viable replacement. # Introducing PASETO: Platform-Agnostic SEcurity TOkens The JOSE standards (which JWT is a subset) give developers enough rope to hang themselves: Do you encrypt? Do you sign? Which algorithms do you support? Is `none` a valid authentication algorithm? Why not let the token specify which algorithm to use to validate tokens? As time went on and more vulnerabilities were discovered in the JOSE standards, the companies and enthusiasts that maintained the JWT libraries in various languages did work around these vulnerabilities, to their credit. However, this is at best a brittle solution. Consider the case of RNCryptor: The PHP implementation uses authenticated encryption and resists timing attacks, but the [Haskell implementation just outright skips HMAC validation](https://github.com/RNCryptor/rncryptor-hs/issues/2). The most effective way to solve security problems at an ecosystem level is to design less error-prone standards. Libraries that implement safer standards will not need to play catch-up with what the mainline implementations are doing. That is why we made **Paseto**, which exposes JWT-like validation claims without any of the runtime protocol negotiation and cryptography protocol joinery that caused so many critical JWT security failures. ### JWT's Knobs and Levers * Are you signing or encrypting? Both? Neither? * What algorithm is being used for signing? * Public-key and shared-key algorithms easily confused here. * Able to choose dangerous options like [RSA with PKCS1v1.5 padding](https://robotattack.org). * What algorithm is being used for message encryption? * What algorithm is being used for *key* encryption? * As for the real-world use cases for including the encryption key with the ciphertext, encrypted or not, your guess is as good as mine. This might make more sense if key encryption algorithms only included public-key cryptography, but of course, AES-GCM is explicitly allowed by the standard. ### Paseto's Options * What version? * `v1` gives you [RSASSA-PSS and AES-CTR+HMAC-SHA2](https://github.com/paragonie/paseto/tree/master/docs/01-Protocol-Versions#version-1-compatibility-mode) * `v2` gives you [Libsodium](https://github.com/paragonie/paseto/tree/master/docs/01-Protocol-Versions#version-2-recommended) * Is this token local or public? * `local`: shared-key authenticated encryption * `public`: public-key digital signatures That's it. There are no levers to pull, buttons to pull, or knobs to fiddle with. You don't have to worry about [the complexity required to use RSA safely](http://www.daemonology.net/blog/2009-06-11-cryptographic-right-answers.html). You don't have to worry if the [public key for a given message is even on the curve](https://blogs.adobe.com/security/2017/03/critical-vulnerability-uncovered-in-json-encryption.html). Paseto is simple, obviously secure, solves 99% of the use cases for JSON Web Tokens. There is no guesswork; the cryptography aims to be boring. You can port Paseto to another language in hundreds-not-thousands of lines of code (especially if you only aim for `v2` support). > The Paseto documentation, as well as a reference implementation written in PHP, is available [on GitHub](https://github.com/paragonie/paseto). ## The Design and Motivation for Paseto Paseto is to JWT what [Halite](https://github.com/paragonie/halite) was to various mcrypt-based cryptography libraries in the PHP ecosystem. That is to say, we identified a source of insecurity for the Internet and worked to replace it with something that would lead to better security. All of our software is developed with [the same underlying philosophy](https://paragonie.com/blog/2016/02/our-software-development-philosophy): 1. Secure by default 2. Simple and easy-to-use 3. Easy to analyze and reason about (for implementors, auditors, and security researchers) However, we need to emphasize another point that isn't obvious until you have sufficient cryptography engineering experience: **Ciphersuite agility is harmful.** A full discussion on why this is true deserves a blog post of its own, but in a nutshell, it introduces the risk of downgrade attacks (e.g. [DROWN](https://drownattack.com)). A far more robust design is to use **versioned protocols**—for which each version has One True Ciphersuite—with a small backward compatibility window. That is what we did with Paseto, and that's why tokens have a header that includes protocol version information. Should Paseto need a version 3 (e.g. if a practical quantum computer is developed and RSA and ECC are both doomed), we can specify a simply-secure ciphersuite for the new version that uses post-quantum cryptography algorithms. In such a scenario, `local` tokens can be decrypted and re-encrypted transparently (although quantum computers don't threaten AES-256), and `public` tokens older than `v3` can simply be rejected. No downgrade attacks. No weird configurations. No `"alg":"none"` gotchas to watch out for. # The Next Steps I tagged, signed, and released `v0.5.0` of the Paseto specification and reference implementation this morning. The specification has not changed since version 0.4, and is unlikely to change again. In the coming weeks, I intend to write a draft RFC and submit it to the IETF as a secure-by-default replacement for the JOSE standards. There is talk among some security experts of launching a Web Token Competition for an "official" JOSE replacement, in the spirit of the [Password Hashing Competition](https://www.password-hashing.net) that gave us Argon2. Should such a competition surface in the near future, Paseto will be my entry in the contest. However, minor documentation and political concerns aside, Paseto should be considered stable enough to be used in production systems. If you're considering building JWT support into your next software project, consider supporting Paseto instead. It's time to retire error-prone cryptographic standards everywhere. ---