Hi,


Isaac Foraker wrote:
<snip>

> I found this callback definition:
>
> int cbPasswd(char *buf, int size, int rwflag, void *userdata);

char *buf = buffer from which the password will be read
                  to use with the key.
int size    = length of buffer in which password will be read.
in rwflag  = don't know :-( (source code shows it is passed as 0)
void *userdata = this parameter you can use to send the actual
                 password to this callback function. OR you can
                 ignore this parameter in the implementation and
                 read the password directly into *buf.
                 If you want to send the password as parameter to
                 the callback function, use following function
void SSL_CTX_set_default_passwd_cb_userdata(SSL_CTX *ctx, void *u);

example code could be :
// set password callback
 SSL_CTX_set_default_passwd_cb(pCtx, SSLCallbackPassword);

// set userdata
 SSL_CTX_set_default_passwd_cb_userdata(pCtx, password);

and the callback function can be

int SSLCallbackPassword((char *buf, int len, int size, void *password)
{
 strcpy(buf,(char *)(password));
 return(strlen(buf));
}

HTH,
Mandar

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to