Web Server Enrollment Page
<%
''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 %>
<% end if %>
<% if ControlType = "" then %>
<% 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 %>
<% else %>
<% end if %>
<% end if %>
HOME
<% if DispositionCode = 3 then %>
Certificate Download
Your request has been successfully processed!
Please click the Download button to obtain your new certificate.
<% else %>
Error!!!
Certificate Server is unable to process your request.
Last Status Error Code = <%=HEX(LastStatus)%>
<% if LastStatus = 1722 then %>
This error can occur if the Certificate Authority Service
has not been started.
Please contact your Certificate Authority for assistance.
<% elseif LastStatus = -2146893811 then %>
This error may indicate a problem with the Certificate Authority key.
The key was not found and the certificate was not issued.
Please contact your Certificate Authority for assistance.
<% elseif LastStatus = 87 then %>
This error indicates that "Invalid Data" was submitted to Certificate Server.
This can occur if A) You are submitting a request that is not formated correctly
or B) The the Certificate Authority used a network share or relative path to point
to the "Shared Directory" when configuring Certificate Server.
Please contact your Certificate Authority for assistance.
<% elseif LastStatus = -2147024883 then %>
This error may indicate that the encoded length of your request is 7F.
Please reapply for this certificate and changing the "length" of the data
you entered for Common Name, Department...
If this doesn't work, please contact your Certificate Authority.
<% else %>
Please verify that you are submitting a valid request or contact
your Certificate Authority for assistance.
<% end if %>