> How to get/check a SSL certificate expiration date (or other certificate 
> info) after the SslContext is initialized?

This code is from my web server, CertInfo was added to ICS V8 last October, so 
you
will need the latest overnight zip or from SVN. 

var
MyCert: TX509Ex;

MyCert := TX509Ex.Create(self); 
try
    MyCert.LoadFromPemFile (HttpSslContext.SslCertFile); 
    StatSrvSslCert := MyCert.CertInfo ;
    if (Date + 30) > MyCert.ValidNotAfter then begin
        SendAdminEmail (AdminEmailTo, 'Server SSL Certificate Exprires
             Shortly', StatSrvSslCert + CRLF) ;
    end;
finally
    MyCert.Free ;
end;

TX509Ex has properties to get all the main certificate elements, CertInfo is the
quick way to this block: 

Issued to: www.telecom-tariffs.co.uk,
Alt Domains: www.telecom-tariffs.co.uk, telecom-tariffs.co.uk
Issuer: RapidSSL SHA256 CA - G3, GeoTrust Inc.
Expires: 11/11/2016, Signature: sha256WithRSAEncryption
Public Key: rsaEncryption 2048 bits

Angus

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to