WinHttp cannot open SSL connection as Network Service -> 12185

Rudolf Meier 291 Reputation points
2024-07-08T16:15:56.2166667+00:00

I try to make a WinHttp from my service. This service runs in a restricted account (why? well, everyone tells me, that we should do this, because it is safer... but, it is also enormously complicated to find out how the f... to get access to what we need and why things don't work).

So... WinHttp requests work if they use http. But they don't, when I use https ... I get an error ERROR_WINHTTP_CLIENT_CERT_NO_PRIVATE_KEY (12185) ... now, if I run this service in an other account, it works. So it is a permissions problem. ... what did I try? Well, I tried to set the certificate with WINHTTP_OPTION_CLIENT_CERT_CONTEXT and then I did set a certificate I have access to. And this certificate does have a private key... which I can read (all tested...) but, it seems, that for what reason ever, WinHttp cannot find this key or thinks, that the certificate does not have one...

The question now is -> how to solve that?

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,512 questions
{count} votes