Search code examples
windowskerberosntlm

AcquireCredentialsHandle returns SEC_E_SECPKG_NOT_FOUND


When attempting to retrieve the credential handler on Windows 10, I get this error no matter what I provide the function for the security package. Kerberos is the default on Windows systems so I am attempting to make the following call:

SEC_WINNT_AUTH_IDENTITY *ident = NULL; // this is filled in with valid credentials static CredHandle credHandle;

AcquireCredentialsHandle( NULL, "Kerberos", SECPKG_CRED_OUTBOUND, NULL, (void*)ident, NULL, NULL, &credHandle, NULL );

I've verified in my registry that Kerberos is present with other security packages. It does not matter which package I try to use (Kerberos, SChannel, NTLM, etc), I keep getting the same error.


Solution

  • I discovered what the issue was. There is a UTF-8 to UTF-16 conversion issue with just using a string such as "Negotiate". In order to resolve this the following must be used in place of a plain string: (TCHAR*)TEXT("Negotiate")