liveBook · Manning

Jws payload

As explained in Software Security for Developers

A JWS payload is the content carried by a JSON Web Signature, represented as an arbitrary string such as JSON data.

A JWS payload is the content carried by a JSON Web Signature. It can be arbitrary data, including a string or JSON, and remains readable to anyone who can access the JWS. The signature helps detect changes; it does not provide confidentiality. section 11.4.1 section 11.8

Handle a payload with these distinctions:

  • Place it between the JWS header and signature, with the three components separated by dots. section 11.4.1
  • Encode it with Base64 URL encoding before embedding the JWS in an HTTP header or URL parameter. section 11.4.1
  • Verify the complete JWS before trusting the payload, and reject unsafe algorithm choices such as alg:none. section 11.4.2

An order-refund payload

A warehouse application can sign a JSON array such as [{"orderId":"12345","amount":500},{"orderId":"56789","amount":250}]. In the compact JWS, its encoded representation is the middle component. Nimbus creates it with Payload(payloadJson) and verifies the surrounding JWS before accepting it. section 11.4.1 section 11.4.2

Figure 11.3 The logical structure of JWS: a JSON metadata header describing the type of signature used, a payload that can be any type of data format, and a signature used to verify that the header and payload weren’t altered. A JWS payload is always readable by anyone who can access the JWS object.
figure

Use the structure diagram to distinguish readable payload data from the header metadata and signature used for verification. section 11.4.1

How Software Security for Developers covers it

How deep it goes
Defines payload structure, encoding, signing, and verification, but defers digital-signature treatment.
Examples
Uses an order-refund JSON array, a compact JWS string, and Nimbus Java signing and verification examples.
What it assumes
Assumes basic JSON and application-message knowledge while defining JWS structure, encoding, signing, and verification.
What you can do after
Evaluate payload visibility and verify that signed application data has not been tampered with.
How it connects
Connects payloads with JWS headers, signatures, Base64 URL encoding, HMAC, JOSE, JWA, and JWE.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Software Security for Developers. The section links point to the parts of the book it draws on.