openssl-prebuild/linux_amd64/ssl/share/doc/openssl/html/man3/OCSP_sendreq_new.html

142 lines
6.3 KiB
HTML
Executable File

<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>OCSP_sendreq_new</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@localhost" />
</head>
<body style="background-color: white">
<!-- INDEX BEGIN -->
<div name="index">
<p><a name="__index__"></a></p>
<ul>
<li><a href="#name">NAME</a></li>
<li><a href="#synopsis">SYNOPSIS</a></li>
<li><a href="#description">DESCRIPTION</a></li>
<li><a href="#return_values">RETURN VALUES</a></li>
<li><a href="#notes">NOTES</a></li>
<li><a href="#see_also">SEE ALSO</a></li>
<li><a href="#copyright">COPYRIGHT</a></li>
</ul>
<hr name="index" />
</div>
<!-- INDEX END -->
<p>
</p>
<hr />
<h1><a name="name">NAME</a></h1>
<p>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 responder query functions</p>
<p>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<pre>
#include &lt;openssl/ocsp.h&gt;</pre>
<pre>
OCSP_REQ_CTX *OCSP_sendreq_new(BIO *io, const char *path,
OCSP_REQUEST *req, int maxline);</pre>
<pre>
int OCSP_sendreq_nbio(OCSP_RESPONSE **presp, OCSP_REQ_CTX *rctx);</pre>
<pre>
void OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx);</pre>
<pre>
void OCSP_set_max_response_length(OCSP_REQ_CTX *rctx,
unsigned long len);</pre>
<pre>
int OCSP_REQ_CTX_add1_header(OCSP_REQ_CTX *rctx,
const char *name, const char *value);</pre>
<pre>
int OCSP_REQ_CTX_set1_req(OCSP_REQ_CTX *rctx, const OCSP_REQUEST *req);</pre>
<pre>
OCSP_RESPONSE *OCSP_sendreq_bio(BIO *io, const char *path, OCSP_REQUEST *req);</pre>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>The function <code>OCSP_sendreq_new()</code> returns an <strong>OCSP_CTX</strong> structure using the
responder <strong>io</strong>, the URL path <strong>path</strong>, the OCSP request <strong>req</strong> and with a
response header maximum line length of <strong>maxline</strong>. If <strong>maxline</strong> is zero a
default value of 4k is used. The OCSP request <strong>req</strong> may be set to <strong>NULL</strong>
and provided later if required.</p>
<p><code>OCSP_sendreq_nbio()</code> performs I/O on the OCSP request context <strong>rctx</strong>.
When the operation is complete it returns the response in <strong>*presp</strong>.</p>
<p><code>OCSP_REQ_CTX_free()</code> frees up the OCSP context <strong>rctx</strong>.</p>
<p><code>OCSP_set_max_response_length()</code> sets the maximum response length
for <strong>rctx</strong> to <strong>len</strong>. If the response exceeds this length an error occurs.
If not set a default value of 100k is used.</p>
<p>OCSP_REQ_CTX_add1_header() adds header <strong>name</strong> with value <strong>value</strong> to the
context <strong>rctx</strong>. It can be called more than once to add multiple headers.
It <strong>MUST</strong> be called before any calls to <code>OCSP_sendreq_nbio()</code>. The <strong>req</strong>
parameter in the initial to <code>OCSP_sendreq_new()</code> call MUST be set to <strong>NULL</strong> if
additional headers are set.</p>
<p>OCSP_REQ_CTX_set1_req() sets the OCSP request in <strong>rctx</strong> to <strong>req</strong>. This
function should be called after any calls to OCSP_REQ_CTX_add1_header().</p>
<p><code>OCSP_sendreq_bio()</code> performs an OCSP request using the responder <strong>io</strong>, the URL
path <strong>path</strong>, the OCSP request <strong>req</strong> and with a response header maximum line
length 4k. It waits indefinitely on a response.</p>
<p>
</p>
<hr />
<h1><a name="return_values">RETURN VALUES</a></h1>
<p><code>OCSP_sendreq_new()</code> returns a valid <strong>OCSP_REQ_CTX</strong> structure or <strong>NULL</strong>
if an error occurred.</p>
<p><code>OCSP_sendreq_nbio()</code>, OCSP_REQ_CTX_add1_header() and OCSP_REQ_CTX_set1_req()
return <strong>1</strong> for success and <strong>0</strong> for failure.</p>
<p><code>OCSP_sendreq_bio()</code> returns the <strong>OCSP_RESPONSE</strong> structure sent by the
responder or <strong>NULL</strong> if an error occurred.</p>
<p><code>OCSP_REQ_CTX_free()</code> and <code>OCSP_set_max_response_length()</code>
do not return values.</p>
<p>
</p>
<hr />
<h1><a name="notes">NOTES</a></h1>
<p>These functions only perform a minimal HTTP query to a responder. If an
application wishes to support more advanced features it should use an
alternative more complete HTTP library.</p>
<p>Currently only HTTP POST queries to responders are supported.</p>
<p>The arguments to <code>OCSP_sendreq_new()</code> correspond to the components of the URL.
For example if the responder URL is <strong><a href="http://ocsp.com/ocspreq">http://ocsp.com/ocspreq</a></strong> the BIO
<strong>io</strong> should be connected to host <strong>ocsp.com</strong> on port 80 and <strong>path</strong>
should be set to <strong>&quot;/ocspreq&quot;</strong></p>
<p>The headers added with OCSP_REQ_CTX_add1_header() are of the form
&quot;<strong>name</strong>: <strong>value</strong>&quot; or just &quot;<strong>name</strong>&quot; if <strong>value</strong> is <strong>NULL</strong>. So to add
a Host header for <strong>ocsp.com</strong> you would call:</p>
<pre>
OCSP_REQ_CTX_add1_header(ctx, &quot;Host&quot;, &quot;ocsp.com&quot;);</pre>
<p><code>OCSP_sendreq_bio()</code> does not support timeout nor setting extra headers.
It is retained for compatibility.
Better use <strong>OCSP_sendreq_nbio()</strong> instead.</p>
<p>
</p>
<hr />
<h1><a name="see_also">SEE ALSO</a></h1>
<p><em>crypto(7)</em>,
<em>OCSP_cert_to_id(3)</em>,
<em>OCSP_request_add1_nonce(3)</em>,
<em>OCSP_REQUEST_new(3)</em>,
<em>OCSP_resp_find_status(3)</em>,
<em>OCSP_response_status(3)</em></p>
<p>
</p>
<hr />
<h1><a name="copyright">COPYRIGHT</a></h1>
<p>Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.</p>
<p>Licensed under the Apache License 2.0 (the &quot;License&quot;). You may not use
this file except in compliance with the License. You can obtain a copy
in the file LICENSE in the source distribution or at
<a href="https://www.openssl.org/source/license.html">https://www.openssl.org/source/license.html</a>.</p>
</body>
</html>