OCSP_RESPONSE_STATUS(3ossl)
π OCSP_RESPONSE_STATUS π
okay bestie, pull up a chair because we're doing OCSP_RESPONSE_STATUS(3ossl) β that's the OpenSSL manual page for alllll the OCSP response functions. yes it's a lot of functions. no you're not gonna be scared of them. let's go π¦
β¨ NAME β¨
so like, this one page covers a whole squad of functions:
OCSP_response_status, OCSP_response_get1_basic, OCSP_response_create, OCSP_RESPONSE_free, OCSP_RESPID_set_by_name, OCSP_RESPID_set_by_key_ex, OCSP_RESPID_set_by_key, OCSP_RESPID_match_ex, OCSP_RESPID_match, OCSP_basic_sign, OCSP_basic_sign_ctx β the OCSP response functions. periodt. π
πΈ SYNOPSIS πΈ
first you gotta let the compiler know what's up:
#include <openssl/ocsp.h>
then, the lineup bestie, verbatim, no cap:
int OCSP_response_status(OCSP_RESPONSE *resp);
OCSP_BASICRESP *OCSP_response_get1_basic(OCSP_RESPONSE *resp);
OCSP_RESPONSE *OCSP_response_create(int status, OCSP_BASICRESP *bs);
void OCSP_RESPONSE_free(OCSP_RESPONSE *resp);
int OCSP_RESPID_set_by_name(OCSP_RESPID *respid, X509 *cert);
int OCSP_RESPID_set_by_key_ex(OCSP_RESPID *respid, X509 *cert,
OSSL_LIB_CTX *libctx, const char *propq);
int OCSP_RESPID_set_by_key(OCSP_RESPID *respid, X509 *cert);
int OCSP_RESPID_match_ex(OCSP_RESPID *respid, X509 *cert, OSSL_LIB_CTX *libctx,
const char *propq);
int OCSP_RESPID_match(OCSP_RESPID *respid, X509 *cert);
int OCSP_basic_sign(OCSP_BASICRESP *brsp, X509 *signer, EVP_PKEY *key,
const EVP_MD *dgst, STACK_OF(X509) *certs,
unsigned long flags);
int OCSP_basic_sign_ctx(OCSP_BASICRESP *brsp, X509 *signer, EVP_MD_CTX *ctx,
STACK_OF(X509) *certs, unsigned long flags);
π DESCRIPTION π
the response ones π
OCSP_response_status() hands you the OCSP response status of resp. it comes back as one of these besties: OCSP_RESPONSE_STATUS_SUCCESSFUL, OCSP_RESPONSE_STATUS_MALFORMEDREQUEST, OCSP_RESPONSE_STATUS_INTERNALERROR, OCSP_RESPONSE_STATUS_TRYLATER OCSP_RESPONSE_STATUS_SIGREQUIRED, or OCSP_RESPONSE_STATUS_UNAUTHORIZED.
OCSP_response_get1_basic() decodes resp and gives you back the OCSP_BASICRESP structure chilling inside it. it's giving "unboxing" energy π¦
OCSP_response_create() makes you a shiny new OCSP_RESPONSE structure for status, and if you want, it'll optionally include the basic response bs too.
OCSP_RESPONSE_free() frees up the OCSP response resp. and if the argument is NULL? literally nothing happens, it just vibes. no harm done π«Ά
the respid ones π
OCSP_RESPID_set_by_name() sets the name of the OCSP_RESPID to be the exact same as the subject name in the X509 certificate cert you hand it β for the OCSP responder, obvi.
OCSP_RESPID_set_by_key_ex() sets the key of the OCSP_RESPID to match the key in the supplied X509 certificate cert for the OCSP responder. important: the key is stored as a SHA1 hash. to calculate that hash, the SHA1 algorithm gets fetched using the library ctx libctx and the property query string propq (go peek at "ALGORITHM FETCHING" in crypto(7) if you want the whole lore).
OCSP_RESPID_set_by_key() does the exact same thing as OCSP_RESPID_set_by_key_ex(), except it uses the default library context with an empty property query string. the no-frills version, iykyk.
π¨ bestie heads up: anOCSP_RESPIDcan only have one of the name or the key set. so callingOCSP_RESPID_set_by_name()orOCSP_RESPID_set_by_key()will clear any existing setting. it's giving "new phone who dis" β the old one is gone.
OCSP_RESPID_match_ex() tests whether the OCSP_RESPID in respid matches the X509 certificate cert, based on the SHA1 hash. to calculate that hash, the SHA1 algorithm is fetched using the library ctx libctx and the property query string propq (again, "ALGORITHM FETCHING" in crypto(7) has the details).
OCSP_RESPID_match() does the same as OCSP_RESPID_match_ex(), except it uses the default library context with an empty property query string. twin, but lowkey simpler π«
the signing ones π₯
OCSP_basic_sign() signs the OCSP response brsp using certificate signer, private key key, digest dgst, and additional certificates certs. now listen: if the flags option OCSP_NOCERTS is set, then no certificates will be included in the response. and if the flags option OCSP_RESPID_KEY is set, then the responder gets identified by key ID rather than by name. slay, but know which one you want.
OCSP_basic_sign_ctx() also signs the OCSP response brsp, but it uses the parameters contained in the digest context ctx instead. main character energy, different tool π
β RETURN VALUES β
OCSP_RESPONSE_status()returns a status value.OCSP_response_get1_basic()returns anOCSP_BASICRESPstructure pointer, orNULLif an error occurred. πOCSP_response_create()returns anOCSP_RESPONSEstructure pointer, orNULLif an error occurred. πOCSP_RESPONSE_free()does not return a value. it just does its thing and dips.OCSP_RESPID_set_by_name(),OCSP_RESPID_set_by_key(),OCSP_basic_sign(), andOCSP_basic_sign_ctx()return1on success or0on failure.OCSP_RESPID_match()returns1if theOCSP_RESPIDand theX509certificate match, or0otherwise.
π NOTES π
OCSP_response_get1_basic() is only called if the status of a response is OCSP_RESPONSE_STATUS_SUCCESSFUL. so like⦠vibe check the status first, bestie, or you're gonna have a bad time.
π SEE ALSO π
go read these next, they're all part of the lore:
crypto(7) OCSP_cert_to_id(3) OCSP_request_add1_nonce(3) OCSP_REQUEST_new(3) OCSP_resp_find_status(3) OCSP_sendreq_new(3) OCSP_RESPID_new(3) OCSP_RESPID_free(3)
π°οΈ HISTORY π°οΈ
the origin story, fr fr:
- The
OCSP_RESPID_set_by_name(),OCSP_RESPID_set_by_key()andOCSP_RESPID_match()functions were added in OpenSSL 1.1.0a. - The
OCSP_basic_sign_ctx()function was added in OpenSSL 1.1.1.
π 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 OCSP_RESPONSE_STATUS(3ossl) from OpenSSL 3.5.9, dated 2026-09-29. go forth and sign those responses, 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