Keats / jsonwebtoken

JWT lib in rust
MIT License
1.69k stars 271 forks source link

Support Unencoded Payload Option #149

Closed clehner closed 3 years ago

clehner commented 4 years ago

RFC 7797 - JSON Web Signature (JWS) Unencoded Payload Option

RFC 7797 adds a JWT header option "b64": false which specifies that the payload is not base64url-encoded but is added to the signing input as bytes:

   +-------+-----------------------------------------------------------+
   | "b64" | JWS Signing Input Formula                                 |
   +-------+-----------------------------------------------------------+
   | true  | ASCII(BASE64URL(UTF8(JWS Protected Header)) || '.' ||     |
   |       | BASE64URL(JWS Payload))                                   |
   |       |                                                           |
   | false | ASCII(BASE64URL(UTF8(JWS Protected Header)) || '.') ||    |
   |       | JWS Payload                                               |
   +-------+-----------------------------------------------------------+

This is useful with Detached Content where the JWT is serialized without the payload.