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

133 lines
5.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>SRP_VBASE_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="#see_also">SEE ALSO</a></li>
<li><a href="#history">HISTORY</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>SRP_VBASE_new,
SRP_VBASE_free,
SRP_VBASE_init,
SRP_VBASE_add0_user,
SRP_VBASE_get1_by_user,
SRP_VBASE_get_by_user
- Functions to create and manage a stack of SRP user verifier information</p>
<p>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<pre>
#include &lt;openssl/srp.h&gt;</pre>
<pre>
SRP_VBASE *SRP_VBASE_new(char *seed_key);
void SRP_VBASE_free(SRP_VBASE *vb);</pre>
<pre>
int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file);</pre>
<pre>
int SRP_VBASE_add0_user(SRP_VBASE *vb, SRP_user_pwd *user_pwd);
SRP_user_pwd *SRP_VBASE_get1_by_user(SRP_VBASE *vb, char *username);
SRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username);</pre>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>The <code>SRP_VBASE_new()</code> function allocates a structure to store server side SRP
verifier information.
If <strong>seed_key</strong> is not NULL a copy is stored and used to generate dummy parameters
for users that are not found by SRP_VBASE_get1_by_user(). This allows the server
to hide the fact that it doesn't have a verifier for a particular username,
as described in section 2.5.1.3 'Unknown SRP' of <a href="http://www.ietf.org/rfc/rfc5054.txt" class="rfc">RFC 5054</a>.
The seed string should contain random NUL terminated binary data (therefore
the random data should not contain NUL bytes!).</p>
<p>The <code>SRP_VBASE_free()</code> function frees up the <strong>vb</strong> structure.
If <strong>vb</strong> is NULL, nothing is done.</p>
<p>The <code>SRP_VBASE_init()</code> function parses the information in a verifier file and
populates the <strong>vb</strong> structure.
The verifier file is a text file containing multiple entries, whose format is:
flag base64(verifier) base64(salt) username gNid userinfo(optional)
where the flag can be 'V' (valid) or 'R' (revoked).
Note that the base64 encoding used here is non-standard so it is recommended
to use <em>openssl-srp(1)</em> to generate this file.</p>
<p>The SRP_VBASE_add0_user() function adds the <strong>user_pwd</strong> verifier information
to the <strong>vb</strong> structure. See <em>SRP_user_pwd_new(3)</em> to create and populate this
record.
The library takes ownership of <strong>user_pwd</strong>, it should not be freed by the caller.</p>
<p>The SRP_VBASE_get1_by_user() function returns the password info for the user
whose username matches <strong>username</strong>. It replaces the deprecated
<code>SRP_VBASE_get_by_user()</code>.
If no matching user is found but a seed_key and default gN parameters have been
set, dummy authentication information is generated from the seed_key, allowing
the server to hide the fact that it doesn't have a verifier for a particular
username. When using SRP as a TLS authentication mechanism, this will cause
the handshake to proceed normally but the first client will be rejected with
a &quot;bad_record_mac&quot; alert, as if the password was incorrect.
If no matching user is found and the seed_key is not set, NULL is returned.
Ownership of the returned pointer is released to the caller, it must be freed
with <code>SRP_user_pwd_free()</code>.</p>
<p>
</p>
<hr />
<h1><a name="return_values">RETURN VALUES</a></h1>
<p><code>SRP_VBASE_init()</code> returns <strong>SRP_NO_ERROR</strong> (0) on success and a positive value
on failure.
The error codes are <strong>SRP_ERR_OPEN_FILE</strong> if the file could not be opened,
<strong>SRP_ERR_VBASE_INCOMPLETE_FILE</strong> if the file could not be parsed,
<strong>SRP_ERR_MEMORY</strong> on memory allocation failure and <strong>SRP_ERR_VBASE_BN_LIB</strong>
for invalid decoded parameter values.</p>
<p>SRP_VBASE_add0_user() returns 1 on success and 0 on failure.</p>
<p>
</p>
<hr />
<h1><a name="see_also">SEE ALSO</a></h1>
<p><em>openssl-srp(1)</em>,
<em>SRP_create_verifier(3)</em>,
<em>SRP_user_pwd_new(3)</em>,
<em>SSL_CTX_set_srp_password(3)</em></p>
<p>
</p>
<hr />
<h1><a name="history">HISTORY</a></h1>
<p>The SRP_VBASE_add0_user() function was added in OpenSSL 3.0.</p>
<p>All other functions were added in OpenSSL 1.0.1.</p>
<p>
</p>
<hr />
<h1><a name="copyright">COPYRIGHT</a></h1>
<p>Copyright 2018 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>