This example consists of two files - ClientCertificate.xls and cc.asp. The latter has to be installed on an SSL-secured branch of a Web site that requires client certificates (see instructions on how to set up). The XLS file contains the code to tear the cc.asp file using a client certificate installed for the current interactive user (see instructions).
' Christoph Wille 07/13/1999, email@example.com Option Explicit ' change the sample URL here... Const strTestCCSecuredURL = "https://184.108.40.206/AspTear/SSL/cc.asp" Sub TestSSL() Dim xObj As Object, strResult As String, bErrors As Boolean ' create the object Set xObj = CreateObject("SOFTWING.ASPtear") On Error Resume Next xObj.TrustUnknownCA = True ' you can force an invalid CN error by changing the "strTestCCSecuredURL" to the IP address ' of www.zauner.at (as the certificate was issued for the name and not the IP address). Please ' note that there is no cc.asp on the zauner.at server - you can test only for certificate ' validity there xObj.IgnoreInvalidCN = True ' this is a new flag for AspTear 1.2 - it allows us to ignore invalid ' server certificate dates (cert's that are no longer valid - useful for test certificates) xObj.IgnoreInvalidCertDate = True ' tell the object to send the first certificate it finds for the current user account xObj.SendClientCertificate = True strResult = xObj.Retrieve(strTestCCSecuredURL, Request_GET, "", "", "") bErrors = HandleError() If Not bErrors Then MsgBox "SSL document was retrieved successfully!" Debug.Print strResult End If End Sub
' Written by Christoph Wille, 13.07.99
If Len(Request.ClientCertificate("Subject")) = 0 Then
Response.Write("No client certificate was presented")
For Each key in Request.ClientCertificate
Response.Write( key & ": " & Request.ClientCertificate(key) & vbCRLF)