Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

443 lines
15 KiB

  1. <%@ CODEPAGE=65001 'UTF-8%>
  2. <%' certrqxt.asp - (CERT)srv web - (R)e(Q)uest, e(XT)ernally created
  3. ' Copyright (C) Microsoft Corporation, 1998 - 1999 %>
  4. <!-- #include FILE=certsbrt.inc -->
  5. <!-- #include FILE=certdat.inc -->
  6. <%
  7. Dim sBrowserDependentLineBreak
  8. If "Text"<>sBrowser Then
  9. sBrowserDependentLineBreak="<BR>"
  10. Else
  11. sBrowserDependentLineBreak=""
  12. End If
  13. %>
  14. <HTML>
  15. <Head>
  16. <Meta HTTP-Equiv="Content-Type" Content="text/html; charset=UTF-8">
  17. <Title>Microsoft Certificate Services</Title>
  18. </Head>
  19. <Body BgColor=#FFFFFF Link=#0000FF VLink=#0000FF ALink=#0000FF OnLoad="postLoad();"><Font ID=locPageFont Face="Arial">
  20. <Table Border=0 CellSpacing=0 CellPadding=4 Width=100% BgColor=#008080>
  21. <TR>
  22. <TD><Font Color=#FFFFFF><LocID ID=locMSCertSrv><Font Face="Arial" Size=-1><B><I>Microsoft</I></B> Certificate Services &nbsp;--&nbsp; <%=sServerDisplayName%> &nbsp;</Font></LocID></Font></TD>
  23. <TD ID=locHomeAlign Align=Right><A Href="/certsrv"><Font Color=#FFFFFF><LocID ID=locHomeLink><Font Face="Arial" Size=-1><B>Home</B></Font></LocID></Font></A></TD>
  24. </TR>
  25. </Table>
  26. <Form Name=UIForm OnSubmit="goNext();return false;" Action="certlynx.asp" Method=Post>
  27. <Input Type=Hidden Name=SourcePage Value="certrqxt">
  28. <P ID=locPageTitle> <B> Submit a Certificate Request or Renewal Request</B>
  29. <!-- Green HR --><Table Border=0 CellSpacing=0 CellPadding=0 Width=100%><TR><TD BgColor=#008080><Img Src="certspc.gif" Alt="" Height=2 Width=1></TD></TR></Table>
  30. <%If "IE"=sBrowser Then%>
  31. <Span ID=spnFixTxt Style="display:none">
  32. <Table Border=0 CellSpacing=0 CellPadding=4 Style="Color:#FF0000"><TR><TD ID=locBlankError>
  33. <I>The request field may not be left blank.</I> Please paste a request in the field and try again.
  34. </TD></TR></Table>
  35. </Span>
  36. <%End If%>
  37. <P ID=locInstructions>
  38. To submit a saved request to the CA, paste a base-64-encoded PKCS #10
  39. certificate request or PKCS #7 renewal request generated by an
  40. external source (such as a Web server) in the Saved Request box.
  41. </P>
  42. <Table Border=0 CellSpacing=0 CellPadding=0>
  43. <TR> <!-- establish column widths. -->
  44. <TD><Img Src="certspc.gif" Alt="" Height=1 Width=<%=L_LabelColWidth_Number%>></TD> <!-- label column, top border -->
  45. <TD RowSpan=59><Img Src="certspc.gif" Alt="" Height=1 Width=4></TD> <!-- label spacing column -->
  46. <TD></TD> <!-- field column -->
  47. </TR>
  48. <TR>
  49. <TD ID=locSavedReqHead ColSpan=3><Font Face="Arial" Size=-1><B>Saved Request:</B></Font></TD>
  50. </TR><TR><TD ColSpan=3 BgColor=#008080><Img Src="certspc.gif" Alt="" Height=2 Width=1></TD>
  51. </TR><TR><TD ColSpan=3><Img Src="certspc.gif" Alt="" Height=3 Width=1></TD></TR>
  52. <TR>
  53. <TD ID=locPasteAlign Align=Right><Span ID=spnPasteLabel><LocID ID=SavedReqLabel><Font Face="Arial" Size=-1>Base-64-encoded
  54. <%=sBrowserDependentLineBreak%> certificate request
  55. <%=sBrowserDependentLineBreak%>(PKCS&nbsp;#10 or #7):</Font></LocID></Span></TD>
  56. <TD><TextArea ID=locTaRequest Rows=6 Cols=40 Name=taRequest Wrap=Off></TextArea></TD>
  57. </TR><TR><TD ColSpan=3 Height=3></TD>
  58. </TR><TR><TD></TD>
  59. <TD><%If "IE"=sBrowser Then%>
  60. <LocID ID=locBrowse><Font Face="Arial" Size=-1><Span tabindex=0 Style="cursor:hand; color:#0000FF; text-decoration:underline;"
  61. OnContextMenu="return false;"
  62. OnKeyDown="if (13==event.keyCode) {BeginRead();blur();return false;} else if (9==event.keyCode) {return true;};return false;"
  63. OnClick="BeginRead();blur();return false;"
  64. OnMouseOver="window.status=L_BrowseLink_Message;return true;"
  65. OnMouseOut="window.status='';return true;">Browse for a file to insert</Span>.
  66. </Font></LocID>
  67. <Span ID=spRead Style="display:none">
  68. <Table Border=0 CellSpacing=0 CellPadding=0>
  69. <TR><TD Height=5></TD>
  70. <TR>
  71. <TD Width=6></TD>
  72. <TD Width=3 BgColor=#008080></TD>
  73. <TD Width=4></TD>
  74. <TD>
  75. <LocID ID=locFileNameLabel>Full path name:<LocID> <Input ID=locFlRequest Type=File Size=40 Name=flRequest><BR>
  76. <Input ID=locBtnRead Type=Button Value="Read!" onClick="FinishRead();blur();" Style="font-weight:bold">
  77. <Input ID=locBtnCancel Type=Button Value="Cancel" onClick="spRead.style.display='none';blur();">
  78. </TD>
  79. </TR>
  80. </Table>
  81. </Span>
  82. <%End If%></TD>
  83. </TR>
  84. <%If "Enterprise"=sServerType Then%>
  85. <TR>
  86. <TD ColSpan=3><Font ID=locCertTmplFont Face="Arial" Size=-1><%If "Text"=sBrowser Then%><P><%Else%><BR><%End If%><LocID ID=locTemplateHead><B>Certificate Template:</B></LocID></Font></TD>
  87. </TR><TR><TD ColSpan=3 BgColor=#008080><Img Src="certspc.gif" Alt="" Height=2 Width=1></TD>
  88. </TR><TR><TD ColSpan=3><Img Src="certspc.gif" Alt="" Height=3 Width=1></TD>
  89. </TR><TR><TD></TD>
  90. <TD><Select Name=lbCertTemplate>
  91. <%
  92. Dim nWriteTemplateResult
  93. nWriteTemplateResult=WriteTemplateList()
  94. %>
  95. </Select></TD>
  96. </TR>
  97. <%End If%>
  98. <TR>
  99. <TD ColSpan=3><Font ID=locAttrFont Face="Arial" Size=-1><%If "Text"=sBrowser Then%><P><%Else%><BR><%End If%><LocID ID=locAttribHead><B>Additional Attributes:</B></LocID></Font></TD>
  100. </TR><TR><TD ColSpan=3 BgColor=#008080><Img Src="certspc.gif" Alt="" Height=2 Width=1></TD>
  101. </TR><TR><TD ColSpan=3><Img Src="certspc.gif" Alt="" Height=6 Width=1></TD>
  102. </TR>
  103. <TR>
  104. <TD ID=locAttribLabel Align=Right><Font Face="Arial" Size=-1>Attributes:</Font></TD>
  105. <TD><TextArea ID=locTaAttrib Name=taAttrib Wrap=Off Rows=2 Cols=30></TextArea></TD>
  106. </TR>
  107. <%If "StandAlone"<>sServerType And 0<>nWriteTemplateResult Then%>
  108. <!-- submit button removed if there was an error getting the templates -->
  109. <%Else%>
  110. <TR><TD ColSpan=3><Font Size=-1><BR></Font></TD></TR>
  111. <TR><TD ColSpan=3 BgColor=#008080><Img Src="certspc.gif" Alt="" Height=2 Width=1></TD></TR>
  112. <TR><TD ColSpan=3><Img Src="certspc.gif" Alt="" Height=3 Width=1></TD></TR>
  113. <TR><TD><TD ID=locSubmitAlign Align=Right>
  114. <Input Type=Submit ID=btnSubmit Value="Submit &gt;" <%If "IE"=sBrowser Then%> Style="width:.75in"<%End If%>>
  115. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  116. </TD></TR>
  117. <TR><TD ColSpan=3 Height=20></TD></TR>
  118. <%End If%>
  119. </Table>
  120. <P>
  121. <!-- Green HR --><Table Border=0 CellSpacing=0 CellPadding=0 Width=100%><TR><TD BgColor=#008080><Img Src="certspc.gif" Alt="" Height=2 Width=1></TD></TR></Table>
  122. <!-- White HR --><Table Border=0 CellSpacing=0 CellPadding=0 Width=100%><TR><TD BgColor=#FFFFFF><Img Src="certspc.gif" Alt="" Height=5 Width=1></TD></TR></Table>
  123. </Form>
  124. </Font>
  125. <!-- ############################################################ -->
  126. <!-- End of standard text. Scripts follow -->
  127. <%bIncludeXEnroll=False%>
  128. <%bIncludeGetCspList=False%>
  129. <%bIncludeTemplateCode=True%>
  130. <!-- #include FILE=certsgcl.inc -->
  131. <!-- This form we fill in and submit 'by hand'-->
  132. <Form Name=SubmittedData Action="certfnsh.asp" Method=Post>
  133. <Input Type=Hidden Name=Mode> <!-- used in request ('newreq'|'chkpnd') -->
  134. <Input Type=Hidden Name=CertRequest> <!-- used in request -->
  135. <Input Type=Hidden Name=CertAttrib> <!-- used in request -->
  136. <Input Type=Hidden Name=FriendlyType> <!-- used on pending -->
  137. <Input Type=Hidden Name=ThumbPrint> <!-- used on pending -->
  138. <Input Type=Hidden Name=TargetStoreFlags> <!-- used on install ('0'|CSSLM)-->
  139. <Input Type=Hidden Name=SaveCert> <!-- used on install ('no'|'yes')-->
  140. </FORM>
  141. <Script Language="JavaScript">
  142. //----------------------------------------------------------------
  143. // Strings to be localized
  144. <%If "IE"=sBrowser Then%>
  145. ;
  146. var L_BrowseLink_Message="Browse for a file to insert";
  147. var L_ReadProhibited_ErrorMessage="Your web browser security settings prohibit this page from accessing your disk.\nEither paste the data into this page manually, or add this page to your browser's list of trusted sites.";
  148. var L_Unexpected_ErrorMessage="\"An unexpected error occurred while trying to read the file.\\n\\nError: \"+nResult";
  149. var L_FileNotFound_ErrorMessage="The file you specified was not found or the drive you specified\nwas not ready. Please enter a valid file name.";
  150. var L_NoName_ErrorMessage="Please enter a file name.";
  151. <%End If%>
  152. <%If "StandAlone"<>sServerType Then%>
  153. ;
  154. var L_TemplateLoadErrNoneFound_ErrorMessage="No certificate templates could be found. You do not have permission to request a certificate from this CA, or an error occurred while accessing the Active Directory.";
  155. var L_TemplateLoadErrUnexpected_ErrorMessage="\"An unexpected error (\"+sErrorNumber+\") occurred while getting the certificate template list.\"";
  156. <%End If%>
  157. ;
  158. var L_NoBlank_ErrorMessage="The request field may not be left blank.\n Please paste a request in the field and try again.";
  159. var L_SavedReqCert_Text="Saved-Request Certificate";
  160. //================================================================
  161. // INITIALIZATION ROUTINES
  162. //----------------------------------------------------------------
  163. // This contains the functions we want executed immediately after load completes
  164. function postLoad() {
  165. <%If "StandAlone"<>sServerType And 0<>nWriteTemplateResult Then%>
  166. handleLoadError(<%=nWriteTemplateResult%>, L_TemplateLoadErrNoneFound_ErrorMessage, L_TemplateLoadErrUnexpected_ErrorMessage);
  167. <%End If%>
  168. }
  169. <%If "StandAlone"<>sServerType Then%>
  170. //----------------------------------------------------------------
  171. // handle errors from GetTemplateList()
  172. function handleLoadError(nResult, sNoneFound, sUnexpected) {
  173. if (-1==nResult) {
  174. alert(sNoneFound);
  175. } else {
  176. var sErrorNumber="0x"+toHex(nResult);
  177. alert(eval(sUnexpected));
  178. }
  179. //document.UIForm.btnSubmit.disabled=true;
  180. }
  181. <%End If%>
  182. <%If "IE"=sBrowser Then%>
  183. //================================================================
  184. // FILE READ ROUTINES
  185. //----------------------------------------------------------------
  186. // IE SPECIFIC:
  187. // make sure that we have permision to do a read, then show
  188. // the file name box
  189. function BeginRead() {
  190. if (true==TestRead()) {
  191. spRead.style.display='';
  192. document.UIForm.flRequest.focus()
  193. } else {
  194. alert(L_ReadProhibited_ErrorMessage);
  195. }
  196. }
  197. //----------------------------------------------------------------
  198. // IE SPECIFIC:
  199. function FinishRead() {
  200. spnFixTxt.style.display='none';
  201. if (""==document.UIForm.flRequest.value) {
  202. handleReadError(5);
  203. return;
  204. }
  205. var nResult=GetFileData(); // use VBScript to read the file, since it can handle errors
  206. if (0!=nResult) {
  207. handleReadError(nResult);
  208. return;
  209. }
  210. spRead.style.display='none';
  211. document.UIForm.btnSubmit.focus()
  212. }
  213. //----------------------------------------------------------------
  214. // IE SPECIFIC:
  215. function handleReadError(nResult) {
  216. var sMessage;
  217. var elemFocusMe=null;
  218. if (429==nResult) {
  219. sMessage=L_ReadProhibited_ErrorMessage;
  220. elemFocusMe=document.UIForm.flRequest;
  221. } else if (53==nResult || 76==nResult || 71==nResult) {
  222. sMessage=L_FileNotFound_ErrorMessage;
  223. elemFocusMe=document.UIForm.flRequest;
  224. } else if (5==nResult) {
  225. sMessage=L_NoName_ErrorMessage;
  226. elemFocusMe=document.UIForm.flRequest;
  227. } else {
  228. sMessage=eval(L_Unexpected_ErrorMessage);
  229. }
  230. // Show the error message
  231. alert(sMessage);
  232. // place focus on offending control
  233. if (null!=elemFocusMe) {
  234. elemFocusMe.focus();
  235. }
  236. }
  237. <%End If%>
  238. //================================================================
  239. // SUBMIT ROUTINES
  240. //----------------------------------------------------------------
  241. // determine what to do when the submit button is pressed
  242. function goNext() {
  243. SubmitRequest();
  244. }
  245. //----------------------------------------------------------------
  246. // set a label to normal style
  247. function markLabelNormal(spn) {
  248. <%If "IE"=sBrowser Then%>
  249. spn.style.color="#000000";
  250. spn.style.fontWeight='normal';
  251. <%End If%>
  252. }
  253. //----------------------------------------------------------------
  254. // set a label to error state
  255. function markLabelError(spn) {
  256. <%If "IE"=sBrowser Then%>
  257. spn.style.color='#FF0000';
  258. spn.style.fontWeight='bold';
  259. <%End If%>
  260. }
  261. //----------------------------------------------------------------
  262. function validateRequest() {
  263. <%If "IE"<>sBrowser Then%>
  264. // work around for NN: label marking does nothing
  265. var spnPasteLabel;
  266. <%End If%>
  267. markLabelNormal(spnPasteLabel);
  268. // Check for an empty request
  269. if (""==document.UIForm.taRequest.value) {
  270. bOK=false;
  271. markLabelError(spnPasteLabel);
  272. <%If "IE"=sBrowser Then%>
  273. spnFixTxt.style.display='';
  274. window.scrollTo(0,0);
  275. <%Else%>
  276. alert(L_NoBlank_ErrorMessage);
  277. <%End If%>
  278. document.UIForm.taRequest.focus();
  279. return false;
  280. }
  281. // everything is OK
  282. return true;
  283. }
  284. //----------------------------------------------------------------
  285. function SubmitRequest() {
  286. <%If "IE"=sBrowser Then%>
  287. spnFixTxt.style.display='none';
  288. <%End If%>
  289. // check that the form is filled in
  290. if (false==validateRequest()) {
  291. return;
  292. }
  293. // set request
  294. document.SubmittedData.CertRequest.value=document.UIForm.taRequest.value;
  295. // set defaults for values we need on install
  296. document.SubmittedData.TargetStoreFlags.value=0; // 0=Use default (=user store), but ignored when saving cert.
  297. document.SubmittedData.SaveCert.value="yes";
  298. document.SubmittedData.Mode.value="newreq";
  299. document.SubmittedData.FriendlyType.value=L_SavedReqCert_Text;
  300. // append the local date to the type
  301. document.SubmittedData.FriendlyType.value+=" ("+(new Date()).toLocaleString()+")";
  302. //not created by xenroll, not supported
  303. document.SubmittedData.ThumbPrint.value="";
  304. // make sure the arributes end cr/lf
  305. var sAttrib=document.UIForm.taAttrib.value;
  306. if (sAttrib.lastIndexOf("\r\n")!=sAttrib.length-2 && sAttrib.length>0) {
  307. sAttrib=sAttrib+"\r\n";
  308. }
  309. <%If "Enterprise"=sServerType Then%>
  310. // add an attribute for the cert type
  311. // get the selected template
  312. var sRealName = getTemplateStringInfo(CTINFO_INDEX_REALNAME, null);
  313. // set the cert template
  314. sAttrib+="CertificateTemplate:"+sRealName+"\r\n";
  315. <%End If%>
  316. // for interop debug purposes
  317. sAttrib+="UserAgent:<%=Request.ServerVariables("HTTP_USER_AGENT")%>\r\n";
  318. // set the attributes
  319. document.SubmittedData.CertAttrib.value=sAttrib;
  320. // Submit the cert request and move forward in the wizard
  321. document.SubmittedData.submit();
  322. }
  323. </Script>
  324. <%If "IE"=sBrowser Then%>
  325. <Script Language="VBSCRIPT">
  326. '=================================================================
  327. ' FILE READ ROUTINES
  328. '-----------------------------------------------------------------
  329. ' IE SPECIFIC:
  330. ' See if we have permision to access the file system
  331. Function TestRead()
  332. Dim filesystem
  333. On Error Resume Next
  334. ' See if we're allowed to create the FileSystem object
  335. Set filesystem=CreateObject("Scripting.FileSystemObject")
  336. ' Security may not allow this
  337. If Err.Number<>0 Then
  338. TestRead=False
  339. Else
  340. TestRead=True
  341. End If
  342. End Function
  343. '-----------------------------------------------------------------
  344. ' IE SPECIFIC:
  345. ' read the given file into the text-area
  346. Function GetFileData()
  347. Dim filesystem, file
  348. On Error Resume Next
  349. ' First, create the FileSystem object
  350. Set filesystem=CreateObject("Scripting.FileSystemObject")
  351. ' Security may not allow this
  352. If Err.Number<>0 Then
  353. GetFileData=Err.Number
  354. Exit Function
  355. End If
  356. ' open the specified file
  357. Set file=filesystem.OpenTextFile(document.UIForm.flRequest.value, 1 , false) '1->ForReading, false->don't create
  358. ' file may not exist
  359. If Err.Number<>0 Then
  360. GetFileData=Err.Number
  361. Exit Function
  362. End If
  363. ' read the data and stash it into the form
  364. document.UIForm.taRequest.value=file.ReadAll
  365. ' catch any read errors
  366. If Err.Number<>0 Then
  367. GetFileData=Err.Number
  368. Exit Function
  369. End If
  370. ' clean up
  371. file.Close
  372. Set file=Nothing
  373. Set filesystem=Nothing
  374. GetFileData=0
  375. End Function
  376. </Script>
  377. <%End If '"IE"=sBrowser%>
  378. </Body>
  379. </HTML>