Find Certificate Expiration Date / Time
ASP script to show the time validity of a certificate, and the valid-from and valid-to dates.
<html>
<head>
<title>Determine if a certificate is expired</title>
</head>
<body>
<%
' Get an object to create a certificate store object
set ccs = Server.CreateObject("Chilkat_9_5_0.CreateCS")
' Open the local machine certificate store.
set certStore = ccs.OpenLocalSystemStore()
' Iterate over the certificates
for i = 0 to certStore.NumCertificates - 1
set cert = certStore.GetCertificate(i)
' Show the name of the certificate and whether it is expired.
Response.write cert.SubjectCN & ": "
if cert.IsExpired() = 1 then
Response.Write "EXPIRED"
else
Response.Write "Not Expired"
end if
Response.Write ", Valid from " & cert.ValidFrom & " to " & cert.ValidTo
Response.Write "<br><br>"
next
%>
</body>
</html>
|