Sample code for 30+ languages & platforms
Classic ASP

Get the Configured Server-Side TLS Certificate

See more Socket/SSL/TLS Examples

Demonstrates Socket.GetMyServerCert, which copies the TLS server certificate configured by InitSslServer into a Cert object.

The file path is relative to the application's current working directory. An absolute path may also be used. Supply the path appropriate to your own environment.

Background. This is intended for a socket acting as a TLS server and returns false when no server certificate has been configured.

Chilkat Classic ASP Downloads

Classic ASP
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
success = 0

set socket = Server.CreateObject("Chilkat.Socket")

'  The file path is relative to the application's current working directory.  An absolute path
'  may also be used.  Supply the path appropriate to your own environment.
'  The PFX password should come from a secure source rather than being hard-coded.
pfxPassword = "myPfxPassword"
set cert = Server.CreateObject("Chilkat.Cert")
success = cert.LoadPfxFile("qa_data/server.pfx",pfxPassword)
If (success = 0) Then
    Response.Write "<pre>" & Server.HTMLEncode( cert.LastErrorText) & "</pre>"
    Response.End
End If

success = socket.InitSslServer(cert)
If (success = 0) Then
    Response.Write "<pre>" & Server.HTMLEncode( socket.LastErrorText) & "</pre>"
    Response.End
End If

'  Copy the TLS server certificate configured by InitSslServer, then inspect it.
set myCert = Server.CreateObject("Chilkat.Cert")
success = socket.GetMyServerCert(myCert)
If (success = 0) Then
    Response.Write "<pre>" & Server.HTMLEncode( socket.LastErrorText) & "</pre>"
    Response.End
End If

Response.Write "<pre>" & Server.HTMLEncode( "Server certificate subject: " & myCert.SubjectCN) & "</pre>"

%>
</body>
</html>