Added SRP_VBASE_add0_user()
[openssl.git] / doc / man3 / SRP_VBASE_new.pod
1 =pod
2
3 =head1 NAME
4
5 SRP_VBASE_new,
6 SRP_VBASE_free,
7 SRP_user_pwd_free,
8 SRP_VBASE_init,
9 SRP_VBASE_add0_user,
10 SRP_VBASE_get1_by_user,
11 SRP_VBASE_get_by_user
12 - Functions to create and manage a stack of SRP user verifier information
13
14 =head1 SYNOPSIS
15
16  #include <openssl/srp.h>
17
18  SRP_VBASE *SRP_VBASE_new(char *seed_key);
19  void SRP_VBASE_free(SRP_VBASE *vb);
20  void SRP_user_pwd_free(SRP_user_pwd *user_pwd);
21
22  int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file);
23
24  int SRP_VBASE_add0_user(SRP_VBASE *vb, SRP_user_pwd *user_pwd);
25  SRP_user_pwd *SRP_VBASE_get1_by_user(SRP_VBASE *vb, char *username);
26  SRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username);
27
28 =head1 DESCRIPTION
29
30 The SRP_VBASE_new() function allocates a structure to store server side SRP
31 verifier information. If B<seed_key> is not NULL a copy is stored and used to
32 generate dummy parameters for users that are not found by SRP_VBASE_get1_by_user().
33 This allows the server to hide the fact that it doesn't have a verifier for a
34 particular username, as described in section 2.5.1.3 'Unknown SRP' of RFC 5054.
35 The seed string should contain random NUL terminated binary data (therefore
36 the random data should not contain NUL bytes!).
37
38 The SRP_VBASE_free() function frees up the B<vb> structure.
39 If B<vb> is NULL, nothing is done.
40
41 The SRP_user_pwd_free() function frees up the B<user_pwd> structure.
42 If B<user_pwd> is NULL, nothing is done.
43
44 The SRP_VBASE_init() function parses the information in a verifier file and
45 populates the B<vb> structure.
46 The verifier file is a text file containing multiple entries, whose format is:
47 flag base64(verifier) base64(salt) username gNid userinfo(optional)
48 where the flag can be 'V' (valid) or 'R' (revoked).
49 Note that the base64 encoding used here is non-standard so it is recommended
50 to use L<srp(1)> to generate this file.
51
52 The SRP_VBASE_add0_user() function adds the B<user_pwd> verifier information
53 to the B<vb> structure.
54 The library takes ownership of B<user_pwd>, it should not be freed by the caller.
55
56 The SRP_VBASE_get1_by_user() function returns the password info for the user
57 whose username matches B<username>. It replaces the deprecated
58 SRP_VBASE_get_by_user().
59 If no matching user is found but a seed_key and default gN parameters have been
60 set, dummy authentication information is generated from the seed_key, allowing
61 the server to hide the fact that it doesn't have a verifier for a particular
62 username. When using SRP as a TLS authentication mechanism, this will cause
63 the handshake to proceed normally but the first client will be rejected with
64 a "bad_record_mac" alert, as if the password was incorrect.
65 If no matching user is found and the seed_key is not set, NULL is returned.
66 Ownership of the returned pointer is released to the caller, it must be freed
67 with SRP_user_pwd_free().
68
69 =head1 RETURN VALUES
70
71 SRP_VBASE_init() returns B<SRP_NO_ERROR> (0) on success and a positive value
72 on failure.
73 The error codes are B<SRP_ERR_OPEN_FILE> if the file could not be opened,
74 B<SRP_ERR_VBASE_INCOMPLETE_FILE> if the file could not be parsed,
75 B<SRP_ERR_MEMORY> on memory allocation failure and B<SRP_ERR_VBASE_BN_LIB>
76 for invalid decoded parameter values.
77
78 SRP_VBASE_add0_user() returns 1 on success and 0 on failure.
79
80 =head1 SEE ALSO
81
82 L<srp(1)>,
83 L<SRP_create_verifier(3)>,
84 L<SSL_CTX_set_srp_password(3)>
85
86 =head1 HISTORY
87
88 SRP_VBASE_add0_user() was first added to OpenSSL 1.2.0.
89
90 All other functions were first added to OpenSSL 1.0.1.
91
92 =head1 COPYRIGHT
93
94 Copyright 2018 The OpenSSL Project Authors. All Rights Reserved.
95
96 Licensed under the OpenSSL license (the "License").  You may not use
97 this file except in compliance with the License.  You can obtain a copy
98 in the file LICENSE in the source distribution or at
99 L<https://www.openssl.org/source/license.html>.
100
101 =cut