home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 2000 March / VPR0003B.ISO / i386 / ceaccept.asp < prev    next >
Text File  |  1999-10-14  |  8KB  |  270 lines

  1. <%Response.Expires=0%>
  2. <HTML>
  3. <HEAD>
  4. <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=x-sjis">
  5. <TITLE>Web サーバー登録ページ</TITLE>
  6. <META HTTP-EQUIV="Cache-Control" CONTENT="no cache">
  7. <META HTTP-EQUIV="Pragma" CONTENT="no cache">
  8. <META HTTP-EQUIV="Expires" CONTENT="0">
  9.  
  10.  
  11. <% 
  12.     ''Process a Certificate Request
  13.     
  14.     On Error Resume Next
  15.     
  16.     Dim Certificate, DispositionCode, LastStatus,ConfigString, PKCS10
  17.     Dim SubmitFlag, GetCertFlag, Attributes, ControlType
  18.  
  19.     set ICertRequest = Server.CreateObject("CertificateAuthority.Request")
  20.     set ICertConfig     = Server.CreateObject("CertificateAuthority.Config") 
  21.  
  22.     ConfigString = ICertConfig.GetConfig(0)
  23.     PKCS10         = Request.Form("CertRequest")
  24.     SubmitFlag   = Request.Form("SubmitFlag")
  25.     GetCertFlag  = Request.Form("GetCertFlag")
  26.     Attributes   = Request.Form("CertAttrib")
  27.     ControlType  = Request.Form("ControlType")
  28.        
  29.     if PKCS10 <> "" then
  30.           DispositionCode = ICertRequest.Submit(SubmitFlag, PKCS10, Attributes, ConfigString)
  31.       LastStatus = 0
  32.       LastStatus = ICertRequest.GetLastStatus()
  33.       Certificate = ICertRequest.GetCertificate(GetCertFlag)
  34.       Session("CertStore") = Certificate
  35.         end if                   
  36. %>
  37.   
  38.    <% if PKCS10 = "" then %>
  39.      <SCRIPT LANGUAGE="VBSCRIPT">
  40.           msg = "空の文字列が提出されました。使用しているクライアント マシンで"
  41.       msg = msg & "エラーが発生したと考えられます。正しいデータを提出した"
  42.       msg = msg & "ことと、クライアント マシンで PKCS #10 が正しく生成"
  43.           msg = msg & "されたことを確認してください。"
  44.           err = MsgBox(msg, 16, "CERTIFICATE SERVER")
  45.           window.navigate ("ceenroll.asp")
  46.      </SCRIPT>
  47.     <% end if %>        
  48.  
  49. <% if ControlType = "" then %>
  50.     <SCRIPT LANGUAGE="JAVASCRIPT">
  51.      function Download() {
  52.         window.location = "newcert.cer";    
  53.     }
  54.     </SCRIPT>
  55.  
  56. <% else
  57.  
  58.      ''Format the Certificate
  59.  
  60.      FormatedCert = ""
  61.      qc = chr(34)
  62.      CharsLeft = True
  63.      OutP = 1
  64.  
  65.      while(CharsLeft)
  66.     BeginLine = OutP
  67.     OutP = InStr(OutP, Certificate, vbNewLine)
  68.  
  69.     if (OutP > 0) then
  70.        FormatedCert = FormatedCert & "szPKCS7 = szPKCS7 & " & qc & _
  71.        Mid(Certificate, BeginLine, OutP-BeginLine) & qc 
  72.  
  73.            if (OutP >= (len(Certificate) - len(vcNewLine))) then 
  74.          CharsLeft = False
  75.        end if
  76.     
  77.     else
  78.       CharsLeft = False
  79.     end if
  80.       FormatedCert = FormatedCert & vbNewLine
  81.       OutP = OutP + len(vbNewLine)
  82.      wend
  83.  
  84. end if %>
  85.      
  86.   
  87. <% if ControlType = "XENROLL" or ControlType = "CERTENR3" then %>     
  88.  
  89.     <% if ControlType = "XENROLL" then %>
  90.       <OBJECT
  91.        classid="clsid:43F8F289-7A20-11D0-8F06-00C04FC295E1"
  92.        CODEBASE="/CertControl/xenroll.cab#Version=5,131,1877,1"
  93.        id=IControl
  94.       >
  95.       </OBJECT>   
  96.     <% else %>
  97.       <OBJECT
  98.         classid="clsid:33BEC9E0-F78F-11cf-B782-00C04FD7BF43"
  99.         CODEBASE="/CertControl/x86/certenr3.dll#Version=4.70.1143"
  100.         id=IControl
  101.       >
  102.       </OBJECT>
  103.     <% end if %>  
  104.  
  105.    <SCRIPT LANGUAGE="VBSCRIPT">
  106.    sub Download() 
  107.  
  108.     Dim result, Message
  109.         
  110.         On Error Resume Next
  111.         
  112.     szPKCS7 = ""
  113.         <%=FormatedCert%>
  114.       
  115.    <% if ControlType = "XENROLL" then %> 
  116.         if ("<%=Request.Form("WriteCertToCSP") %>" = "WriteCertToCSP") then  
  117.       IControl.WriteCertToCSP = TRUE
  118.         end if
  119.        
  120.     if "<%=Request.Form("CertUsage")%>" = "1.3.6.1.5.5.7.3.8" or _
  121.            "<%=Request.Form("CertUsage")%>" = "1.3.6.1.5.5.7.3.3" then
  122.        SPCFile = InputBox("名前を付けて SPC ファイルを保存 : ", "XENROLL") 
  123.            IControl.SPCFileName = SPCFile       
  124.        elseif "<%=Request.Form("SaveCert")%>" = "SaveCertificate"  then
  125.        SPCFile = InputBox("名前を付けて証明書を保存 : ", "XENROLL") 
  126.            IControl.SPCFileName = SPCFile
  127.        end if 
  128.  
  129.         IControl.AcceptPKCS7(szPKCS7)
  130.    <% else %>
  131.         szSessionID = "<%=Request.Form("PassThru") %>"
  132.         Result = IControl.AcceptCredentials(szSessionID, szPKCS7, 0, FALSE)
  133.    <% end if %>
  134.         If err.Number = 0 Then
  135.    <% if ControlType = "XENROLL" then %>
  136.           Message = "新しい証明書のインストールに成功しました。" & vbcrlf & vbcrlf
  137.           Message = Message & "IE 3.02 または IE 4.0 Preview 2 を使用しており、" & vbcrlf
  138.           Message = Message & "この証明機関のルート証明書をまだインストール" & vbcrlf
  139.           Message = Message & "していない場合は、証明機関の証明書をインストール" & vbcrlf
  140.           Message = Message & "するための Web ページを使用して、ルート証明書を" & vbcrlf
  141.           Message = Message & "インストールする必要があります。"
  142.           result = MsgBox (Message, 64, "Certificate Server")
  143.       window.location = "default.htm"
  144.    <% else %>
  145.           Message = "新しい証明書のインストールに成功しました。"
  146.           result = MsgBox (Message, 0, "Certificate Server")
  147.       window.location = "default.htm"
  148.    <% end if %>    
  149.         Else
  150.           Message = "証明書をインストールできません。" & vbcrlf & vbcrlf 
  151.           Message = Message & "指定した設定を CSP がサポートしていることと、" 
  152.           Message = Message & "正しい値を入力したことを確認してください。" & vbcrlf & vbcrlf 
  153.           Message = Message & "エラー : " & Hex(err)
  154.       result = MsgBox (Message, 48, "<%=ControlType%>")  
  155.           window.location = "ceenroll.asp"
  156.     End If    
  157.    end sub 
  158.    </SCRIPT>
  159.  
  160. <% end if %>
  161.  
  162.  
  163. <Body Background="csback.gif">
  164. <BODY BGCOLOR=#FFFFFF>
  165. <B><A HREF="../default.htm">ホーム</A></B>
  166. <HR>
  167.  
  168. <UL><IMG SRC="cslogo.gif" ALIGN="MIDDLE" border=0 alt="製品のロゴ"></UL>
  169.  
  170. <Center>
  171.     
  172. <%  if DispositionCode = 3 then %>
  173.  
  174.       <H1>証明書のダウンロード</H1>
  175.       <B>
  176.       <FONT SIZE=5>
  177.       <BR>要求は正常に処理されました。
  178.       </FONT>
  179.       <FONT SIZE=4>  
  180.       <BR><BR><BR><BR><BR>新しい証明書を取得するには [ダウンロード] ボタンをクリックしてください。
  181.       <BR><BR>
  182.       </FONT>
  183.       <FORM>
  184.          <INPUT TYPE=BUTTON VALUE="ダウンロード" NAME="Certificate" OnClick="Download()">    
  185.       </FORM>
  186.       <BR><BR><BR><BR><BR>
  187.  
  188. <%  else %>
  189.  
  190.        <H1>エラー !</H1>
  191.        <B>
  192.        <FONT SIZE=5>
  193.       
  194.        Certificate Server は要求の処理に失敗しました。
  195.        </FONT>
  196.        <BR><BR><BR>
  197.        <FONT SIZE=4>
  198.        <I>
  199.        最後に発生したエラーのコード = <%=HEX(LastStatus)%>
  200.        </I>
  201.        </FONT>   
  202.         
  203.       <BR><BR>
  204.  
  205.       <% if LastStatus = 1722 then %>
  206.         <FONT SIZE=4>
  207.           このエラーは、Certificate Authority (証明機関) サービスが開始されていない<BR>
  208.           場合に発生します。<BR>
  209.         </FONT>
  210.         <BR><BR>  
  211.     <FONT SIZE=5>
  212.           証明機関に相談してください。
  213.         </FONT> 
  214.       <% elseif LastStatus = -2146893811 then %>
  215.         <FONT SIZE=4>
  216.           証明機関のキーに問題がある可能性があります。<BR>
  217.           キーを発見できなかったため、証明書は発行されませんでした。<BR>
  218.         </FONT>
  219.         <BR><BR>
  220.     <FONT SIZE=5>
  221.           証明機関に相談してください。
  222.         </FONT>
  223.       <% elseif LastStatus = 87 then %>
  224.         <FONT SIZE=4>
  225.           不正なデータが Certificate Server に提出されました。<BR>
  226.           原因は 2 つ考えられます。提出した要求の形式が不正であるか、<BR>
  227.           Certificate Server の構成時に、"共有フォルダ" に<BR>
  228.           ネットワーク共有または相対パスを指定しました。
  229.         </FONT>
  230.         <BR><BR>
  231.     <FONT SIZE=5>
  232.           証明機関に相談してください。
  233.         </FONT>
  234.       <% elseif LastStatus = -2147024883 then %>
  235.         <FONT SIZE=4>
  236.           提出した要求のエンコード長が 7F である可能性があります。<BR>
  237.           共通名、部署などに入力したデータの "長さ" を変更し、<BR>
  238.           この証明書を再度要求してください。
  239.         </FONT>
  240.         <BR><BR><BR>
  241.     <FONT SIZE=5>
  242.           それでも問題が解消しない場合は、証明機関に連絡してください。
  243.         </FONT>
  244.       <% else %>
  245.         <FONT SIZE=5>
  246.           <BR><BR>
  247.           提出した要求が正しいことを確認し、問題が解消しない場合は
  248.       <BR>証明機関に相談してください。
  249.         </FONT> 
  250.       <% end if %>
  251.       </B>    
  252.       <BR><BR><BR><BR> 
  253.  
  254.  
  255. <%  end if %>
  256.  
  257. </CENTER>
  258.  
  259. <!--FOOTER START-->
  260. <HR>
  261. <HR>
  262. <FORM>
  263. <i>© 1997 by Microsoft Corporation. All rights reserved.</i>
  264. </FORM>
  265. <!--FOOTER END-->
  266.     
  267.  
  268. </BODY>
  269. </HTML>
  270.