1=pod 2 3=head1 NAME 4 5OCSP_REQ_CTX, 6OCSP_sendreq_new, 7OCSP_sendreq_nbio, 8OCSP_sendreq_bio, 9OCSP_REQ_CTX_i2d, 10OCSP_REQ_CTX_add1_header, 11OCSP_REQ_CTX_free, 12OCSP_set_max_response_length, 13OCSP_REQ_CTX_set1_req 14- OCSP responder query functions 15 16=head1 SYNOPSIS 17 18 #include <openssl/ocsp.h> 19 20 OSSL_HTTP_REQ_CTX *OCSP_sendreq_new(BIO *io, const char *path, 21 const OCSP_REQUEST *req, int buf_size); 22 OCSP_RESPONSE *OCSP_sendreq_bio(BIO *io, const char *path, OCSP_REQUEST *req); 23 24The following functions have been deprecated since OpenSSL 3.0, and can be 25hidden entirely by defining B<OPENSSL_API_COMPAT> with a suitable version value, 26see L<openssl_user_macros(7)>: 27 28 typedef OSSL_HTTP_REQ_CTX OCSP_REQ_CTX; 29 int OCSP_sendreq_nbio(OCSP_RESPONSE **presp, OSSL_HTTP_REQ_CTX *rctx); 30 int OCSP_REQ_CTX_i2d(OCSP_REQ_CT *rctx, const ASN1_ITEM *it, ASN1_VALUE *req); 31 int OCSP_REQ_CTX_add1_header(OCSP_REQ_CT *rctx, 32 const char *name, const char *value); 33 void OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx); 34 void OCSP_set_max_response_length(OCSP_REQ_CT *rctx, unsigned long len); 35 int OCSP_REQ_CTX_set1_req(OCSP_REQ_CTX *rctx, const OCSP_REQUEST *req); 36 37=head1 DESCRIPTION 38 39These functions perform an OCSP POST request / response transfer over HTTP, 40using the HTTP request functions described in L<OSSL_HTTP_REQ_CTX(3)>. 41 42The function OCSP_sendreq_new() builds a complete B<OSSL_HTTP_REQ_CTX> structure 43with the B<BIO> I<io> to be used for requests and response, the URL path I<path>, 44optionally the OCSP request I<req>, and a response header maximum line length 45of I<buf_size>. If I<buf_size> is zero a default value of 4KiB is used. 46The I<req> may be set to NULL and provided later using OCSP_REQ_CTX_set1_req() 47or L<OSSL_HTTP_REQ_CTX_set1_req(3)>. 48The I<io> and I<path> arguments to OCSP_sendreq_new() correspond to the 49components of the URL. 50For example if the responder URL is C<http://example.com/ocspreq> the BIO 51I<io> should haven been connected to host C<example.com> on port 80 and I<path> 52should be set to C</ocspreq>. 53 54OCSP_sendreq_nbio() attempts to send the request prepared in I<rctx> 55and to gather the response via HTTP, using the BIO I<io> and I<path> 56that were given when calling OCSP_sendreq_new(). 57If the operation gets completed it assigns the response, 58a pointer to a B<OCSP_RESPONSE> structure, in I<*presp>. 59The function may need to be called again if its result is -1, which indicates 60L<BIO_should_retry(3)>. In such a case it is advisable to sleep a little in 61between, using L<BIO_wait(3)> on the read BIO to prevent a busy loop. 62 63OCSP_sendreq_bio() combines OCSP_sendreq_new() with as many calls of 64OCSP_sendreq_nbio() as needed and then OCSP_REQ_CTX_free(), with a 65response header maximum line length 4k. It waits indefinitely on a response. 66It does not support setting a timeout or adding headers and is retained 67for compatibility; use L<OSSL_HTTP_transfer(3)> instead. 68 69OCSP_REQ_CTX_i2d(rctx, it, req) is equivalent to the following: 70 71 OSSL_HTTP_REQ_CTX_set1_req(rctx, "application/ocsp-request", it, req) 72 73OCSP_REQ_CTX_set1_req(rctx, req) is equivalent to the following: 74 75 OSSL_HTTP_REQ_CTX_set1_req(rctx, "application/ocsp-request", 76 ASN1_ITEM_rptr(OCSP_REQUEST), 77 (const ASN1_VALUE *)req) 78 79The deprecated type and the remaining deprecated functions 80have been superseded by the following equivalents: 81B<OCSP_REQ_CTX> by L<OSSL_HTTP_REQ_CTX(3)>, 82OCSP_REQ_CTX_add1_header() by L<OSSL_HTTP_REQ_CTX_add1_header(3)>, 83OCSP_REQ_CTX_free() by L<OSSL_HTTP_REQ_CTX_free(3)>, and 84OCSP_set_max_response_length() by 85L<OSSL_HTTP_REQ_CTX_set_max_response_length(3)>. 86 87=head1 RETURN VALUES 88 89OCSP_sendreq_new() returns a valid B<OSSL_HTTP_REQ_CTX> structure or NULL 90if an error occurred. 91 92OCSP_sendreq_nbio() returns 1 for success, 0 on error, -1 if retry is needed. 93 94OCSP_sendreq_bio() returns the B<OCSP_RESPONSE> structure sent by the 95responder or NULL if an error occurred. 96 97=head1 SEE ALSO 98 99L<OSSL_HTTP_REQ_CTX(3)>, L<OSSL_HTTP_transfer(3)>, 100L<OCSP_cert_to_id(3)>, 101L<OCSP_request_add1_nonce(3)>, 102L<OCSP_REQUEST_new(3)>, 103L<OCSP_resp_find_status(3)>, 104L<OCSP_response_status(3)> 105 106=head1 HISTORY 107 108B<OCSP_REQ_CTX>, 109OCSP_REQ_CTX_i2d(), 110OCSP_REQ_CTX_add1_header(), 111OCSP_REQ_CTX_free(), 112OCSP_set_max_response_length(), 113and OCSP_REQ_CTX_set1_req() 114were deprecated in OpenSSL 3.0. 115 116=head1 COPYRIGHT 117 118Copyright 2015-2022 The OpenSSL Project Authors. All Rights Reserved. 119 120Licensed under the Apache License 2.0 (the "License"). You may not use 121this file except in compliance with the License. You can obtain a copy 122in the file LICENSE in the source distribution or at 123L<https://www.openssl.org/source/license.html>. 124 125=cut 126