xref: /freebsd/secure/lib/libcrypto/man/man3/OCSP_sendreq_new.3 (revision c7a063741720ef81d4caa4613242579d12f1d605)
Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40)

Standard preamble:
========================================================================
..
..
.. Set up some character translations and predefined strings. \*(-- will
give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
double quote, and \*(R" will give a right double quote. \*(C+ will
give a nicer C++. Capital omega is used to do unbreakable dashes and
therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
nothing in troff, for use with C<>.
.tr \(*W- . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\}
Escape single quotes in literal strings from groff's Unicode transform.

If the F register is >0, we'll generate index entries on stderr for
titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
entries marked with X<> in POD. Of course, you'll have to process the
output yourself in some meaningful fashion.

Avoid warning from groff about undefined register 'F'.
.. .nr rF 0 . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF
Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] .\} . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents . \" corrections for vroff . \" for low resolution devices (crt and lpr) \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} ========================================================================

Title "OCSP_SENDREQ_NEW 3"
OCSP_SENDREQ_NEW 3 "2022-11-01" "1.1.1s" "OpenSSL"
For nroff, turn off justification. Always turn off hyphenation; it makes
way too many mistakes in technical documents.
"NAME"
OCSP_sendreq_new, OCSP_sendreq_nbio, OCSP_REQ_CTX_free, OCSP_set_max_response_length, OCSP_REQ_CTX_add1_header, OCSP_REQ_CTX_set1_req, OCSP_sendreq_bio, OCSP_REQ_CTX_i2d \- OCSP responder query functions
"SYNOPSIS"
Header "SYNOPSIS" .Vb 1 #include <openssl/ocsp.h> \& OCSP_REQ_CTX *OCSP_sendreq_new(BIO *io, const char *path, OCSP_REQUEST *req, int maxline); \& int OCSP_sendreq_nbio(OCSP_RESPONSE **presp, OCSP_REQ_CTX *rctx); \& void OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx); \& void OCSP_set_max_response_length(OCSP_REQ_CTX *rctx, unsigned long len); \& int OCSP_REQ_CTX_add1_header(OCSP_REQ_CTX *rctx, const char *name, const char *value); \& int OCSP_REQ_CTX_set1_req(OCSP_REQ_CTX *rctx, OCSP_REQUEST *req); \& OCSP_RESPONSE *OCSP_sendreq_bio(BIO *io, const char *path, OCSP_REQUEST *req); \& int OCSP_REQ_CTX_i2d(OCSP_REQ_CTX *rctx, const char *content_type, const ASN1_ITEM *it, ASN1_VALUE *req); .Ve
"DESCRIPTION"
Header "DESCRIPTION" The function OCSP_sendreq_new() returns an \s-1OCSP_CTX\s0 structure using the responder io, the \s-1URL\s0 path path, the \s-1OCSP\s0 request req and with a response header maximum line length of maxline. If maxline is zero a default value of 4k is used. The \s-1OCSP\s0 request req may be set to \s-1NULL\s0 and provided later if required.

\fBOCSP_sendreq_nbio() performs nonblocking I/O on the \s-1OCSP\s0 request context \fBrctx. When the operation is complete it returns the response in *presp.

\fBOCSP_REQ_CTX_free() frees up the \s-1OCSP\s0 context rctx.

\fBOCSP_set_max_response_length() sets the maximum response length for rctx to len. If the response exceeds this length an error occurs. If not set a default value of 100k is used.

\fBOCSP_REQ_CTX_add1_header() adds header name with value value to the context rctx. It can be called more than once to add multiple headers. It \s-1MUST\s0 be called before any calls to OCSP_sendreq_nbio(). The req parameter in the initial to OCSP_sendreq_new() call \s-1MUST\s0 be set to \s-1NULL\s0 if additional headers are set.

\fBOCSP_REQ_CTX_set1_req() sets the \s-1OCSP\s0 request in rctx to req. This function should be called after any calls to OCSP_REQ_CTX_add1_header(). OCSP_REQ_CTX_set1_req(rctx, req) is equivalent to the following:

.Vb 2 OCSP_REQ_CTX_i2d(rctx, "application/ocsp-request", ASN1_ITEM_rptr(OCSP_REQUEST), (ASN1_VALUE *)req) .Ve

\fBOCSP_REQ_CTX_i2d() sets the request context rctx to have the request \fBreq, which has the \s-1ASN.1\s0 type it. The content_type, if not \s-1NULL,\s0 will be included in the \s-1HTTP\s0 request. The function should be called after all other headers have already been added.

\fBOCSP_sendreq_bio() performs an \s-1OCSP\s0 request using the responder io, the \s-1URL\s0 path path, and the \s-1OCSP\s0 request req with a response header maximum line length 4k. It waits indefinitely on a response.

"RETURN VALUES"
Header "RETURN VALUES" \fBOCSP_sendreq_new() returns a valid \s-1OCSP_REQ_CTX\s0 structure or \s-1NULL\s0 if an error occurred.

\fBOCSP_sendreq_nbio() returns 1 if the operation was completed successfully, \fB-1 if the operation should be retried and 0 if an error occurred.

\fBOCSP_REQ_CTX_add1_header(), OCSP_REQ_CTX_set1_req(), and OCSP_REQ_CTX_i2d() return 1 for success and 0 for failure.

\fBOCSP_sendreq_bio() returns the \s-1OCSP_RESPONSE\s0 structure sent by the responder or \s-1NULL\s0 if an error occurred.

\fBOCSP_REQ_CTX_free() and OCSP_set_max_response_length() do not return values.

"NOTES"
Header "NOTES" These functions only perform a minimal \s-1HTTP\s0 query to a responder. If an application wishes to support more advanced features it should use an alternative more complete \s-1HTTP\s0 library.

Currently only \s-1HTTP POST\s0 queries to responders are supported.

The arguments to OCSP_sendreq_new() correspond to the components of the \s-1URL.\s0 For example if the responder \s-1URL\s0 is http://ocsp.com/ocspreq the \s-1BIO\s0 \fBio should be connected to host ocsp.com on port 80 and path should be set to \*(L"/ocspreq\*(R"

The headers added with OCSP_REQ_CTX_add1_header() are of the form "name: value\*(L" or just \*(R"name" if value is \s-1NULL\s0. So to add a Host header for ocsp.com you would call:

.Vb 1 OCSP_REQ_CTX_add1_header(ctx, "Host", "ocsp.com"); .Ve

If OCSP_sendreq_nbio() indicates an operation should be retried the corresponding \s-1BIO\s0 can be examined to determine which operation (read or write) should be retried and appropriate action taken (for example a select() call on the underlying socket).

\fBOCSP_sendreq_bio() does not support retries and so cannot handle nonblocking I/O efficiently. It is retained for compatibility and its use in new applications is not recommended.

"SEE ALSO"
Header "SEE ALSO" \fBcrypto\|(7), \fBOCSP_cert_to_id\|(3), \fBOCSP_request_add1_nonce\|(3), \fBOCSP_REQUEST_new\|(3), \fBOCSP_resp_find_status\|(3), \fBOCSP_response_status\|(3)
"COPYRIGHT"
Header "COPYRIGHT" Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the OpenSSL license (the \*(L"License\*(R"). You may not use this file except in compliance with the License. You can obtain a copy in the file \s-1LICENSE\s0 in the source distribution or at <https://www.openssl.org/source/license.html>.