Verifies that an X.509 certificate is currently valid.
Public Declare Function X509_CertIsValidNow Lib "diCrPKI.dll"
(ByVal strCertFile As String, ByVal nOptions As Long) As Long
nRet = X509_CertIsValidNow(strCertFile, nOptions)
long __stdcall X509_CertIsValidNow(const char *szCertFile, long nOptions);
Zero (0) if the certificate is valid at the current time.
If the certificate has expired or is not yet valid, the return value is
PKI_X509_EXPIRED (+16 = EXPIRED_ERROR
);
otherwise it returns a positive error code.
static bool dipki::X509::CertIsValidNow (const std::string &certFile)
static X509.cert_is_valid_now(certfile)
Note that the return value for "success" is zero, not "true". Uses the system clock. The certificate may be in binary DER format or base64 PEM format.
[Changed in v12.0] If the certificate is otherwise of correct format but has expired or is not yet valid, this function returns EXPIRED_ERROR (16). Previous versions would return -1.
Dim nRet As Long Dim strCertName As String strCertName = "myca.cer" nRet = X509_CertIsValidNow(strCertName, 0) Debug.Print "X509_CertIsValidNow returns " & nRet & " for " & strCertName
X509_VerifyCert X509_ValidatePath X509_CertThumb