Another reason for AcquireCredentialsHandle to fail with
SEC_E_INTERNAL_ERROR...
I've been writing an SSL socket server in C++ and testing it on XP
SP2. I couldn't get past AcquireCredentialsHandle - it seemed that
whatever I did it failed with SEC_E_INTERNAL_ERROR.
Eventually I dusted off an old platform sdk cd, installed the samples,
and compiled the SSPI\SSL\WebServer demo. Rather to my suprise it
worked fine, successfully using the certificate I'd cobbled together
with makecert, etc. And of course its call to
AcquireCredentialsHandle succeeded.
I examined the difference between my code, and the psdk sample. The
only additional thing I was doing was calling QuerySecurityPackageInfo
for the 'SChannel' package, before eventually calling
AcquireCredentialsHandle (on the UNISP_NAME one) - which was failing
with SEC_E_INTERNAL_ERROR
I removed the call to QuerySecurityPackageInfo (I'd only put it in,
some time ago, for debugging purposes), and AcquireCredentialsHandle
started working.
The bottom line - if AcquireCredentialsHandle is failing with
SEC_E_INTERNAL_ERROR, check whether you've previously called
QuerySecurityPackageInfo for a different package. If you have, maybe
that's why you're getting the error.
Hopefully some people will find this post useful. It'll also help me
if I ever have to do this SSPI/SChannel stuff again!
--
Colin
date: Wed, 10 Sep 2008 07:32:19 -0700 (PDT)
author: Colin