5 SRP_create_verifier_ex,
7 SRP_create_verifier_BN_ex,
8 SRP_create_verifier_BN,
9 SRP_check_known_gN_param,
11 - SRP authentication primitives
15 #include <openssl/srp.h>
17 int SRP_create_verifier_BN_ex(const char *user, const char *pass, BIGNUM **salt,
18 BIGNUM **verifier, const BIGNUM *N,
19 const BIGNUM *g, OSSL_LIB_CTX *libctx,
21 char *SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt,
22 BIGNUM **verifier, const BIGNUM *N, const BIGNUM *g);
23 char *SRP_create_verifier_ex(const char *user, const char *pass, char **salt,
24 char **verifier, const char *N, const char *g,
25 OSSL_LIB_CTX *libctx, const char *propq);
26 char *SRP_create_verifier(const char *user, const char *pass, char **salt,
27 char **verifier, const char *N, const char *g);
29 char *SRP_check_known_gN_param(const BIGNUM *g, const BIGNUM *N);
30 SRP_gN *SRP_get_default_gN(const char *id);
34 The SRP_create_verifier_BN_ex() function creates an SRP password verifier from
35 the supplied parameters as defined in section 2.4 of RFC 5054 using the library
36 context I<libctx> and property query string I<propq>. Any cryptographic
37 algorithms that need to be fetched will use the I<libctx> and I<propq>. See
38 L<provider(7)/Fetching algorithms>.
40 SRP_create_verifier_BN() is the same as SRP_create_verifier_BN_ex() except the
41 default library context and property query string is used.
43 On successful exit I<*verifier> will point to a newly allocated BIGNUM containing
44 the verifier and (if a salt was not provided) I<*salt> will be populated with a
45 newly allocated BIGNUM containing a random salt. If I<*salt> is not NULL then
46 the provided salt is used instead.
47 The caller is responsible for freeing the allocated I<*salt> and I<*verifier>
48 BIGNUMS (use L<BN_free(3)>).
50 The SRP_create_verifier() function is similar to SRP_create_verifier_BN() but
51 all numeric parameters are in a non-standard base64 encoding originally designed
52 for compatibility with libsrp. This is mainly present for historical compatibility
53 and its use is discouraged.
54 It is possible to pass NULL as I<N> and an SRP group id as I<g> instead to
55 load the appropriate gN values (see SRP_get_default_gN()).
56 If both I<N> and I<g> are NULL the 8192-bit SRP group parameters are used.
57 The caller is responsible for freeing the allocated I<*salt> and I<*verifier>
58 (use L<OPENSSL_free(3)>).
60 The SRP_check_known_gN_param() function checks that I<g> and I<N> are valid
61 SRP group parameters from RFC 5054 appendix A.
63 The SRP_get_default_gN() function returns the gN parameters for the RFC 5054 I<id>
65 The known ids are "1024", "1536", "2048", "3072", "4096", "6144" and "8192".
69 SRP_create_verifier_BN_ex() and SRP_create_verifier_BN() return 1 on success and
72 SRP_create_verifier_ex() and SRP_create_verifier() return NULL on failure and a
73 non-NULL value on success:
74 "*" if I<N> is not NULL, the selected group id otherwise. This value should
77 SRP_check_known_gN_param() returns the text representation of the group id
78 (i.e. the prime bit size) or NULL if the arguments are not valid SRP group parameters.
79 This value should not be freed.
81 SRP_get_default_gN() returns NULL if I<id> is not a valid group size,
82 or the 8192-bit group parameters if I<id> is NULL.
86 Generate and store a 8192 bit password verifier (error handling
89 #include <openssl/bn.h>
90 #include <openssl/srp.h>
92 const char *username = "username";
93 const char *password = "password";
95 SRP_VBASE *srpData = SRP_VBASE_new(NULL);
97 SRP_gN *gN = SRP_get_default_gN("8192");
99 BIGNUM *salt = NULL, *verifier = NULL;
100 SRP_create_verifier_BN_ex(username, password, &salt, &verifier, gN->N, gN->g,
103 SRP_user_pwd *pwd = SRP_user_pwd_new();
104 SRP_user_pwd_set1_ids(pwd, username, NULL);
105 SRP_user_pwd_set0_sv(pwd, salt, verifier);
106 SRP_user_pwd_set_gN(pwd, gN->g, gN->N);
108 SRP_VBASE_add0_user(srpData, pwd);
114 L<SRP_user_pwd_new(3)>
118 These functions were added in OpenSSL 1.0.1.
122 Copyright 2018-2020 The OpenSSL Project Authors. All Rights Reserved.
124 Licensed under the Apache License 2.0 (the "License"). You may not use
125 this file except in compliance with the License. You can obtain a copy
126 in the file LICENSE in the source distribution or at
127 L<https://www.openssl.org/source/license.html>.