home *** CD-ROM | disk | FTP | other *** search
- <%Response.Expires=0%>
- <HTML>
- <HEAD>
- <TITLE>Web Server Enrollment Page</TITLE>
- <META HTTP-EQUIV="Cache-Control" CONTENT="no cache">
- <META HTTP-EQUIV="Pragma" CONTENT="no cache">
- <META HTTP-EQUIV="Expires" CONTENT="0">
-
-
- <%
- ''Process a Certificate Request
-
- On Error Resume Next
-
- Dim Certificate, DispositionCode, LastStatus,ConfigString, PKCS10
- Dim SubmitFlag, GetCertFlag, Attributes, ControlType
-
- set ICertRequest = Server.CreateObject("CertificateAuthority.Request")
- set ICertConfig = Server.CreateObject("CertificateAuthority.Config")
-
- ConfigString = ICertConfig.GetConfig(0)
- PKCS10 = Request.Form("CertRequest")
- SubmitFlag = Request.Form("SubmitFlag")
- GetCertFlag = Request.Form("GetCertFlag")
- Attributes = Request.Form("CertAttrib")
- ControlType = Request.Form("ControlType")
-
- if PKCS10 <> "" then
- DispositionCode = ICertRequest.Submit(SubmitFlag, PKCS10, Attributes, ConfigString)
- LastStatus = 0
- LastStatus = ICertRequest.GetLastStatus()
- Certificate = ICertRequest.GetCertificate(GetCertFlag)
- Session("CertStore") = Certificate
- end if
- %>
-
- <% if PKCS10 = "" then %>
- <SCRIPT LANGUAGE="VBSCRIPT">
- msg = "You have submitted an empty string which indicates that an error"
- msg = msg & " has ocured on your machine. Please verify that the data"
- msg = msg & " you have submitted is vaild and that a PKCS10 is being"
- msg = msg & " correctly generated by your machine."
- err = MsgBox(msg, 16, "CERTIFICATE SERVER")
- window.navigate ("ceenroll.asp")
- </SCRIPT>
- <% end if %>
-
- <% if ControlType = "" then %>
- <SCRIPT LANGUAGE="JAVASCRIPT">
- function Download() {
- window.location = "newcert.cer";
- }
- </SCRIPT>
-
- <% else
-
- ''Format the Certificate
-
- FormatedCert = ""
- qc = chr(34)
- CharsLeft = True
- OutP = 1
-
- while(CharsLeft)
- BeginLine = OutP
- OutP = InStr(OutP, Certificate, vbNewLine)
-
- if (OutP > 0) then
- FormatedCert = FormatedCert & "szPKCS7 = szPKCS7 & " & qc & _
- Mid(Certificate, BeginLine, OutP-BeginLine) & qc
-
- if (OutP >= (len(Certificate) - len(vcNewLine))) then
- CharsLeft = False
- end if
-
- else
- CharsLeft = False
- end if
- FormatedCert = FormatedCert & vbNewLine
- OutP = OutP + len(vbNewLine)
- wend
-
- end if %>
-
-
- <% if ControlType = "XENROLL" or ControlType = "CERTENR3" then %>
-
- <% if ControlType = "XENROLL" then %>
- <OBJECT
- classid="clsid:43F8F289-7A20-11D0-8F06-00C04FC295E1"
- CODEBASE="/CertControl/xenroll.cab#Version=5,131,2090,1"
- id=IControl
- >
- </OBJECT>
- <% else %>
- <OBJECT
- classid="clsid:33BEC9E0-F78F-11cf-B782-00C04FD7BF43"
- CODEBASE="/CertControl/x86/certenr3.dll#Version=4.70.1143"
- id=IControl
- >
- </OBJECT>
- <% end if %>
-
- <SCRIPT LANGUAGE="VBSCRIPT">
- sub Download()
-
- Dim result, Message
-
- On Error Resume Next
-
- szPKCS7 = ""
- <%=FormatedCert%>
-
- <% if ControlType = "XENROLL" then %>
- if ("<%=Request.Form("WriteCertToCSP") %>" = "WriteCertToCSP") then
- IControl.WriteCertToCSP = TRUE
- end if
-
- if "<%=Request.Form("CertUsage")%>" = "1.3.6.1.5.5.7.3.8" or _
- "<%=Request.Form("CertUsage")%>" = "1.3.6.1.5.5.7.3.3" then
- SPCFile = InputBox("Save the SPC file as:", "XENROLL")
- IControl.SPCFileName = SPCFile
- elseif "<%=Request.Form("SaveCert")%>" = "SaveCertificate" then
- SPCFile = InputBox("Save the Certificate as:", "XENROLL")
- IControl.SPCFileName = SPCFile
- end if
-
- IControl.AcceptPKCS7(szPKCS7)
- <% else %>
- szSessionID = "<%=Request.Form("PassThru") %>"
- Result = IControl.AcceptCredentials(szSessionID, szPKCS7, 0, FALSE)
- <% end if %>
- If err.Number = 0 Then
- <% if ControlType = "XENROLL" then %>
- Message = "Your new certificate has been successfully installed! " & vbcrlf & vbcrlf
- Message = Message & " If you are using IE3.02 or IE4.0 Preview 2 and you" & vbcrlf
- Message = Message & " have not already installed this Certificate Authority's" & vbcrlf
- Message = Message & " Root Certificate, you must do so from the" & vbcrlf
- Message = Message & " 'Install Certificate Authority Certificates'" & vbcrlf
- Message = Message & " page."
- result = MsgBox (Message, 64, "Certificate Server")
- window.location = "default.htm"
- <% else %>
- Message = "Your new certificate has been successfully installed."
- result = MsgBox (Message, 0, "Certificate Server")
- window.location = "default.htm"
- <% end if %>
- Else
- Message = "Unable to install the certificate:" & vbcrlf & vbcrlf
- Message = Message & "Please verify that your CSP supports any settings you have made "
- Message = Message & "and that your input is valid." & vbcrlf & vbcrlf
- Message = Message & "Error: " & Hex(err)
- result = MsgBox (Message, 48, "<%=ControlType%>")
- window.location = "ceenroll.asp"
- End If
- end sub
- </SCRIPT>
-
- <% end if %>
-
-
- <Body Background="csback.gif">
- <BODY BGCOLOR=#FFFFFF>
- <B><A HREF="../default.htm">HOME</A></B>
- <HR>
-
- <UL><IMG SRC="cslogo.gif" ALIGN="MIDDLE" border=0 alt="Product Logo"></UL>
-
- <Center>
-
- <% if DispositionCode = 3 then %>
-
- <H1>Certificate Download</H1>
- <B>
- <FONT SIZE=5>
- <BR>Your request has been successfully processed!
- </FONT>
- <FONT SIZE=4>
- <BR><BR><BR><BR><BR>Please click the Download button to obtain your new certificate.
- <BR><BR>
- </FONT>
- <FORM>
- <INPUT TYPE=BUTTON VALUE="Download" NAME="Certificate" OnClick="Download()">
- </FORM>
- <BR><BR><BR><BR><BR>
-
- <% else %>
-
- <H1>Error!!!</H1>
- <B>
- <FONT SIZE=5>
-
- Certificate Server is unable to process your request.
- </FONT>
- <BR><BR><BR>
- <FONT SIZE=4>
- <I>
- Last Status Error Code = <%=HEX(LastStatus)%>
- </I>
- </FONT>
-
- <BR><BR>
-
- <% if LastStatus = 1722 then %>
- <FONT SIZE=4>
- This error can occur if the Certificate Authority Service<BR>
- has not been started.<BR>
- </FONT>
- <BR><BR>
- <FONT SIZE=5>
- Please contact your Certificate Authority for assistance.
- </FONT>
- <% elseif LastStatus = -2146893811 then %>
- <FONT SIZE=4>
- This error may indicate a problem with the Certificate Authority key.<BR>
- The key was not found and the certificate was not issued.<BR>
- </FONT>
- <BR><BR>
- <FONT SIZE=5>
- Please contact your Certificate Authority for assistance.
- </FONT>
- <% elseif LastStatus = 87 then %>
- <FONT SIZE=4>
- This error indicates that "Invalid Data" was submitted to Certificate Server.<BR>
- This can occur if A) You are submitting a request that is not formated correctly<BR>
- or B) The the Certificate Authority used a network share or relative path to point<BR>
- to the "Shared Directory" when configuring Certificate Server.
- </FONT>
- <BR><BR>
- <FONT SIZE=5>
- Please contact your Certificate Authority for assistance.
- </FONT>
- <% elseif LastStatus = -2147024883 then %>
- <FONT SIZE=4>
- This error may indicate that the encoded length of your request is 7F.<BR>
- Please reapply for this certificate and changing the "length" of the data<BR>
- you entered for Common Name, Department...
- </FONT>
- <BR><BR><BR>
- <FONT SIZE=5>
- If this doesn't work, please contact your Certificate Authority.
- </FONT>
- <% else %>
- <FONT SIZE=5>
- <BR><BR>
- Please verify that you are submitting a valid request or contact
- <BR>your Certificate Authority for assistance.
- </FONT>
- <% end if %>
- </B>
- <BR><BR><BR><BR>
-
-
- <% end if %>
-
- </CENTER>
-
- <!--FOOTER START-->
- <HR>
- <HR>
- <FORM>
- <i>© 1997 by Microsoft Corporation. All rights reserved.</i>
- </FORM>
- <!--FOOTER END-->
-
-
- </BODY>
- </HTML>
-
-
-
-
-
-
-
-
-
-