I have to implement an TLS handshake process using the SSPI interface.
My app implements the client side, and as I saw from here the general flow is:
- InitializeSecurityContext - first call return a pointer to a SecBufferDesc structure.
- Call to send( =WinSock API) function with the output buffers.
- Call to recv function
- Call to InitializeSecurityContext again with the buffers.
The MSDN explanation about these buffers:
"On calls to this function after the initial call, there must be two buffers. The first has type SECBUFFER_TOKEN and contains the token received from the server. The second buffer has type SECBUFFER_EMPTY; set both the pvBuffer and cbBuffer members to zero."
My questions:
- I need some more explanation: what is the meaning of the buffers? what does the second buffer contain? what are they for?
- In the MSDN is written that the TargetDataRep input parameter of InitializeSecurityContext function is nut used for Schannel, but many samples that I saw set it to SECURITY_NATIVE_DREP. what is SECURITY_NATIVE_DREP flag? why does the MSDN say to set it to zero?
I will realy appreciate any help.
Thanks!.