OCSP_REQUEST_ADD1_NONCE(3)
π NAME π
okay so this is OCSP_REQUEST_ADD1_NONCE(3), from the Library Functions Manual, and it's all about the OCSP nonce functions: OCSP_request_add1_nonce, OCSP_basic_add1_nonce, OCSP_check_nonce, and OCSP_copy_nonce. bestie, we're in libcrypto land and these are the little guys that handle nonce vibes for OCSP requests and responses β¨
π¦ SYNOPSIS π¦
library βlibcryptoβ #include <openssl/ocsp.h>
int
OCSP_request_add1_nonce(OCSP_REQUEST *req, unsigned char *val, int len);
int
OCSP_basic_add1_nonce(OCSP_BASICRESP *resp, unsigned char *val,
int len);
int
OCSP_check_nonce(OCSP_REQUEST *req, OCSP_BASICRESP *resp);
int
OCSP_copy_nonce(OCSP_BASICRESP *resp, OCSP_REQUEST *req);
πΈ DESCRIPTION πΈ
so an OCSP nonce is typically added to an OCSP request to thwart replay attacks β the whole slay is checking that the same nonce value appears in the response. no cap, that's the point π
OCSP_request_add1_nonce()adds a nonce of valuevaland lengthlento OCSP requestreq. ifvalisNULL, a random nonce is used. iflenis zero or negative, a default length will be used (currently16bytes). for most purposes the nonce value in a request is set to a random value, so thevalparameter inOCSP_request_add1_nonce()is usuallyNULLπOCSP_basic_add1_nonce()is identical toOCSP_request_add1_nonce()except it adds a nonce to OCSP basic responserespπ¦OCSP_check_nonce()compares the nonce value inreqandrespπOCSP_copy_nonce()copies any nonce value present inreqtorespπ«Ά
some responders may include a nonce in all responses even if one is not supplied. lowkey convenient, highkey notable.
some responders cache OCSP responses and do not sign each response for performance reasons. as a result, they do not support nonces. that's just how it is, bestie π
π RETURN VALUES π
OCSP_request_add1_nonce()andOCSP_basic_add1_nonce()return1for success or0for failure β¨OCSP_copy_nonce()returns1if a nonce was successfully copied,2if no nonce was present inreq, or0if an error occurred π§OCSP_check_nonce()returns positive values for success:1if nonces are present and equal,2if both nonces are absent, or3if a nonce is present in the response only. a zero return value indicates that both nonces are present but mismatch: this should be treated as an error condition. a return value of-1indicates that a nonce is present in the request only: this will happen if the responder doesn't support nonces π¨
π SEE ALSO π
OCSP_cert_to_id(3)OCSP_REQUEST_new(3)OCSP_resp_find_status(3)OCSP_response_status(3)OCSP_sendreq_new(3)
π HISTORY π
these functions first appeared in OpenSSL 0.9.7 and have been available since OpenBSD 3.2. iconic behavior, honestly π
xoxo, your Debian bestie β Debian, June 8, 2025 edition π
π
π¦ where this page comes from
- alpine 3.24: libressl-doc 4.3.1-r0 Β· custom
- arch rolling: libressl 4.4.0-1 Β· ISC AND custom:OpenSSL
- Copyright (c) 2014, 2016 The OpenSSL Project. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms