OCSP_sendreq_new.3ossl 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. .\" -*- mode: troff; coding: utf-8 -*-
  2. .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43)
  3. .\"
  4. .\" Standard preamble:
  5. .\" ========================================================================
  6. .de Sp \" Vertical space (when we can't use .PP)
  7. .if t .sp .5v
  8. .if n .sp
  9. ..
  10. .de Vb \" Begin verbatim text
  11. .ft CW
  12. .nf
  13. .ne \\$1
  14. ..
  15. .de Ve \" End verbatim text
  16. .ft R
  17. .fi
  18. ..
  19. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
  20. .ie n \{\
  21. . ds C` ""
  22. . ds C' ""
  23. 'br\}
  24. .el\{\
  25. . ds C`
  26. . ds C'
  27. 'br\}
  28. .\"
  29. .\" Escape single quotes in literal strings from groff's Unicode transform.
  30. .ie \n(.g .ds Aq \(aq
  31. .el .ds Aq '
  32. .\"
  33. .\" If the F register is >0, we'll generate index entries on stderr for
  34. .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
  35. .\" entries marked with X<> in POD. Of course, you'll have to process the
  36. .\" output yourself in some meaningful fashion.
  37. .\"
  38. .\" Avoid warning from groff about undefined register 'F'.
  39. .de IX
  40. ..
  41. .nr rF 0
  42. .if \n(.g .if rF .nr rF 1
  43. .if (\n(rF:(\n(.g==0)) \{\
  44. . if \nF \{\
  45. . de IX
  46. . tm Index:\\$1\t\\n%\t"\\$2"
  47. ..
  48. . if !\nF==2 \{\
  49. . nr % 0
  50. . nr F 2
  51. . \}
  52. . \}
  53. .\}
  54. .rr rF
  55. .\" ========================================================================
  56. .\"
  57. .IX Title "OCSP_SENDREQ_NEW 3ossl"
  58. .TH OCSP_SENDREQ_NEW 3ossl 2025-01-17 3.4.0 OpenSSL
  59. .\" For nroff, turn off justification. Always turn off hyphenation; it makes
  60. .\" way too many mistakes in technical documents.
  61. .if n .ad l
  62. .nh
  63. .SH NAME
  64. OCSP_REQ_CTX,
  65. OCSP_sendreq_new,
  66. OCSP_sendreq_nbio,
  67. OCSP_sendreq_bio,
  68. OCSP_REQ_CTX_i2d,
  69. OCSP_REQ_CTX_add1_header,
  70. OCSP_REQ_CTX_free,
  71. OCSP_set_max_response_length,
  72. OCSP_REQ_CTX_set1_req
  73. \&\- OCSP responder query functions
  74. .SH SYNOPSIS
  75. .IX Header "SYNOPSIS"
  76. .Vb 1
  77. \& #include <openssl/ocsp.h>
  78. \&
  79. \& OSSL_HTTP_REQ_CTX *OCSP_sendreq_new(BIO *io, const char *path,
  80. \& const OCSP_REQUEST *req, int buf_size);
  81. \& OCSP_RESPONSE *OCSP_sendreq_bio(BIO *io, const char *path, OCSP_REQUEST *req);
  82. .Ve
  83. .PP
  84. The following functions have been deprecated since OpenSSL 3.0, and can be
  85. hidden entirely by defining \fBOPENSSL_API_COMPAT\fR with a suitable version value,
  86. see \fBopenssl_user_macros\fR\|(7):
  87. .PP
  88. .Vb 8
  89. \& typedef OSSL_HTTP_REQ_CTX OCSP_REQ_CTX;
  90. \& int OCSP_sendreq_nbio(OCSP_RESPONSE **presp, OSSL_HTTP_REQ_CTX *rctx);
  91. \& int OCSP_REQ_CTX_i2d(OCSP_REQ_CT *rctx, const ASN1_ITEM *it, ASN1_VALUE *req);
  92. \& int OCSP_REQ_CTX_add1_header(OCSP_REQ_CT *rctx,
  93. \& const char *name, const char *value);
  94. \& void OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx);
  95. \& void OCSP_set_max_response_length(OCSP_REQ_CT *rctx, unsigned long len);
  96. \& int OCSP_REQ_CTX_set1_req(OCSP_REQ_CTX *rctx, const OCSP_REQUEST *req);
  97. .Ve
  98. .SH DESCRIPTION
  99. .IX Header "DESCRIPTION"
  100. These functions perform an OCSP POST request / response transfer over HTTP,
  101. using the HTTP request functions described in \fBOSSL_HTTP_REQ_CTX\fR\|(3).
  102. .PP
  103. The function \fBOCSP_sendreq_new()\fR builds a complete \fBOSSL_HTTP_REQ_CTX\fR structure
  104. with the \fBBIO\fR \fIio\fR to be used for requests and response, the URL path \fIpath\fR,
  105. optionally the OCSP request \fIreq\fR, and a response header maximum line length
  106. of \fIbuf_size\fR. If \fIbuf_size\fR is zero a default value of 4KiB is used.
  107. The \fIreq\fR may be set to NULL and provided later using \fBOCSP_REQ_CTX_set1_req()\fR
  108. or \fBOSSL_HTTP_REQ_CTX_set1_req\fR\|(3).
  109. The \fIio\fR and \fIpath\fR arguments to \fBOCSP_sendreq_new()\fR correspond to the
  110. components of the URL.
  111. For example if the responder URL is \f(CW\*(C`http://example.com/ocspreq\*(C'\fR the BIO
  112. \&\fIio\fR should haven been connected to host \f(CW\*(C`example.com\*(C'\fR on port 80 and \fIpath\fR
  113. should be set to \f(CW\*(C`/ocspreq\*(C'\fR.
  114. .PP
  115. \&\fBOCSP_sendreq_nbio()\fR attempts to send the request prepared in \fIrctx\fR
  116. and to gather the response via HTTP, using the BIO \fIio\fR and \fIpath\fR
  117. that were given when calling \fBOCSP_sendreq_new()\fR.
  118. If the operation gets completed it assigns the response,
  119. a pointer to a \fBOCSP_RESPONSE\fR structure, in \fI*presp\fR.
  120. The function may need to be called again if its result is \-1, which indicates
  121. \&\fBBIO_should_retry\fR\|(3). In such a case it is advisable to sleep a little in
  122. between, using \fBBIO_wait\fR\|(3) on the read BIO to prevent a busy loop.
  123. .PP
  124. \&\fBOCSP_sendreq_bio()\fR combines \fBOCSP_sendreq_new()\fR with as many calls of
  125. \&\fBOCSP_sendreq_nbio()\fR as needed and then \fBOCSP_REQ_CTX_free()\fR, with a
  126. response header maximum line length 4k. It waits indefinitely on a response.
  127. It does not support setting a timeout or adding headers and is retained
  128. for compatibility; use \fBOSSL_HTTP_transfer\fR\|(3) instead.
  129. .PP
  130. OCSP_REQ_CTX_i2d(rctx, it, req) is equivalent to the following:
  131. .PP
  132. .Vb 1
  133. \& OSSL_HTTP_REQ_CTX_set1_req(rctx, "application/ocsp\-request", it, req)
  134. .Ve
  135. .PP
  136. OCSP_REQ_CTX_set1_req(rctx, req) is equivalent to the following:
  137. .PP
  138. .Vb 3
  139. \& OSSL_HTTP_REQ_CTX_set1_req(rctx, "application/ocsp\-request",
  140. \& ASN1_ITEM_rptr(OCSP_REQUEST),
  141. \& (const ASN1_VALUE *)req)
  142. .Ve
  143. .PP
  144. The deprecated type and the remaining deprecated functions
  145. have been superseded by the following equivalents:
  146. \&\fBOCSP_REQ_CTX\fR by \fBOSSL_HTTP_REQ_CTX\fR\|(3),
  147. \&\fBOCSP_REQ_CTX_add1_header()\fR by \fBOSSL_HTTP_REQ_CTX_add1_header\fR\|(3),
  148. \&\fBOCSP_REQ_CTX_free()\fR by \fBOSSL_HTTP_REQ_CTX_free\fR\|(3), and
  149. \&\fBOCSP_set_max_response_length()\fR by
  150. \&\fBOSSL_HTTP_REQ_CTX_set_max_response_length\fR\|(3).
  151. .SH "RETURN VALUES"
  152. .IX Header "RETURN VALUES"
  153. \&\fBOCSP_sendreq_new()\fR returns a valid \fBOSSL_HTTP_REQ_CTX\fR structure or NULL
  154. if an error occurred.
  155. .PP
  156. \&\fBOCSP_sendreq_nbio()\fR returns 1 for success, 0 on error, \-1 if retry is needed.
  157. .PP
  158. \&\fBOCSP_sendreq_bio()\fR returns the \fBOCSP_RESPONSE\fR structure sent by the
  159. responder or NULL if an error occurred.
  160. .SH "SEE ALSO"
  161. .IX Header "SEE ALSO"
  162. \&\fBOSSL_HTTP_REQ_CTX\fR\|(3), \fBOSSL_HTTP_transfer\fR\|(3),
  163. \&\fBOCSP_cert_to_id\fR\|(3),
  164. \&\fBOCSP_request_add1_nonce\fR\|(3),
  165. \&\fBOCSP_REQUEST_new\fR\|(3),
  166. \&\fBOCSP_resp_find_status\fR\|(3),
  167. \&\fBOCSP_response_status\fR\|(3)
  168. .SH HISTORY
  169. .IX Header "HISTORY"
  170. \&\fBOCSP_REQ_CTX\fR,
  171. \&\fBOCSP_REQ_CTX_i2d()\fR,
  172. \&\fBOCSP_REQ_CTX_add1_header()\fR,
  173. \&\fBOCSP_REQ_CTX_free()\fR,
  174. \&\fBOCSP_set_max_response_length()\fR,
  175. and \fBOCSP_REQ_CTX_set1_req()\fR
  176. were deprecated in OpenSSL 3.0.
  177. .SH COPYRIGHT
  178. .IX Header "COPYRIGHT"
  179. Copyright 2015\-2022 The OpenSSL Project Authors. All Rights Reserved.
  180. .PP
  181. Licensed under the Apache License 2.0 (the "License"). You may not use
  182. this file except in compliance with the License. You can obtain a copy
  183. in the file LICENSE in the source distribution or at
  184. <https://www.openssl.org/source/license.html>.