liveBook · Manning

Nonce

As explained in Software Security for Developers

A nonce is a value intended to be used only once within a specified cryptographic or authentication context.

A nonce is a unique, random value intended for one use within a cryptographic or authentication context. It makes a request or encryption operation distinguishable and helps prevent replay. section 13.3.3 section 5.2.1

OIDC authentication

A client sends a nonce with an OIDC authentication request. When the ID token returns, it must contain the same nonce; a mismatch causes rejection and blocks reused authentication data. section 13.3.3

Keep these nearby distinctions in mind:

  • Nonce limits replay by making authentication data valid only once; state instead links an authentication request to the client session and helps prevent CSRF. section 13.3.3
  • In AES-CBC, the IV acts as a nonce: use a different IV for every encryption operation with the same key. section 5.2.1
Figure 13.8 Using a nonce with a properly signed transaction prevents hackers from replaying or modifying the request, ensuring the transaction is secure and unique.
figure

Visualizes how a nonce supports a unique, properly protected transaction and blocks replay or modification. section 13.3.3

How Software Security for Developers covers it

How deep it goes
Defines nonce use, explains request-to-token matching and IV reuse risks, but defers the mathematics of encryption-mode consequences.
Examples
Uses OIDC authentication responses, intercepted payment requests, and AES-CBC encryption of multiple files.
What it assumes
Assumes basic authentication and encryption contexts while defining nonce terminology and its practical security purpose.
What you can do after
Apply it via OIDC validation and AES-CBC IV management to reject reused authentication data and avoid key-IV reuse.
How it connects
Connects nonces with OpenID Connect, ID tokens, replay attacks, CSRF, initialization vectors, and AES-CBC.

Also explained in

Compare how 4 books explain nonce →

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.