.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "SSL_CTX_SET_SRP_PASSWORD 3SSL" .TH SSL_CTX_SET_SRP_PASSWORD 3SSL "2023-10-23" "3.0.11" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" SSL_CTX_set_srp_username, SSL_CTX_set_srp_password, SSL_CTX_set_srp_strength, SSL_CTX_set_srp_cb_arg, SSL_CTX_set_srp_username_callback, SSL_CTX_set_srp_client_pwd_callback, SSL_CTX_set_srp_verify_param_callback, SSL_set_srp_server_param, SSL_set_srp_server_param_pw, SSL_get_srp_g, SSL_get_srp_N, SSL_get_srp_username, SSL_get_srp_userinfo \&\- SRP control operations .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& #include .Ve .PP The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining \fB\s-1OPENSSL_API_COMPAT\s0\fR with a suitable version value, see \fBopenssl_user_macros\fR\|(7): .PP .Vb 10 \& int SSL_CTX_set_srp_username(SSL_CTX *ctx, char *name); \& int SSL_CTX_set_srp_password(SSL_CTX *ctx, char *password); \& int SSL_CTX_set_srp_strength(SSL_CTX *ctx, int strength); \& int SSL_CTX_set_srp_cb_arg(SSL_CTX *ctx, void *arg); \& int SSL_CTX_set_srp_username_callback(SSL_CTX *ctx, \& int (*cb) (SSL *s, int *ad, void *arg)); \& int SSL_CTX_set_srp_client_pwd_callback(SSL_CTX *ctx, \& char *(*cb) (SSL *s, void *arg)); \& int SSL_CTX_set_srp_verify_param_callback(SSL_CTX *ctx, \& int (*cb) (SSL *s, void *arg)); \& \& int SSL_set_srp_server_param(SSL *s, const BIGNUM *N, const BIGNUM *g, \& BIGNUM *sa, BIGNUM *v, char *info); \& int SSL_set_srp_server_param_pw(SSL *s, const char *user, const char *pass, \& const char *grp); \& \& BIGNUM *SSL_get_srp_g(SSL *s); \& BIGNUM *SSL_get_srp_N(SSL *s); \& \& char *SSL_get_srp_username(SSL *s); \& char *SSL_get_srp_userinfo(SSL *s); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" All of the functions described on this page are deprecated. There are no available replacement functions at this time. .PP These functions provide access to \s-1SRP\s0 (Secure Remote Password) parameters, an alternate authentication mechanism for \s-1TLS. SRP\s0 allows the use of usernames and passwords over unencrypted channels without revealing the password to an eavesdropper. \s-1SRP\s0 also supplies a shared secret at the end of the authentication sequence that can be used to generate encryption keys. .PP The \s-1SRP\s0 protocol, version 3 is specified in \s-1RFC 2945. SRP\s0 version 6 is described in \s-1RFC 5054\s0 with applications to \s-1TLS\s0 authentication. .PP The \fBSSL_CTX_set_srp_username()\fR function sets the \s-1SRP\s0 username for \fBctx\fR. This should be called on the client prior to creating a connection to the server. The length of \fBname\fR must be shorter or equal to 255 characters. .PP The \fBSSL_CTX_set_srp_password()\fR function sets the \s-1SRP\s0 password for \fBctx\fR. This may be called on the client prior to creating a connection to the server. This overrides the effect of \fBSSL_CTX_set_srp_client_pwd_callback()\fR. .PP The \fBSSL_CTX_set_srp_strength()\fR function sets the \s-1SRP\s0 strength for \fBctx\fR. This is the minimal length of the \s-1SRP\s0 prime in bits. If not specified 1024 is used. If not satisfied by the server key exchange the connection will be rejected. .PP The \fBSSL_CTX_set_srp_cb_arg()\fR function sets an extra parameter that will be passed to all following callbacks as \fBarg\fR. .PP The \fBSSL_CTX_set_srp_username_callback()\fR function sets the server side callback that is invoked when an \s-1SRP\s0 username is found in a ClientHello. The callback parameters are the \s-1SSL\s0 connection \fBs\fR, a writable error flag \fBad\fR and the extra argument \fBarg\fR set by \fBSSL_CTX_set_srp_cb_arg()\fR. This callback should setup the server for the key exchange by calling \&\fBSSL_set_srp_server_param()\fR with the appropriate parameters for the received username. The username can be obtained by calling \fBSSL_get_srp_username()\fR. See \fBSRP_VBASE_init\fR\|(3) to parse the verifier file created by \fBopenssl\-srp\fR\|(1) or \&\fBSRP_create_verifier\fR\|(3) to generate it. The callback should return \fB\s-1SSL_ERROR_NONE\s0\fR to proceed with the server key exchange, \&\fB\s-1SSL3_AL_FATAL\s0\fR for a fatal error or any value < 0 for a retryable error. In the event of a \fB\s-1SSL3_AL_FATAL\s0\fR the alert flag given by \fB*al\fR will be sent back. By default this will be \fB\s-1SSL_AD_UNKNOWN_PSK_IDENTITY\s0\fR. .PP The \fBSSL_CTX_set_srp_client_pwd_callback()\fR function sets the client password callback on the client. The callback parameters are the \s-1SSL\s0 connection \fBs\fR and the extra argument \fBarg\fR set by \fBSSL_CTX_set_srp_cb_arg()\fR. The callback will be called as part of the generation of the client secrets. It should return the client password in text form or \s-1NULL\s0 to abort the connection. The resulting memory will be freed by the library as part of the callback resolution. This overrides the effect of \fBSSL_CTX_set_srp_password()\fR. .PP The \fBSSL_CTX_set_srp_verify_param_callback()\fR sets the \s-1SRP\s0 gN parameter verification callback on the client. This allows the client to perform custom verification when receiving the server \s-1SRP\s0 proposed parameters. The callback parameters are the \s-1SSL\s0 connection \fBs\fR and the extra argument \fBarg\fR set by \fBSSL_CTX_set_srp_cb_arg()\fR. The callback should return a positive value to accept the server parameters. Returning 0 or a negative value will abort the connection. The server parameters can be obtained by calling \fBSSL_get_srp_N()\fR and \fBSSL_get_srp_g()\fR. Sanity checks are already performed by the library after the handshake (B % N non zero, check against the strength parameter) and are not necessary. If no callback is set the g and N parameters will be checked against known \s-1RFC 5054\s0 values. .PP The \fBSSL_set_srp_server_param()\fR function sets all \s-1SRP\s0 parameters for the connection \fBs\fR. \fBN\fR and \fBg\fR are the \s-1SRP\s0 group parameters, \fBsa\fR is the user salt, \fBv\fR the password verifier and \fBinfo\fR is the optional user info. .PP The \fBSSL_set_srp_server_param_pw()\fR function sets all \s-1SRP\s0 parameters for the connection \fBs\fR by generating a random salt and a password verifier. \&\fBuser\fR is the username, \fBpass\fR the password and \fBgrp\fR the \s-1SRP\s0 group parameters identifier for \fBSRP_get_default_gN\fR\|(3). .PP The \fBSSL_get_srp_g()\fR function returns the \s-1SRP\s0 group generator for \fBs\fR, or from the underlying \s-1SSL_CTX\s0 if it is \s-1NULL.\s0 .PP The \fBSSL_get_srp_N()\fR function returns the \s-1SRP\s0 prime for \fBs\fR, or from the underlying \s-1SSL_CTX\s0 if it is \s-1NULL.\s0 .PP The \fBSSL_get_srp_username()\fR function returns the \s-1SRP\s0 username for \fBs\fR, or from the underlying \s-1SSL_CTX\s0 if it is \s-1NULL.\s0 .PP The \fBSSL_get_srp_userinfo()\fR function returns the \s-1SRP\s0 user info for \fBs\fR, or from the underlying \s-1SSL_CTX\s0 if it is \s-1NULL.\s0 .SH "RETURN VALUES" .IX Header "RETURN VALUES" All SSL_CTX_set_* functions return 1 on success and 0 on failure. .PP \&\fBSSL_set_srp_server_param()\fR returns 1 on success and \-1 on failure. .PP The SSL_get_SRP_* functions return a pointer to the requested data, the memory is owned by the library and should not be freed by the caller. .SH "EXAMPLES" .IX Header "EXAMPLES" Setup \s-1SRP\s0 parameters on the client: .PP .Vb 1 \& #include \& \& const char *username = "username"; \& const char *password = "password"; \& \& SSL_CTX *ctx = SSL_CTX_new(TLS_client_method()); \& if (!ctx) \& /* Error */ \& if (!SSL_CTX_set_srp_username(ctx, username)) \& /* Error */ \& if (!SSL_CTX_set_srp_password(ctx, password)) \& /* Error */ .Ve .PP Setup \s-1SRP\s0 server with verifier file: .PP .Vb 2 \& #include \& #include \& \& const char *srpvfile = "password.srpv"; \& \& int srpServerCallback(SSL *s, int *ad, void *arg) \& { \& SRP_VBASE *srpData = (SRP_VBASE*) arg; \& char *username = SSL_get_srp_username(s); \& \& SRP_user_pwd *user_pwd = SRP_VBASE_get1_by_user(srpData, username); \& if (!user_pwd) \& /* Error */ \& return SSL3_AL_FATAL; \& \& if (SSL_set_srp_server_param(s, user_pwd\->N, user_pwd\->g, \& user_pwd\->s, user_pwd\->v, user_pwd\->info) < 0) \& /* Error */ \& \& SRP_user_pwd_free(user_pwd); \& return SSL_ERROR_NONE; \& } \& \& SSL_CTX *ctx = SSL_CTX_new(TLS_server_method()); \& if (!ctx) \& /* Error */ \& \& /* \& * seedKey should contain a NUL terminated sequence \& * of random non NUL bytes \& */ \& const char *seedKey; \& \& SRP_VBASE *srpData = SRP_VBASE_new(seedKey); \& if (SRP_VBASE_init(srpData, (char*) srpvfile) != SRP_NO_ERROR) \& /* Error */ \& \& SSL_CTX_set_srp_cb_arg(ctx, srpData); \& SSL_CTX_set_srp_username_callback(ctx, srpServerCallback); .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBssl\fR\|(7), \&\fBopenssl\-srp\fR\|(1), \&\fBSRP_VBASE_new\fR\|(3), \&\fBSRP_create_verifier\fR\|(3) .SH "HISTORY" .IX Header "HISTORY" These functions were added in OpenSSL 1.0.1 and deprecated in OpenSSL 3.0. .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright 2018\-2021 The OpenSSL Project Authors. All Rights Reserved. .PP Licensed under the Apache License 2.0 (the \*(L"License\*(R"). You may not use this file except in compliance with the License. You can obtain a copy in the file \s-1LICENSE\s0 in the source distribution or at .