CryptoSys PKI Toolkit Manual

X509_CertExpiresOn

Returns the date and time an X.509 certificate expires.

VB6/VBA Syntax

Public Declare Function X509_CertExpiresOn Lib "diCrPKI.dll" (ByVal strCertFile As String, ByVal strOutput As String, ByVal nOutChars As Long, ByVal nOptions As Long) As Long

nRet = X509_CertExpiresOn(strCertFile, strOutput, nOutChars, nOptions)

Parameters

strCertFile
[in] String with the filename of the X.509 certificate (or base64 representation).
strOutput
[out] String to receive the time-date string.
nOutChars
[in] Long specifying the maximum length of the time-date string.
nOptions
[in] Long option flags: not used in this release. Specify zero.

C/C++ Syntax

long _stdcall X509_CertExpiresOn(const char *szCertFile, char *szOutput, long nOutChars, long flags);

Returns (VB6/C)

Long: Returns the number of characters set in strOutput. If nOutChars is zero it returns the maximum number of characters required (currently 20, but don't assume that for future releases). C/C++ users should allocate one extra for the terminating NUL character. If an error occurs, it returns a negative error code.

.NET Equivalent

X509.CertExpiresOn Method

Remarks

The time format is in accordance with ISO 8601 and will always be of the form YYYY-MM-DDThh:mm:ssZ. The time is always given as GMT (Greenwich Mean Time, UTC, Zulu Time).

Example

Dim nRet As Long
Dim strCertName As String
Dim strDateTime As String * 32
 
strCertName = "C:\Test\AliceRSASignByCarl.cer"	' Change your dir to suit
nRet = X509_CertIssuedOn(strCertName, strDateTime, Len(strDateTime), 0)
Debug.Print "X509_CertIssuedOn returns " & nRet & " for " & strCertName & ": " & strDateTime
nRet = X509_CertExpiresOn(strCertName, strDateTime, Len(strDateTime), 0)
Debug.Print "X509_CertExpiresOn returns " & nRet & " for " & strCertName & ": " & strDateTime

Should result in (in all locales):

X509_CertIssuedOn returns 20 for C:\Test\AliceRSASignByCarl.cer: 
1999-09-19T01:08:47Z            
X509_CertExpiresOn returns 20 for C:\Test\AliceRSASignByCarl.cer: 
2039-12-31T23:59:59Z            

See Also

X509_CertIssuedOn X509_CertIsValidNow X509_QueryCert

[Contents] [Index]

[HOME]   [NEXT: X509_CertIssuedOn...]

Copyright © 2004-12 D.I. Management Services Pty Ltd. All rights reserved.