天天看點

winhttp 通路https,winhttp https擷取錯誤12044

winhttp 通路https,winhttp https擷取錯誤12044

I use winhttp api to sendrequest to server,but I income the problem, I got 12044 error, I find the error is ERROR_WINHTTP_CLIENT_AUTH_CERT_NEEDED. Any one know how to solve it?

hConnect = WinHttpConnect(hOpen, L"raw.github.com", INTERNET_DEFAULT_HTTPS_PORT, 0);

if (!hConnect) {

wprintf(L"WinHttpConnect failed (0x%.8X)\n", GetLastError());

break;

}

LPCWSTR types[2];

types[0] = L"text/html";

types[1] = 0;

// use flag WINHTTP_FLAG_SECURE to initiate SSL

hRequest = WinHttpOpenRequest(hConnect, L"GET", L"zpfzzz/test/master/README.md",

NULL, WINHTTP_NO_REFERER, &types[0], WINHTTP_FLAG_SECURE);

解決方案There is a nice explanation and suggestion for a solution in MSDN here.

Basically, upon receipt of this error, you open your MY store using cryptoapi and specify an identification certificate you need to have there.