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.

151 lines
4.9 KiB

  1. // IISCertRequest.h : Declaration of the CIISCertRequest
  2. #ifndef __IISCERTREQUEST_H_
  3. #define __IISCERTREQUEST_H_
  4. #include "resource.h" // main symbols
  5. /////////////////////////////////////////////////////////////////////////////
  6. // CIISCertRequest
  7. #ifdef USE_CERT_REQUEST_OBJECT
  8. #define CERT_HASH_LENGTH 40
  9. typedef struct _CERT_DESCRIPTION
  10. {
  11. int iStructVersion;
  12. CString m_Info_CommonName;
  13. CString m_Info_FriendlyName;
  14. CString m_Info_Country;
  15. CString m_Info_State;
  16. CString m_Info_Locality;
  17. CString m_Info_Organization;
  18. CString m_Info_OrganizationUnit;
  19. CString m_Info_CAName;
  20. CString m_Info_ExpirationDate;
  21. CString m_Info_Usage;
  22. CString m_Info_AltSubject;
  23. BYTE m_Info_hash[CERT_HASH_LENGTH];
  24. DWORD m_Info_hash_length;
  25. } CERT_DESCRIPTION;
  26. class ATL_NO_VTABLE CIISCertRequest :
  27. public CComObjectRootEx<CComSingleThreadModel>,
  28. public CComCoClass<CIISCertRequest, &CLSID_IISCertRequest>,
  29. public IDispatchImpl<IIISCertRequest, &IID_IIISCertRequest, &LIBID_CERTOBJLib>
  30. {
  31. public:
  32. CIISCertRequest();
  33. ~CIISCertRequest();
  34. DECLARE_REGISTRY_RESOURCEID(IDR_IISCERTREQUEST)
  35. DECLARE_PROTECT_FINAL_CONSTRUCT()
  36. BEGIN_COM_MAP(CIISCertRequest)
  37. COM_INTERFACE_ENTRY(IIISCertRequest)
  38. COM_INTERFACE_ENTRY(IDispatch)
  39. END_COM_MAP()
  40. // IIISCertRequest
  41. public:
  42. STDMETHOD(Info_Dump)();
  43. STDMETHOD(put_ServerName)(/*[in]*/ BSTR newVal);
  44. STDMETHOD(put_UserName)(/*[in]*/ BSTR newVal);
  45. STDMETHOD(put_UserPassword)(/*[in]*/ BSTR newVal);
  46. STDMETHOD(put_InstanceName)(/*[in]*/ BSTR newVal);
  47. STDMETHOD(get_Info_CommonName)(/*[out, retval]*/ BSTR *pVal);
  48. STDMETHOD(put_Info_CommonName)(/*[in]*/ BSTR newVal);
  49. STDMETHOD(get_Info_FriendlyName)(/*[out, retval]*/ BSTR *pVal);
  50. STDMETHOD(put_Info_FriendlyName)(/*[in]*/ BSTR newVal);
  51. STDMETHOD(get_Info_Country)(/*[out, retval]*/ BSTR *pVal);
  52. STDMETHOD(put_Info_Country)(/*[in]*/ BSTR newVal);
  53. STDMETHOD(get_Info_State)(/*[out, retval]*/ BSTR *pVal);
  54. STDMETHOD(put_Info_State)(/*[in]*/ BSTR newVal);
  55. STDMETHOD(get_Info_Locality)(/*[out, retval]*/ BSTR *pVal);
  56. STDMETHOD(put_Info_Locality)(/*[in]*/ BSTR newVal);
  57. STDMETHOD(get_Info_Organization)(/*[out, retval]*/ BSTR *pVal);
  58. STDMETHOD(put_Info_Organization)(/*[in]*/ BSTR newVal);
  59. STDMETHOD(get_Info_OrganizationUnit)(/*[out, retval]*/ BSTR *pVal);
  60. STDMETHOD(put_Info_OrganizationUnit)(/*[in]*/ BSTR newVal);
  61. STDMETHOD(get_Info_CAName)(/*[out, retval]*/ BSTR *pVal);
  62. STDMETHOD(put_Info_CAName)(/*[in]*/ BSTR newVal);
  63. STDMETHOD(get_Info_ExpirationDate)(/*[out, retval]*/ BSTR *pVal);
  64. STDMETHOD(put_Info_ExpirationDate)(/*[in]*/ BSTR newVal);
  65. STDMETHOD(get_Info_Usage)(/*[out, retval]*/ BSTR *pVal);
  66. STDMETHOD(put_Info_Usage)(/*[in]*/ BSTR newVal);
  67. STDMETHOD(get_Info_AltSubject)(/*[out, retval]*/ BSTR *pVal);
  68. STDMETHOD(put_Info_AltSubject)(/*[in]*/ BSTR newVal);
  69. STDMETHOD(get_DispositionMessage)(/*[out, retval]*/ BSTR *pVal);
  70. STDMETHOD(put_DispositionMessage)(/*[in]*/ BSTR newVal);
  71. STDMETHOD(SubmitRequest)();
  72. STDMETHOD(SubmitRenewalRequest)();
  73. STDMETHOD(SaveRequestToFile)();
  74. private:
  75. // Connection Info
  76. CString m_ServerName;
  77. CString m_UserName;
  78. CString m_UserPassword;
  79. CString m_InstanceName;
  80. // Certificate Request Info
  81. CString m_Info_CommonName;
  82. CString m_Info_FriendlyName;
  83. CString m_Info_Country;
  84. CString m_Info_State;
  85. CString m_Info_Locality;
  86. CString m_Info_Organization;
  87. CString m_Info_OrganizationUnit;
  88. CString m_Info_CAName;
  89. CString m_Info_ExpirationDate;
  90. CString m_Info_Usage;
  91. CString m_Info_AltSubject;
  92. // other
  93. CString m_Info_ConfigCA;
  94. CString m_Info_CertificateTemplate;
  95. DWORD m_Info_DefaultProviderType;
  96. DWORD m_Info_CustomProviderType;
  97. BOOL m_Info_DefaultCSP;
  98. CString m_Info_CspName;
  99. DWORD m_KeyLength;
  100. BOOL m_SGCcertificat;
  101. // other
  102. PCCERT_CONTEXT m_pInstalledCert;
  103. CString m_ReqFileName;
  104. // holds last hresult
  105. HRESULT m_hResult;
  106. CString m_DispositionMessage;
  107. //
  108. BOOL LoadRenewalData();
  109. BOOL GetCertDescription(PCCERT_CONTEXT pCert,CERT_DESCRIPTION& desc);
  110. BOOL SetSecuritySettings();
  111. BOOL PrepareRequestString(CString& request_text, CCryptBlob& request_blob, BOOL bLoadFromRenewalData);
  112. BOOL WriteRequestString(CString& request);
  113. PCCERT_CONTEXT GetInstalledCert();
  114. PCCERT_CONTEXT GetPendingRequest();
  115. HRESULT CreateDN(CString& str);
  116. void GetCertificateTemplate(CString& str);
  117. CComPtr<IIISCertRequest> m_pObj;
  118. IIISCertRequest * GetObject(HRESULT * phr);
  119. IIISCertRequest * GetObject(HRESULT * phr, CString csServerName,CString csUserName OPTIONAL,CString csUserPassword OPTIONAL);
  120. IEnroll * GetEnrollObject();
  121. protected:
  122. PCCERT_CONTEXT m_pPendingRequest;
  123. IEnroll * m_pEnroll;
  124. int m_status_code; // what we are doing in this session
  125. };
  126. #endif
  127. #endif //__IISCERTREQUEST_H_