Windows SSPI调用AcquireCredentialsHandle
返回一个时间戳,指示凭据句柄何时到期。文档似乎在说TimeStamp
结构应该与FILETIME
结构具有相同的格式。但是,当我将此函数与“Kerberos”包一起使用时,结果在被视为FILETIME
时没有任何意义:
#include <stdio.h>
#define SECURITY_WIN32
#include <windows.h>
#include <security.h>
int main() {
TimeStamp expiry;
int aquireCode;
CredHandle credHandle;
BOOL timeOk;
SYSTEMTIME sysTime;
aquireCode = AcquireCredentialsHandle(
NULL,
"Kerberos",
SECPKG_CRED_OUTBOUND,
NULL,
NULL,
NULL,
NULL,
&credHandle,
&expiry);
printf("result = %d\n", aquireCode);
printf("upper = %d (%X)\n", expiry.HighPart, expiry.HighPart);
printf("lower = %d (%X)\n", expiry.LowPart, expiry.LowPart);
timeOk = FileTimeToSystemTime((FILETIME*)&expiry, &sysTime);
printf("time covert ok = %d\n", timeOk);
printf("%4d/%02d/%02d %02d:%02d:%02d\n", sysTime.wYear, sysTime.wMonth, sysTime.wDay, sysTime.wHour, sysTime.wMinute, sysTime.wSecond);
}
在我的系统上,打印:
result = 0
upper = 2147483530 (7FFFFF8A)
lower = -1488801793 (A742AFFF)
time covert ok = 1
30828/09/13 12:48:05
如果它不是FILETIME
,它是什么?