The CertVerifyCRLTimeValidity function verifies the time validity of a CRL.
#include <wincrypt.h>
LONG WINAPI CertVerifyCRLTimeValidity(
LPFILETIME pTimeToVerify, // in
PCRL_INFO pCRLInfo // in
);
Returns a minus one if the time being verified is before "ThisUpdate". Returns a plus one if the time being verified is after "NextUpdate". Returns zero for valid time for the CRL.
// EXAMPLE CODE FOR USING CertVerifyCRLTimeValidity().
// Verifies the time validity of a CRL. Assume that a pointer to
// the CRL (PCRL_INFO) is already known.
// In this example, the current time is used.
// Set up the variables.
LPFILETIME pTimeToVerify = NULL;// Pointer to the time to be verified
PCRL_INFO pCRLInfo; // Initialized elsewhere
long lResult; // Returned value
// -1 is before ThisUpdate
// 0 for a valid time for the CRL
// +1 if after NextUpdate
lResult= CertVerifyCRLTimeValidity(
pTimeToVerify, // in - NULL means current time
pCRLInfo); // in - Pointer to the CRL
if (lResult == -1){ // time is before "ThisUpdate"
cout<< "time is before ThisUpdate"<< endl;
}
else if (lResult == 0){ // time is valid
cout<< "time is valid"<< endl;
}
else if (lResult == 1){ // time is after "NextUpdate"
cout<< "time is after NextUpdate"<< endl;
}
else { // return value is invalid
cout<< "You should not be here"<< endl;
}
Windows NT: Requires version 4.0 SP3 or later. Available also in IE 3.02 and later.
Windows: Requires Windows 98 (or Windows 95 with IE 3.02 or later).
Windows CE: Unsupported.
Header: Declared in wincrypt.h.
Import Library: Use crypt32.lib.
CertVerifyCRLRevocation, CertVerifyTimeValidity, CertVerifyValidityNesting