My exact code works on laptop environment but it doesn't work on Windows Mobile device.
And this is what I observed for each HttpSendRequest() call.
(1) First HttpSendRequest() call, ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED is returns. (My code handle as described above - InternetSetOption(hReq, INTERNET_OPTION_CLIENT_CERT_CONTEXT, (LPVOID)pContext2, sizeof(CERT_CONTEXT));)
(2) Second HttpSendRequest() call, device prompts me to enter PIN for the cert. I provide the correct PIN.
(3) this should then return ERROR_INTERNET_INVALID_CA (in my laptop environment) but in mobile device, I get ERROR_INTERNET_CONNECTION_RESET. I even modified the code to make more HttpSendRequest() calls but it keeps returning same ERROR_INTERNET_CONNECTION_RESET
Thanks for sharing your thought. But based on my further testing, I found out that normal SSL connection (one way) works. But when I start providing client cert (two way) I get ERROR_INTERNET_CONNECTION_RESET and never gets ERROR_INTERNET_INVALID_CA.
Is there a protocol or secure channel setting that I need to do in Windows mobiles?