[英]how to configure the AcquireCredentialsHandleA correctly
我正在嘗試設置Windows SSPI程序以讀取對當前用戶的身份驗證( https://docs.microsoft.com/zh-cn/windows/win32/api/sspi/nf-sspi-acquirecredentialshandlea )。
奇怪的是,它無法正常工作,並給我一個錯誤。
//ERROR DETAILS
// MessageId: SEC_E_INVALID_TOKEN
//
// MessageText:
//
// The token supplied to the function is invalid
//
#define SEC_E_INVALID_TOKEN HRESULT_TYPEDEF(0x80090308L)
我想出的代碼如下。
// Create an SSPI credential.
Status = g_pSSPI->AcquireCredentialsHandleA(
pN, // Name of principal
ppPackageInfo[2].Name,//sec_package_name.c_str,
SECPKG_CRED_OUTBOUND, // Flags indicating use
NULL, // Pointer to logon ID
cred_ptr, // Package specific data
NULL, // Pointer to GetKey() func
NULL, // Value to pass to GetKey()
phCreds, // (out) Cred Handle
&tsExpiry // (out) Lifetime (optional)
);
我無法理解如何在此處提供憑據的詳細信息。 我想在這里使用kerberos。
cred_ptr應該是指向https://docs.microsoft.com/zh-cn/windows/win32/api/credssp/ns-credssp-credssp_cred的指針,但是MSDN只是說
pSpnegoCred
指向一組協商憑證的指針。
我如何准確填寫? 有人對此有更好的了解嗎?
感謝您的時間。
如果使用kerberos提供程序,則您傳遞的是SEC_WINNT_AUTH_IDENTITY,而不是CREDSSP_CRED。
看一下AcquireCredentialsHandle(Kerberos) ,您正在查看的頁面是CredSSP的頁面,但不清楚。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.