1OCSP_SENDREQ_NEW(3ossl)             OpenSSL            OCSP_SENDREQ_NEW(3ossl)
2
3
4

NAME

6       OCSP_REQ_CTX, OCSP_sendreq_new, OCSP_sendreq_nbio, OCSP_sendreq_bio,
7       OCSP_REQ_CTX_i2d, OCSP_REQ_CTX_add1_header, OCSP_REQ_CTX_free,
8       OCSP_set_max_response_length, OCSP_REQ_CTX_set1_req - OCSP responder
9       query functions
10

SYNOPSIS

12        #include <openssl/ocsp.h>
13
14        OSSL_HTTP_REQ_CTX *OCSP_sendreq_new(BIO *io, const char *path,
15                                            const OCSP_REQUEST *req, int buf_size);
16        OCSP_RESPONSE *OCSP_sendreq_bio(BIO *io, const char *path, OCSP_REQUEST *req);
17
18       The following functions have been deprecated since OpenSSL 3.0, and can
19       be hidden entirely by defining OPENSSL_API_COMPAT with a suitable
20       version value, see openssl_user_macros(7):
21
22        typedef OSSL_HTTP_REQ_CTX OCSP_REQ_CTX;
23        int OCSP_sendreq_nbio(OCSP_RESPONSE **presp, OSSL_HTTP_REQ_CTX *rctx);
24        int OCSP_REQ_CTX_i2d(OCSP_REQ_CT *rctx, const ASN1_ITEM *it, ASN1_VALUE *req);
25        int OCSP_REQ_CTX_add1_header(OCSP_REQ_CT *rctx,
26                                     const char *name, const char *value);
27        void OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx);
28        void OCSP_set_max_response_length(OCSP_REQ_CT *rctx, unsigned long len);
29        int OCSP_REQ_CTX_set1_req(OCSP_REQ_CTX *rctx, const OCSP_REQUEST *req);
30

DESCRIPTION

32       These functions perform an OCSP POST request / response transfer over
33       HTTP, using the HTTP request functions described in
34       OSSL_HTTP_REQ_CTX(3).
35
36       The function OCSP_sendreq_new() builds a complete OSSL_HTTP_REQ_CTX
37       structure with the BIO io to be used for requests and response, the URL
38       path path, optionally the OCSP request req, and a response header
39       maximum line length of buf_size. If buf_size is zero a default value of
40       4KiB is used.  The req may be set to NULL and provided later using
41       OCSP_REQ_CTX_set1_req() or OSSL_HTTP_REQ_CTX_set1_req(3).  The io and
42       path arguments to OCSP_sendreq_new() correspond to the components of
43       the URL.  For example if the responder URL is
44       "http://example.com/ocspreq" the BIO io should haven been connected to
45       host "example.com" on port 80 and path should be set to "/ocspreq".
46
47       OCSP_sendreq_nbio() attempts to send the request prepared in rctx and
48       to gather the response via HTTP, using the BIO io and path that were
49       given when calling OCSP_sendreq_new().  If the operation gets completed
50       it assigns the response, a pointer to a OCSP_RESPONSE structure, in
51       *presp.  The function may need to be called again if its result is -1,
52       which indicates BIO_should_retry(3).  In such a case it is advisable to
53       sleep a little in between, using BIO_wait(3) on the read BIO to prevent
54       a busy loop.
55
56       OCSP_sendreq_bio() combines OCSP_sendreq_new() with as many calls of
57       OCSP_sendreq_nbio() as needed and then OCSP_REQ_CTX_free(), with a
58       response header maximum line length 4k. It waits indefinitely on a
59       response.  It does not support setting a timeout or adding headers and
60       is retained for compatibility; use OSSL_HTTP_transfer(3) instead.
61
62       OCSP_REQ_CTX_i2d(rctx, it, req) is equivalent to the following:
63
64         OSSL_HTTP_REQ_CTX_set1_req(rctx, "application/ocsp-request", it, req)
65
66       OCSP_REQ_CTX_set1_req(rctx, req) is equivalent to the following:
67
68        OSSL_HTTP_REQ_CTX_set1_req(rctx, "application/ocsp-request",
69                                   ASN1_ITEM_rptr(OCSP_REQUEST),
70                                   (const ASN1_VALUE *)req)
71
72       The deprecated type and the remaining deprecated functions have been
73       superseded by the following equivalents: OCSP_REQ_CTX by
74       OSSL_HTTP_REQ_CTX(3), OCSP_REQ_CTX_add1_header() by
75       OSSL_HTTP_REQ_CTX_add1_header(3), OCSP_REQ_CTX_free() by
76       OSSL_HTTP_REQ_CTX_free(3), and OCSP_set_max_response_length() by
77       OSSL_HTTP_REQ_CTX_set_max_response_length(3).
78

RETURN VALUES

80       OCSP_sendreq_new() returns a valid OSSL_HTTP_REQ_CTX structure or NULL
81       if an error occurred.
82
83       OCSP_sendreq_nbio() returns 1 for success, 0 on error, -1 if retry is
84       needed.
85
86       OCSP_sendreq_bio() returns the OCSP_RESPONSE structure sent by the
87       responder or NULL if an error occurred.
88

SEE ALSO

90       OSSL_HTTP_REQ_CTX(3), OSSL_HTTP_transfer(3), OCSP_cert_to_id(3),
91       OCSP_request_add1_nonce(3), OCSP_REQUEST_new(3),
92       OCSP_resp_find_status(3), OCSP_response_status(3)
93

HISTORY

95       OCSP_REQ_CTX, OCSP_REQ_CTX_i2d(), OCSP_REQ_CTX_add1_header(),
96       OCSP_REQ_CTX_free(), OCSP_set_max_response_length(), and
97       OCSP_REQ_CTX_set1_req() were deprecated in OpenSSL 3.0.
98
100       Copyright 2015-2022 The OpenSSL Project Authors. All Rights Reserved.
101
102       Licensed under the Apache License 2.0 (the "License").  You may not use
103       this file except in compliance with the License.  You can obtain a copy
104       in the file LICENSE in the source distribution or at
105       <https://www.openssl.org/source/license.html>.
106
107
108
1093.1.1                             2023-08-31           OCSP_SENDREQ_NEW(3ossl)
Impressum