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