Microsoft Internet Security and Acceleration Server 2000

Assign a Server Certificate from Local Computer Storage to an IP Address

The following VBScript example assigns an SSL server certificate from the local computer storage to an IP address by using the FPCServer object. After you run this script, the IP address on the computer where the certificate is stored will use the certificate for incoming Web requests.

call Install

Sub Install

		Set fpc = CreateObject("FPC.Root")
		Set CurServer = fpc.Arrays(1).Servers(1)
		NL = Chr(13) & Chr(10)
		TAB = Chr(9)
		Set certs = CurServer.SSLServerCertificates
		Dim i
		i = 1
		Dim certificates
		certificates = ""
		For Each cert In certs
			certificates = certificates & _
			i & ":" & NL & _
				"Friendly Name:" & TAB & cert.FriendlyName &   NL & _
			"Issued To:"	 & TAB & cert.IssuedTo &  NL & _
				"Issued By:"	 & TAB & cert.IssuedBy &  NL & _
					"Expires at:"	& TAB & cert.ExpirationDate & NL
			i = i + 1
		Next

		Dim n
		n = InputBox(certificates & "Which certificate do you choose?", "Choose A Server Certificate")
		n = CInt(n)
		if not n > 0 and n < i then
				MsgBox "You chose a wrong number (" & n & ")" & NL & _
					 "Choose a number between 1 and " & i - 1
				Exit Sub
		end if

		Set cert = CurServer.SSLServerCertificates(n)

		MsgBox "You chose " & n & ":" & NL & _
			 "Friendly Name:" & TAB & cert.FriendlyName & NL &_
			 "Issued To:"	 & TAB & cert.IssuedTo & NL & _
			 "Issued By:"	 & TAB & cert.IssuedBy & NL & _
			 "Expires at:"	& TAB & cert.ExpirationDate 

		CurServer.ReverseProxyListenEntries.AllSSLServerCertificate = cert
		CurServer.ReverseProxyListenEntries.Save
		MsgBox "done"
End Sub