Thanks for such a fast reply. I think that I'm still missing something about
the parameters to PEM_read_PrivateKey and the callback.
Based on what I learned from a posting from a few days ago, I am calling
PEM_read_PrivateKey(fp, x, cb, u) where the parameters are:
fp: file pointer
x: pointer for in object, leasve it NULL
cb: callback for passphrase (only needed for private key)
u: parameter passed to callback
and I am segmenting on (i think) u. What is u supposed to be? I've looked in
the pem.h and pem_lib.c files, but they get really complicated really fast.
I've tried passing null pointers, character strings, char **'s, SSL_CTX *'s,
SSL *'s, and so on, but I though maybe I'd be better off passing the right
sort of thing.
Thanks!
> -----Original Message-----
> From: Wallace, William [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, September 06, 2000 12:55 PM
> To: '[EMAIL PROTECTED]'
> Cc: Terry Solins
> Subject: RE: How to use the private key password callback?
>
>
> Try something like this in the callback body:
>
> buf[0] = '\0';
>
> // Get the password however you want to. If the operation
> fails return 0.
>
> strcpy( buf, password );
> return strlen( buf );
>
> I think size is the length of buf if you want to make overflow checks.
>
> > -----Original Message-----
> > From: Randall Ward [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, September 06, 2000 12:45 PM
> > To: [EMAIL PROTECTED]
> > Cc: Terry Solins
> > Subject: How to use the private key password callback?
> >
> >
> > I need to use a client's private key for a project I am
> > working on, but I am
> > having trouble understanding how to automagically input the
> > password to open
> > the key file. Right now the client blocks waiting for the
> > pass from keyboard
> > input.
> >
> > I am trying to use PEM_read_PrivateKey(...), and I have this
> > prototype for
> > the associated callback:
> >
> > int cb(char *buf, int size, int rwflag, void *userdata);
> >
> > I sort of know what the parameters mean, but I have no idea
> > what to do in
> > the body of the function. This is probably a really simple
> > task, but I'm
> > missing an important bit of information. Do I assign buf to
> > some field in
> > the SSL structs? Is there a predefined function(s) that I
> > need to call? Are
> > there some header files that I could be looking at?
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]