OCSP_RESPONSE_STATUS(3ossl)
π OCSP_RESPONSE_STATUS β OpenSSL's OCSP response era
okay so bestie, this is a page from the OpenSSL manual set (the 3ossl girlies), and it's literally all about handling OCSP responses β checking their status, building them, freeing them, and signing them. Let's go π
β¨ 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 β the OCSP response functions, aka the whole squad π«Ά
πΈ SYNOPSIS πΈ
#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 π
π¦ the response girlies
OCSP_response_status()β returns the OCSP response status ofresp. And what does it give you? One of these iconic values:OCSP_RESPONSE_STATUS_SUCCESSFUL,OCSP_RESPONSE_STATUS_MALFORMEDREQUEST,OCSP_RESPONSE_STATUS_INTERNALERROR,OCSP_RESPONSE_STATUS_TRYLATER,OCSP_RESPONSE_STATUS_SIGREQUIRED, orOCSP_RESPONSE_STATUS_UNAUTHORIZED. pick your fighter πOCSP_response_get1_basic()β decodes and returns theOCSP_BASICRESPstructure that's chilling insideresp. no cap, it just unpacks it for you πOCSP_response_create()β creates and returns anOCSP_RESPONSEstructure forstatus, optionally including the basic responsebs. build-a-bear but make it crypto π§OCSP_RESPONSE_free()β frees up the OCSP responseresp. and if the argument isNULL? nothing happens. she just minds her business π
π the RESPID identity crisis section
OCSP_RESPID_set_by_name()β sets the name of theOCSP_RESPIDto be the same as the subject name in the suppliedX509certificatecert, for the OCSP responder.OCSP_RESPID_set_by_key_ex()β sets the key of theOCSP_RESPIDto be the same as the key in the suppliedX509certificatecert, for the OCSP responder. The key is stored as a SHA1 hash. To calculate that hash, the SHA1 algorithm is fetched using the library ctxlibctxand the property query stringpropq(peep"ALGORITHM FETCHING"incrypto(7)for more info, iykyk).OCSP_RESPID_set_by_key()β does the same asOCSP_RESPID_set_by_key_ex()except that the default library context is used with an empty property query string. lowkey the chill version β¨
β οΈ heads up 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. it's giving "you can't sit with both tables" π
OCSP_RESPID_match_ex()β tests whether theOCSP_RESPIDgiven inrespidmatches with theX509certificatecert, based on the SHA1 hash. To calculate that hash, the SHA1 algorithm is fetched using the library ctxlibctxand the property query stringpropq(again, see"ALGORITHM FETCHING"incrypto(7)).OCSP_RESPID_match()β does the same asOCSP_RESPID_match_ex()except that the default library context is used with an empty property query string. same energy, default vibes π
π the signing section
OCSP_basic_sign()β signs the OCSP responsebrspusing certificatesigner, private keykey, digestdgst, and additional certificatescerts. If the flags optionOCSP_NOCERTSis set, then no certificates will be included in the response. And if the flags optionOCSP_RESPID_KEYis set, then the responder is identified by key ID rather than by name. choose your identity, main character πOCSP_basic_sign_ctx()β also signs the OCSP responsebrsp, but uses the parameters contained in the digest contextctx. it's the "I brought my own params" version π₯
β 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. she gives nothing and that's valid π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, she's only coming out to play when everything's slaying β¨
π¦ SEE ALSO π¦
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) β go read the whole friend group, fr fr π«Ά
πΈ HISTORY πΈ
- The
OCSP_RESPID_set_by_name(),OCSP_RESPID_set_by_key()andOCSP_RESPID_match()functions were added in OpenSSL 1.1.0a. vintage icon behavior π - The
OCSP_basic_sign_ctx()function was added in OpenSSL 1.1.1. late arrival but she ate π₯
π 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>.
okay that's the whole page bestie, no skips, no cuts π this was the 3.5.0 edition, dated 2026-09-25, and it's OCSP_RESPONSE_STATUS(3ossl) all the way down β mwah, go sign something responsibly πβ¨π
π¦ where this page comes from
- opensuse-leap 16.0: openssl-3-doc 3.5.0-160000.11.1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms