OCSP_REQUEST_NEW(3ossl)
β¨ NAME β¨
okay so this is the OCSP_REQUEST_NEW(3ossl) page from the OpenSSL manual (section 3ossl, bestie, we love a section 3) and it's all about the OCSP request functions, which are:
OCSP_REQUEST_new, OCSP_REQUEST_free, OCSP_request_add0_id, OCSP_request_sign, OCSP_request_add1_cert, OCSP_request_onereq_count, OCSP_request_onereq_get0 β OCSP request functions π
πΈ SYNOPSIS πΈ
#include <openssl/ocsp.h>
OCSP_REQUEST *OCSP_REQUEST_new(void);
void OCSP_REQUEST_free(OCSP_REQUEST *req);
OCSP_ONEREQ *OCSP_request_add0_id(OCSP_REQUEST *req, OCSP_CERTID *cid);
int OCSP_request_sign(OCSP_REQUEST *req,
X509 *signer, EVP_PKEY *key, const EVP_MD *dgst,
STACK_OF(X509) *certs, unsigned long flags);
int OCSP_request_add1_cert(OCSP_REQUEST *req, X509 *cert);
int OCSP_request_onereq_count(OCSP_REQUEST *req);
OCSP_ONEREQ *OCSP_request_onereq_get0(OCSP_REQUEST *req, int i);
π¦ DESCRIPTION π¦
okay so picture this: you're building an OCSP request, right? these are the little functions that make it happen. let's go one by one, no skipping, periodt. β¨
OCSP_REQUEST_new()β allocates and hands you back a brand new, totally emptyOCSP_REQUESTstructure. a blank canvas, main character energy. πOCSP_REQUEST_free()β frees up the request structurereq. and if the argument isNULL? nothing happens. she just shrugs and moves on. πOCSP_request_add0_id()β adds the certificate IDcidtoreq. it returns theOCSP_ONEREQstructure that got added, so your application can tack on extra extensions to the request if it wants to. > β οΈ BIG ONE: theidparameter MUST NOT be freed up after the operation. like, do not. the structure owns it now, okay? π«ΆOCSP_request_sign()β signs the OCSP requestrequsing the certificatesigner, the private keykey, the digestdgst, and additional certificatescerts. and if the flags optionOCSP_NOCERTSis set, then no certificates will be included in the request. simple as that. π₯OCSP_request_add1_cert()β adds certificatecertto requestreq. and heads up, bestie: the application is responsible for freeing upcertafter use. that's on you, not on her. πOCSP_request_onereq_count()β returns the total number ofOCSP_ONEREQstructures inreq. it's giving census. πOCSP_request_onereq_get0()β returns an internal pointer to theOCSP_ONEREQcontained inreqat indexi. and the index valueiruns from0toOCSP_request_onereq_count(req) - 1. zero-indexed, as all good things are. β
π RETURN VALUES π
okay so here's what you get back from each one:
OCSP_REQUEST_new()β returns an emptyOCSP_REQUESTstructure, orNULLif an error occurred. πOCSP_request_add0_id()β returns theOCSP_ONEREQstructure containingcid, orNULLif an error occurred.OCSP_request_sign()andOCSP_request_add1_cert()β return1for success and0for failure. classic. πOCSP_request_onereq_count()β returns the total number ofOCSP_ONEREQstructures inreq, and-1on error.OCSP_request_onereq_get0()β returns a pointer to anOCSP_ONEREQstructure, orNULLif the index value is out or range.
π NOTES π
an OCSP request structure contains one or more OCSP_ONEREQ structures, corresponding to each certificate. so like, one per cert. cute. π§
and OCSP_request_onereq_count() plus OCSP_request_onereq_get0() are mainly used by OCSP responders. iykyk. π
π EXAMPLES π
okay so here's how you create an OCSP_REQUEST structure for certificate cert with issuer issuer β watch and learn:
OCSP_REQUEST *req;
OCSP_ID *cid;
req = OCSP_REQUEST_new();
if (req == NULL)
/* error */
cid = OCSP_cert_to_id(EVP_sha1(), cert, issuer);
if (cid == NULL)
/* error */
if (OCSP_REQUEST_add0_id(req, cid) == NULL)
/* error */
/* Do something with req, e.g. query responder */
OCSP_REQUEST_free(req);
ate that, honestly. π
π SEE ALSO π
crypto(7), OCSP_cert_to_id(3), OCSP_request_add1_nonce(3), OCSP_resp_find_status(3), OCSP_response_status(3), OCSP_sendreq_new(3)
π COPYRIGHT π
Copyright 2015-2024 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
and that's the whole page, bestie!! π«Ά this was OpenSSL 3.5.9, dated 2026-09-29, and it's OCSP_REQUEST_NEW(3ossl) β go forth and build your requests, you absolute icon. πβ¨π
π¦ where this page comes from
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms