OCSP_RESPONSE_STATUS(3ossl)
π OCSP_RESPONSE_STATUS(3ossl) β the OpenSSL OCSP response glow-up guide
okay bestie, sit down, grab a strawberry drink π because this is the 3ossl manual page all about OCSP response functions and honestly it's giving "cryptographic paperwork but make it cute." We're talking responses, responder IDs, and signing basic responses. No cap, it's a lot of little functions, but we're gonna get through every single one together. π«Ά
β¨ NAME β¨
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 β these are the OCSP response functions. That's the whole squad. π
π SYNOPSIS π
lowkey the whole cast list, in code form, exactly as written:
#include <openssl/ocsp.h>
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 π¦
okay so here's the tea on every single one of them β
OCSP_response_status() returns the OCSP response status of resp. It gives you back one of these values, and yes, I'm listing all six because we don't skip:
OCSP_RESPONSE_STATUS_SUCCESSFULOCSP_RESPONSE_STATUS_MALFORMEDREQUESTOCSP_RESPONSE_STATUS_INTERNALERROROCSP_RESPONSE_STATUS_TRYLATEROCSP_RESPONSE_STATUS_SIGREQUIREDOCSP_RESPONSE_STATUS_UNAUTHORIZED
OCSP_response_get1_basic() decodes and returns the OCSP_BASICRESP structure that's contained in resp. It's like opening the envelope and pulling out the actual letter π
OCSP_response_create() creates and returns an OCSP_RESPONSE structure for status, and it can optionally include the basic response bs. Build-a-response workshop, literally.
OCSP_RESPONSE_free() frees up the OCSP response resp. And if the argument is NULL, nothing is done β it just minds its business, iconic behaviour honestly.
OCSP_RESPID_set_by_name() sets the name of the OCSP_RESPID to be the same as the subject name in the supplied X509 certificate cert for the OCSP responder. name match, slay.
OCSP_RESPID_set_by_key_ex() sets the key of the OCSP_RESPID to be the same as the key in the supplied X509 certificate cert for the OCSP responder. Important detail: the key is stored as a SHA1 hash. To calculate that hash, the SHA1 algorithm is fetched using the library ctx libctx and the property query string propq β see "ALGORITHM FETCHING" in crypto(7) for further information. iykyk π§
OCSP_RESPID_set_by_key() does the same as OCSP_RESPID_set_by_key_ex() except that the default library context is used with an empty property query string. Same energy, less configuration.
β οΈ okay this part matters, bestie: anOCSP_RESPIDcan only have one of the name, or the key set. CallingOCSP_RESPID_set_by_name()orOCSP_RESPID_set_by_key()will clear any existing setting. So it's not "add", it's "replace". No stacking. periodt.
OCSP_RESPID_match_ex() tests whether the OCSP_RESPID given in respid matches with the X509 certificate cert, based on the SHA1 hash. To calculate the hash, the SHA1 algorithm is fetched using the library ctx libctx and the property query string propq β again, see "ALGORITHM FETCHING" in crypto(7) for further information.
OCSP_RESPID_match() does the same as OCSP_RESPID_match_ex() except that the default library context is used with an empty property query string. Twin behaviour, default-vibes edition π
OCSP_basic_sign() signs the OCSP response brsp using certificate signer, private key key, digest dgst and additional certificates certs. Two flags to know:
- If the flags option
OCSP_NOCERTSis set, then no certificates will be included in the response. - If the flags option
OCSP_RESPID_KEYis set, then the responder is identified by key ID rather than by name.
OCSP_basic_sign_ctx() also signs the OCSP response brsp, but it uses the parameters contained in the digest context ctx instead. Same signing mission, different source of parameters β¨
π RETURN VALUES π
OCSP_RESPONSE_status()returns a status value. That's it, that's the vibe.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. void queen, returns nothing, still essential.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. Like, don't try to open the envelope if the mail never arrived, bestie. π
πΈ SEE ALSO πΈ
go read these too, they're all part of the family:
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 β
lore drop:
- 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 β you ate that. This one's from OpenSSL 3.5.6, dated 2026-04-07, and the manual page is OCSP_RESPONSE_STATUS(3ossl). go forth and respond to OCSP requests responsibly π¦β¨
π¦ where this page comes from
- freebsd 15.1: base 15.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms