如何解释AcquireCredentialsHandle(Kerberos)返回的到期日期?

时间:2012-06-14 07:45:17

标签: winapi kerberos sspi

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,它是什么?

0 个答案:

没有答案