SRP_CREATE_VERIFIER(3ossl)

๐Ÿ“ฆ
version 15.1 ยท 3 versions
, in freebsd 15.1

๐Ÿ’… SRP_CREATE_VERIFIER ๐Ÿ’…

okay so bestie, welcome to the SRP_CREATE_VERIFIER(3ossl) page โ€” it's part of the OpenSSL manual, and it's all about the SRP authentication primitives. yes, that SRP. Secure Remote Password. the whole friend group of functions that make a password verifier happen. ๐ŸŽ€

Also real talk up front: all of these are deprecated, and there's genuinely nothing to replace them with. not a "use this instead" situation. just... deprecated. ๐Ÿ’€ keep that in mind, iykyk.


โœจ NAME โœจ

So the whole squad on this page is: SRP_create_verifier_ex, SRP_create_verifier, SRP_create_verifier_BN_ex, SRP_create_verifier_BN, SRP_check_known_gN_param, and SRP_get_default_gN.

Together? They're the SRP authentication primitives. that's the vibe. ๐Ÿ‘‘


๐ŸŒธ SYNOPSIS ๐ŸŒธ

first things first, you gotta include the header, obviously:

#include <openssl/srp.h>
๐Ÿซถ heads up bestie: the functions below have been deprecated since OpenSSL 3.0, and you can hide them entirely by defining OPENSSL_API_COMPAT with a suitable version value โ€” see openssl_user_macros(7).

here's the full lineup, character for character, no cap:

int SRP_create_verifier_BN_ex(const char *user, const char *pass, BIGNUM **salt,
                              BIGNUM **verifier, const BIGNUM *N,
                              const BIGNUM *g, OSSL_LIB_CTX *libctx,
                              const char *propq);
char *SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt,
                             BIGNUM **verifier, const BIGNUM *N, const BIGNUM *g);
char *SRP_create_verifier_ex(const char *user, const char *pass, char **salt,
                             char **verifier, const char *N, const char *g,
                             OSSL_LIB_CTX *libctx, const char *propq);
char *SRP_create_verifier(const char *user, const char *pass, char **salt,
                          char **verifier, const char *N, const char *g);

char *SRP_check_known_gN_param(const BIGNUM *g, const BIGNUM *N);
SRP_gN *SRP_get_default_gN(const char *id);

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

All of the functions described on this page are deprecated. and like, there are no available replacement functions at this time. none. nada. so yeah. ๐Ÿ˜ญ say it with me: deprecated, deprecated, deprecated.

๐Ÿงš the verifier-makers

SRP_create_verifier_BN_ex() creates an SRP password verifier from the parameters you hand it, exactly as defined in section 2.4 of RFC 5054, and it does it using the library context libctx and the property query string propq. any cryptographic algorithms that need to be fetched will use that libctx and propq. if you wanna go deeper, check out "ALGORITHM FETCHING" in crypto(7). โญ

SRP_create_verifier_BN() is literally the same as SRP_create_verifier_BN_ex() except it uses the default library context and property query string. that's the only difference. slay. ๐Ÿ’…

On successful exit, *verifier will point to a newly allocated BIGNUM containing the verifier, and โ€” if a salt was not provided โ€” *salt will be populated with a newly allocated BIGNUM containing a random salt. but if *salt is not NULL, then the provided salt is used instead. ๐Ÿง‚ and bestie, the caller is responsible for freeing the allocated *salt and *verifier BIGNUMs (use BN_free(3)). don't forget, that's an actual leak otherwise.

๐ŸŒˆ the base64 one (historical, dw)

SRP_create_verifier() is similar to SRP_create_verifier_BN(), but all numeric parameters are in a non-standard base64 encoding โ€” originally designed for compatibility with libsrp. it's mainly here for historical compatibility, and its use is discouraged. ๐Ÿ”ฅ like it's iconic in a museum-piece way but please don't.

You can pass NULL as N and an SRP group id as g instead, to load the appropriate gN values (see SRP_get_default_gN()). and if both N and g are NULL, the 8192-bit SRP group parameters are used. ๐Ÿ‘‘

For this one, the caller is responsible for freeing the allocated *salt and *verifier (use OPENSSL_free(3) โ€” note that's OPENSSL_free, not BN_free, this is the string-ish one, okay? ๐Ÿ‘€).

๐Ÿ“ the checker and the getter

SRP_check_known_gN_param() checks that g and N are valid SRP group parameters from RFC 5054 appendix A. vibe check for your group params. โœจ

SRP_get_default_gN() returns the gN parameters for the RFC 5054 id SRP group size. the known ids are "1024", "1536", "2048", "3072", "4096", "6144" and "8192". that's the whole list, memorize it or screenshot it bestie. ๐Ÿ“ธ


๐Ÿ’– RETURN VALUES ๐Ÿ’–

  • SRP_create_verifier_BN_ex() and SRP_create_verifier_BN() return 1 on success and 0 on failure.
  • SRP_create_verifier_ex() and SRP_create_verifier() return NULL on failure and a non-NULL value on success: "*" if N is not NULL, the selected group id otherwise. this value should not be freed. ๐Ÿ™ˆ
  • SRP_check_known_gN_param() returns the text representation of the group id (i.e. the prime bit size), or NULL if the arguments are not valid SRP group parameters. this value should not be freed. (again!! do not free it!!)
  • SRP_get_default_gN() returns NULL if id is not a valid group size, or the 8192-bit group parameters if id is NULL.

๐ŸŽ€ EXAMPLES ๐ŸŽ€

okay here's the moment you've been waiting for โ€” generate and store an 8192 bit password verifier (error handling omitted for clarity, because we're keeping it cute and readable ๐Ÿซถ):

#include <openssl/bn.h>
#include <openssl/srp.h>

const char *username = "username";
const char *password = "password";

SRP_VBASE *srpData = SRP_VBASE_new(NULL);

SRP_gN *gN = SRP_get_default_gN("8192");

BIGNUM *salt = NULL, *verifier = NULL;
SRP_create_verifier_BN_ex(username, password, &salt, &verifier, gN->N, gN->g,
                          NULL, NULL);

SRP_user_pwd *pwd = SRP_user_pwd_new();
SRP_user_pwd_set1_ids(pwd, username, NULL);
SRP_user_pwd_set0_sv(pwd, salt, verifier);
SRP_user_pwd_set_gN(pwd, gN->g, gN->N);

SRP_VBASE_add0_user(srpData, pwd);

it's giving main character energy, honestly. ๐ŸŒŸ


๐Ÿ”ฎ SEE ALSO ๐Ÿ”ฎ

go read these next, bestie, they're the supporting cast:


โญ HISTORY โญ

  • SRP_create_verifier_BN_ex() and SRP_create_verifier_ex() were introduced in OpenSSL 3.0.
  • All other functions were added in OpenSSL 1.0.1.
  • All of these functions were deprecated in OpenSSL 3.0. (yes, again. it's important. ๐Ÿ˜ญ)

Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (the "License"). 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 <https://www.openssl.org/source/license.html>.


and that's the whole page, diva ๐Ÿ’œ โ€” this was SRP_CREATE_VERIFIER(3ossl) from OpenSSL version 3.5.6, dated 2026-04-07. go forth andโ€ฆ honestly, maybe don't use these, they're deprecated. but now you understand them, and that's the whole point. mwah. ๐Ÿซถโœจ

๐Ÿ“ฆ where this page comes from