{
  "slug": "cryptographic-nonce",
  "term": "Cryptographic nonce",
  "aliases": [
    "Nonce"
  ],
  "definition": "A cryptographic nonce is an input value whose required uniqueness scope is specified by the cryptographic construction that uses it.",
  "note": "For RFC 5116's AES-GCM profiles, encryption must not reuse a nonce under one key; repeated decryption is different. Those profiles fix the nonce at 12 octets. Section 3.2 recommends support for a 4-octet counter, giving 2^32 values per fixed field; distinct encryptors sharing a key need distinct fixed fields. [rfc5116]\n\nVM rollback can cause reuse by restoring earlier encryption state. [rfc5116] SP 800-38D likewise caps a key at 2^32 encryptions unless only deterministic 96-bit IVs are used. [sp800-38d] XTS sector-number tweaks have a different contract and must not be treated as GCM nonces; the plain64 generator uses the sector as a 64-bit value, and the cited disk-encryption design recommends at least 128 bits for its stored random IV. [broz2018]",
  "status": "shipping",
  "advantages": [
    {
      "text": "A counter-based nonce needs only a per-key sequence, not a random source, and the counter may skip values without breaking uniqueness.",
      "citationIds": [
        "rfc5116"
      ]
    }
  ],
  "limitations": [
    {
      "text": "A nonce is not itself a freshness policy that rejects old, valid ciphertext.",
      "citationIds": [
        "rfc5116"
      ]
    },
    {
      "text": "For CBC and CFB, an IV need not be secret but must be unpredictable before it is generated for the plaintext; later storage beside ciphertext is not itself a violation.",
      "citationIds": [
        "sp800-38a"
      ]
    }
  ],
  "related": [
    "authenticated-encryption",
    "xts-aes",
    "snapshot",
    "replay-attack",
    "zfs-raw-send",
    "aes-gcm-siv"
  ],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "citations": [
    {
      "id": "rfc5116",
      "title": "RFC 5116: nonce requirements, GCM reuse and VM rollback, sections 2.1, 3.1, 5.1.1 and 8",
      "url": "https://www.rfc-editor.org/rfc/rfc5116.html",
      "accessed": "2026-10-23"
    },
    {
      "id": "broz2018",
      "title": "Broz, Patocka and Matyas: Practical cryptographic data integrity protection with full disk encryption, 2018, sections 2.4 and 3.3",
      "url": "https://arxiv.org/pdf/1807.00309v1",
      "accessed": "2026-10-23"
    },
    {
      "id": "hesela-encryption",
      "title": "Hesela: Nonce reuse is not ciphertext replay",
      "url": "https://hesela.com/analyses/checksums-identity-and-lost-writes/#nonce-reuse",
      "accessed": "2026-10-15"
    },
    {
      "id": "sp800-38d",
      "title": "NIST SP 800-38D: GCM and GMAC, IV lengths and section 8.3 invocation limit",
      "url": "https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf",
      "accessed": "2026-10-23"
    },
    {
      "id": "sp800-38a",
      "title": "NIST SP 800-38A: CBC/CFB IV requirements and Appendix C on generation",
      "url": "https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38a.pdf",
      "accessed": "2026-11-21"
    }
  ],
  "updated": "2026-11-21",
  "provenance": [
    "rfc5116 is RFC 5116, re-read for the 12-octet nonce length, section 3.2 nonce formation and the VM rollback warning in section 8.",
    "broz2018 is the 2018 arXiv paper on authenticated full-disk encryption, re-read for the plain64 generator, the GCM reuse warning and the 128-bit random-IV guidance.",
    "sp800-38d is NIST SP 800-38D, read for the 96-bit IV recommendation and the section 8.3 invocation limit.",
    "The dm-integrity entry links here because its per-sector metadata can hold the random IVs whose size and reuse rules are described here.",
    "The IV secrecy statement and four-octet counter scope were corrected against SP 800-38A Appendix C and RFC 5116 section 3.2 on 2026-11-21.",
    "The general IV correction does not endorse the paper's random-IV generator for CBC; that paper restricts the generator's supported modes. [broz2018]"
  ]
}
