OCSP Nonce Lengths

In the OCSP (Online Certificate Status Protocol), the nonce is an optional field used to prevent replay attacks by ensuring that the OCSP response corresponds to the specific OCSP request. The nonce is a randomly generated value included in the OCSP request and echoed back in the response by the OCSP server.

Nonce Length in OCSP

There is no strict standard for nonce length in the OCSP specification (RFC 6960). The nonce length can technically vary, but in practice, different OCSP servers and clients may have limitations or compatibility issues with certain nonce lengths. Here are the main considerations:

  1. Typical Nonce Length:
    • Most implementations use a nonce between 16 and 32 bytes (128-256 bits), which is usually sufficient to provide randomness and prevent replay attacks.
    • A 20-byte (160-bit) nonce is commonly used as a balance between security and compatibility.
  2. OCSP Server Limitations on Nonce Length:
    • No universal length: Not all OCSP servers support arbitrary nonce lengths, as some servers impose maximum length limits or may not support nonces at all.
    • Server-Specific Constraints: Some OCSP servers may reject requests with excessively long nonces (e.g., longer than 32 bytes) or ignore the nonce field if it is not within a typical length (such as 16-32 bytes). Each server’s configuration and implementation can affect nonce support.
    • Compatibility Issues: Due to these variations, using a nonce length within the commonly supported range (16-32 bytes) maximizes compatibility across different OCSP servers.
  3. Servers that Ignore Nonces:
    • Some OCSP servers may not implement nonce support or may ignore the nonce altogether, even if it is present in the request. This can vary by the server’s configuration, and some servers may choose to disregard nonces for efficiency reasons or due to resource constraints.

Best Practice for Nonce Usage

To ensure the broadest compatibility:

  • Use a nonce length of 16-32 bytes.
  • Be prepared for some OCSP responses to ignore the nonce, depending on the server’s configuration.
Tags :