OCSP: Minor improvements of documentation and header file
[openssl.git] / doc / man3 / OCSP_sendreq_new.pod
1 =pod
2
3 =head1 NAME
4
5 OCSP_REQ_CTX,
6 OCSP_sendreq_new,
7 OCSP_sendreq_nbio,
8 OCSP_sendreq_bio,
9 OCSP_REQ_CTX_i2d,
10 OCSP_REQ_CTX_add1_header,
11 OCSP_REQ_CTX_free,
12 OCSP_set_max_response_length,
13 OCSP_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 maxline);
22
23  int OCSP_sendreq_nbio(OCSP_RESPONSE **presp, OSSL_HTTP_REQ_CTX *rctx);
24
25  OCSP_RESPONSE *OCSP_sendreq_bio(BIO *io, const char *path, OCSP_REQUEST *req);
26
27 Deprecated since OpenSSL 3.0, can be hidden entirely by defining
28 B<OPENSSL_API_COMPAT> with a suitable version value, see
29 L<openssl_user_macros(7)>:
30
31  typedef OSSL_HTTP_REQ_CTX OCSP_REQ_CTX;
32  int OCSP_REQ_CTX_i2d(OCSP_REQ_CT *rctx, const ASN1_ITEM *it, ASN1_VALUE *req);
33  int OCSP_REQ_CTX_add1_header(OCSP_REQ_CT *rctx,
34                               const char *name, const char *value);
35  void OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx);
36  void OCSP_set_max_response_length(OCSP_REQ_CT *rctx,
37                                    unsigned long len);
38  int OCSP_REQ_CTX_set1_req(OCSP_REQ_CTX *rctx, const OCSP_REQUEST *req);
39
40 =head1 DESCRIPTION
41
42 These functions perform an OCSP POST request / response transfer over HTTP,
43 using the HTTP request functions described in L<OSSL_HTTP_REQ_CTX(3)>.
44
45 The function OCSP_sendreq_new() builds a complete B<OSSL_HTTP_REQ_CTX>
46 structure using connection B<BIO> I<io>, the URL path I<path>, the OCSP
47 request I<req>, and with a response header maximum line length of I<maxline>.
48 If I<maxline> is zero a default value of 4k is used.
49 The I<req> may be set to NULL and provided later using OCSP_REQ_CTX_set1_req()
50 or L<OSSL_HTTP_REQ_CTX_set1_req(3)> .
51
52 The I<io> and I<path> arguments to OCSP_sendreq_new() correspond to the
53 components of the URL.
54 For example if the responder URL is C<http://example.com/ocspreq> the BIO
55 I<io> should be connected to host C<example.com> on port 80 and I<path>
56 should be set to C</ocspreq>.
57
58 OCSP_sendreq_nbio() performs I/O on the OCSP request context I<rctx>.
59 When the operation is complete it assigns the response, a pointer to a
60 B<OCSP_RESPONSE> structure, in I<*presp>.
61
62 OCSP_sendreq_bio() is the same as a call to OCSP_sendreq_new() followed by
63 OCSP_sendreq_nbio() and then OCSP_REQ_CTX_free() in a single call, with a
64 response header maximum line length 4k. It waits indefinitely on a response.
65 It does not support setting a timeout or adding headers and is retained
66 for compatibility; use OCSP_sendreq_nbio() instead.
67
68 OCSP_REQ_CTX_i2d(rctx, it, req) is equivalent to the following:
69
70   OSSL_HTTP_REQ_CTX_set1_req(rctx, "application/ocsp-request", it, req)
71
72 OCSP_REQ_CTX_set1_req(rctx, req) is equivalent to the following:
73
74  OSSL_HTTP_REQ_CTX_set1_req(rctx, "application/ocsp-request",
75                             ASN1_ITEM_rptr(OCSP_REQUEST),
76                             (const ASN1_VALUE *)req)
77
78 The deprecated type and the remaining deprecated functions
79 have been superseded by the following equivalents:
80 B<OCSP_REQ_CTX> by L<OSSL_HTTP_REQ_CTX(3)>,
81 OCSP_REQ_CTX_add1_header() by L<OSSL_HTTP_REQ_CTX_add1_header(3)>,
82 OCSP_REQ_CTX_free() by L<OSSL_HTTP_REQ_CTX_free(3)>, and
83 OCSP_set_max_response_length() by
84 L<OSSL_HTTP_REQ_CTX_set_max_response_length(3)>.
85
86 =head1 RETURN VALUES
87
88 OCSP_sendreq_new() returns a valid B<OSSL_HTTP_REQ_CTX> structure or NULL
89 if an error occurred.
90
91 OCSP_sendreq_nbio(), OCSP_REQ_CTX_i2d(), and OCSP_REQ_CTX_set1_req()
92 return 1 for success and 0 for failure.
93
94 OCSP_sendreq_bio() returns the B<OCSP_RESPONSE> structure sent by the
95 responder or NULL if an error occurred.
96
97 =head1 SEE ALSO
98
99 L<OSSL_HTTP_REQ_CTX(3)>
100 L<OCSP_cert_to_id(3)>,
101 L<OCSP_request_add1_nonce(3)>,
102 L<OCSP_REQUEST_new(3)>,
103 L<OCSP_resp_find_status(3)>,
104 L<OCSP_response_status(3)>
105
106 =head1 HISTORY
107
108 B<OCSP_REQ_CTX>,
109 OCSP_REQ_CTX_i2d(),
110 OCSP_REQ_CTX_add1_header(),
111 OCSP_REQ_CTX_free(),
112 OCSP_set_max_response_length(),
113 and OCSP_REQ_CTX_set1_req()
114 were deprecated in OpenSSL 3.0.
115
116 =head1 COPYRIGHT
117
118 Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.
119
120 Licensed under the Apache License 2.0 (the "License").  You may not use
121 this file except in compliance with the License.  You can obtain a copy
122 in the file LICENSE in the source distribution or at
123 L<https://www.openssl.org/source/license.html>.
124
125 =cut