]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - doc/man3/OCSP_sendreq_new.pod
Import OpenSSL 1.1.1j.
[FreeBSD/FreeBSD.git] / doc / man3 / OCSP_sendreq_new.pod
1 =pod
2
3 =head1 NAME
4
5 OCSP_sendreq_new,
6 OCSP_sendreq_nbio,
7 OCSP_REQ_CTX_free,
8 OCSP_set_max_response_length,
9 OCSP_REQ_CTX_add1_header,
10 OCSP_REQ_CTX_set1_req,
11 OCSP_sendreq_bio,
12 OCSP_REQ_CTX_i2d
13 - OCSP responder query functions
14
15 =head1 SYNOPSIS
16
17  #include <openssl/ocsp.h>
18
19  OCSP_REQ_CTX *OCSP_sendreq_new(BIO *io, const char *path, OCSP_REQUEST *req,
20                                 int maxline);
21
22  int OCSP_sendreq_nbio(OCSP_RESPONSE **presp, OCSP_REQ_CTX *rctx);
23
24  void OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx);
25
26  void OCSP_set_max_response_length(OCSP_REQ_CTX *rctx, unsigned long len);
27
28  int OCSP_REQ_CTX_add1_header(OCSP_REQ_CTX *rctx,
29                               const char *name, const char *value);
30
31  int OCSP_REQ_CTX_set1_req(OCSP_REQ_CTX *rctx, OCSP_REQUEST *req);
32
33  OCSP_RESPONSE *OCSP_sendreq_bio(BIO *io, const char *path, OCSP_REQUEST *req);
34
35  int OCSP_REQ_CTX_i2d(OCSP_REQ_CTX *rctx, const char *content_type,
36                       const ASN1_ITEM *it, ASN1_VALUE *req);
37
38 =head1 DESCRIPTION
39
40 The function OCSP_sendreq_new() returns an B<OCSP_CTX> structure using the
41 responder B<io>, the URL path B<path>, the OCSP request B<req> and with a
42 response header maximum line length of B<maxline>. If B<maxline> is zero a
43 default value of 4k is used. The OCSP request B<req> may be set to B<NULL>
44 and provided later if required.
45
46 OCSP_sendreq_nbio() performs nonblocking I/O on the OCSP request context
47 B<rctx>. When the operation is complete it returns the response in B<*presp>.
48
49 OCSP_REQ_CTX_free() frees up the OCSP context B<rctx>.
50
51 OCSP_set_max_response_length() sets the maximum response length for B<rctx>
52 to B<len>. If the response exceeds this length an error occurs. If not
53 set a default value of 100k is used.
54
55 OCSP_REQ_CTX_add1_header() adds header B<name> with value B<value> to the
56 context B<rctx>. It can be called more than once to add multiple headers.
57 It B<MUST> be called before any calls to OCSP_sendreq_nbio(). The B<req>
58 parameter in the initial to OCSP_sendreq_new() call MUST be set to B<NULL> if
59 additional headers are set.
60
61 OCSP_REQ_CTX_set1_req() sets the OCSP request in B<rctx> to B<req>. This
62 function should be called after any calls to OCSP_REQ_CTX_add1_header().
63 OCSP_REQ_CTX_set1_req(rctx, req) is equivalent to the following:
64
65  OCSP_REQ_CTX_i2d(rctx, "application/ocsp-request",
66                         ASN1_ITEM_rptr(OCSP_REQUEST), (ASN1_VALUE *)req)
67
68 OCSP_REQ_CTX_i2d() sets the request context B<rctx> to have the request
69 B<req>, which has the ASN.1 type B<it>.
70 The B<content_type>, if not NULL, will be included in the HTTP request.
71 The function should be called after all other headers have already been added.
72
73 OCSP_sendreq_bio() performs an OCSP request using the responder B<io>, the URL
74 path B<path>, and the OCSP request B<req> with a response header maximum line
75 length 4k. It waits indefinitely on a response.
76
77 =head1 RETURN VALUES
78
79 OCSP_sendreq_new() returns a valid B<OCSP_REQ_CTX> structure or B<NULL> if
80 an error occurred.
81
82 OCSP_sendreq_nbio() returns B<1> if the operation was completed successfully,
83 B<-1> if the operation should be retried and B<0> if an error occurred.
84
85 OCSP_REQ_CTX_add1_header(), OCSP_REQ_CTX_set1_req(), and OCSP_REQ_CTX_i2d()
86 return B<1> for success and B<0> for failure.
87
88 OCSP_sendreq_bio() returns the B<OCSP_RESPONSE> structure sent by the
89 responder or B<NULL> if an error occurred.
90
91 OCSP_REQ_CTX_free() and OCSP_set_max_response_length() do not return values.
92
93 =head1 NOTES
94
95 These functions only perform a minimal HTTP query to a responder. If an
96 application wishes to support more advanced features it should use an
97 alternative more complete HTTP library.
98
99 Currently only HTTP POST queries to responders are supported.
100
101 The arguments to OCSP_sendreq_new() correspond to the components of the URL.
102 For example if the responder URL is B<http://ocsp.com/ocspreq> the BIO
103 B<io> should be connected to host B<ocsp.com> on port 80 and B<path>
104 should be set to B<"/ocspreq">
105
106 The headers added with OCSP_REQ_CTX_add1_header() are of the form
107 "B<name>: B<value>" or just "B<name>" if B<value> is B<NULL>. So to add
108 a Host header for B<ocsp.com> you would call:
109
110  OCSP_REQ_CTX_add1_header(ctx, "Host", "ocsp.com");
111
112 If OCSP_sendreq_nbio() indicates an operation should be retried the
113 corresponding BIO can be examined to determine which operation (read or
114 write) should be retried and appropriate action taken (for example a select()
115 call on the underlying socket).
116
117 OCSP_sendreq_bio() does not support retries and so cannot handle nonblocking
118 I/O efficiently. It is retained for compatibility and its use in new
119 applications is not recommended.
120
121 =head1 SEE ALSO
122
123 L<crypto(7)>,
124 L<OCSP_cert_to_id(3)>,
125 L<OCSP_request_add1_nonce(3)>,
126 L<OCSP_REQUEST_new(3)>,
127 L<OCSP_resp_find_status(3)>,
128 L<OCSP_response_status(3)>
129
130 =head1 COPYRIGHT
131
132 Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved.
133
134 Licensed under the OpenSSL license (the "License").  You may not use
135 this file except in compliance with the License.  You can obtain a copy
136 in the file LICENSE in the source distribution or at
137 L<https://www.openssl.org/source/license.html>.
138
139 =cut