Leaked source code of windows server 2003
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.

105 lines
3.4 KiB

  1. <%@ CODEPAGE=65001 'UTF-8%>
  2. <%' certfnsh.asp - (CERT)srv web - (F)i(N)i(SH) request
  3. ' Copyright (C) Microsoft Corporation, 1998 - 1999 %>
  4. <!-- #include FILE=certdat.inc -->
  5. <% ' ########## BEGIN SERVER SIDE EXECUTION ##########
  6. 'Process a Certificate Request
  7. Dim nDisposition, nResult, sRequest, sAttributes, eSubmitFlag, sErrMsg
  8. On Error Resume Next
  9. ' from \nt\public\sdk\inc\certcli.h
  10. Const CR_IN_BASE64HEADER=&H0000
  11. Const CR_IN_BASE64=&H0001
  12. Const CR_IN_BINARY=&H0002
  13. Const CR_IN_FORMATANY=&H0000
  14. Const CR_IN_PKCS10=&H0100
  15. Const CR_IN_KEYGEN=&H0200
  16. Const CR_IN_PKCS7=&H0300
  17. Const CR_IN_RPC=&H20000
  18. Const CR_OUT_BASE64HEADER=&H00000000
  19. Const CR_OUT_BASE64=&H00000001
  20. Const CR_OUT_BINARY=&H00000002
  21. Const CR_OUT_CHAIN=&H00000100
  22. 'Disposition code ref: \nt\public\sdk\inc\certcli.h
  23. Const CR_DISP_INCOMPLETE =0
  24. Const CR_DISP_ERROR =1
  25. Const CR_DISP_DENIED =2
  26. Const CR_DISP_ISSUED =3
  27. Const CR_DISP_ISSUED_OUT_OF_BAND=4
  28. Const CR_DISP_UNDER_SUBMISSION =5
  29. Const CR_DISP_REVOKED =6
  30. Const no_disp=-1
  31. 'Stop 'debugging breakpoint
  32. Set Session("ICertRequest")=Server.CreateObject("CertificateAuthority.Request")
  33. Set ICertRequest=Session("ICertRequest")
  34. nDisposition=no_disp
  35. If "newreq"=Request.Form("Mode") Then
  36. 'New Request (PKCS #10)
  37. ' or Certificate renewal (PKCS #7)
  38. sRequest=Request.Form("CertRequest")
  39. sAttributes=Request.Form("CertAttrib")
  40. If (InStr(sRequest, "BEGIN")=0) Then
  41. eSubmitFlag=CR_IN_BASE64
  42. Else
  43. eSubmitFlag=CR_IN_BASE64HEADER
  44. End If
  45. Err.Clear 'make sure we catch the HRESULT and not some earlier error
  46. nDisposition=ICertRequest.Submit(eSubmitFlag Or CR_IN_FORMATANY, sRequest, sAttributes, sServerConfig) 'Or CR_IN_RPC
  47. ElseIf "newreq NN"=Request.Form("Mode") Then
  48. 'New Request from Nescape
  49. sRequest=Request.Form("CertRequest")
  50. sAttributes=Request.Form("CertAttrib")
  51. Err.Clear 'make sure we catch the HRESULT and not some earlier error
  52. nDisposition=ICertRequest.Submit(CR_IN_BASE64 Or CR_IN_KEYGEN , sRequest, sAttributes, sServerConfig) 'Or CR_IN_RPC
  53. ElseIf "chkpnd"=Request.Form("Mode") Then
  54. 'Check Pending
  55. Err.Clear 'make sure we catch the HRESULT and not some earlier error
  56. nDisposition=ICertRequest.RetrievePending(Request.Form("ReqID"), sServerConfig)
  57. Else
  58. 'Unexpected mode - pass through to error handler
  59. End If
  60. nResult=Err.Number
  61. sErrMsg=Err.Description
  62. Session("nDisposition")=nDisposition
  63. Session("nResult")=nResult
  64. Session("sErrMsg")=sErrMsg
  65. 'internal redirect - transfer control to appropriate page
  66. If nDisposition=no_disp Then
  67. Server.Transfer("certrser.asp")
  68. ElseIf nDisposition=CR_DISP_INCOMPLETE Then
  69. Server.Transfer("certrser.asp")
  70. ElseIf nDisposition=CR_DISP_ERROR Then
  71. Server.Transfer("certrser.asp")
  72. ElseIf nDisposition=CR_DISP_DENIED Then
  73. Server.Transfer("certrsdn.asp")
  74. ElseIf nDisposition=CR_DISP_ISSUED Then
  75. Server.Transfer("certrsis.asp")
  76. ElseIf nDisposition=CR_DISP_ISSUED_OUT_OF_BAND Then
  77. Server.Transfer("certrsob.asp")
  78. ElseIf nDisposition=CR_DISP_UNDER_SUBMISSION Then
  79. Server.Transfer("certrspn.asp")
  80. ElseIf nDisposition=CR_DISP_REVOKED Then
  81. Server.Transfer("certrsdn.asp") 'could happen if pending->issued->revoked
  82. Else 'unknown
  83. Server.Transfer("certrser.asp")
  84. End If
  85. ' ########## END SERVER SIDE EXECUTION ##########
  86. %>