From: Vic L. <ll...@16...> - 2009-09-29 15:29:40
|
Hi, Sorry, I didn't describe the callback function clearly and why I need it. VeNCrypt requires the user to provide certificates to authenticate himself to the server. This is typically a CA root certificate (which identify the server) and the personal certificate (which identify the client). So when we start VeNCrypt, we will need to ask the application to give the certicate file names. This is the same concept as VNC authentication: when we start it, we use a callback to get the VNC password. Let's say I have a program called "TestProg". TestProg will set rfbClient->GetX509Credential to a callback function "X509Callback" defined in TestProg. When VeNCrypt starts, it works this way: 1. libvncclient calls "X509Callback", asking for X509 credentials 2. In function "X509Callback", TestProg will popup a dialog and ask the user to choose the CA certificate and Personal certificate. In my program I will also provide an option for users to save the certificates so that popup is not needed next time. 3. When user confirms it, TestProg will malloc a struct, store the files in the struct, and return the struct to libvncclient. 4. Then libvncclient get the file names, and start the actual authentication using those certificates. The whole thing should be actually working the same way as GetPasswordProc. Thanks, Vic On Tue, 2009-09-29 at 17:13 +0200, Johannes Schindelin wrote: > Hi, > > On Tue, 29 Sep 2009, Vic Lee wrote: > > > If we use GetX509CredentialProc to set the members, we can't define the > > struct as private. We must define it in rfbclient.h file otherwise the > > caller can't find the struct members. > > > > Maybe we can define the callback like this: > > > > struct x509Cred* GetX509CredentialProc (rfbClient *client); > > > > Then we define struct x509Cred in rfbclient.h: > > > > struct x509Cred > > { > > char *x509cacert; > > .... > > }; > > > > Then the caller function just malloc it, set the members and return the > > pointers. We even don't need to store it in rfbClient. This way looks > > better. How is it? > > I probably missed something. When is this proc needed, why does it need > to be a proc, and whose responsibility is it to provide it? > > Ciao, > Dscho > |