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.

147 lines
7.4 KiB

  1. //
  2. // CertUtil.h
  3. //
  4. #ifndef _CERTUTIL_H
  5. #define _CERTUTIL_H
  6. #include <wincrypt.h>
  7. #include <CertCli.h>
  8. #include <xenroll.h>
  9. #include "Certificat.h"
  10. BOOL GetOnlineCAList(CStringList& list, const CString& certType, HRESULT * phRes);
  11. BOOL GetRequestInfoFromPKCS10(CCryptBlob& pkcs10,
  12. PCERT_REQUEST_INFO * pReqInfo,
  13. HRESULT * phRes);
  14. PCCERT_CONTEXT GetPendingDummyCert(const CString& inst_name,
  15. IEnroll * pEnroll,
  16. HRESULT * phRes);
  17. HCERTSTORE OpenRequestStore(IEnroll * pEnroll, HRESULT * phResult);
  18. HCERTSTORE OpenMyStore(IEnroll * pEnroll, HRESULT * phResult);
  19. PCCERT_CONTEXT GetCertContextFromPKCS7File(const CString& resp_file_name,
  20. CERT_PUBLIC_KEY_INFO * pKeyInfo,
  21. HRESULT * phResult);
  22. PCCERT_CONTEXT GetCertContextFromPKCS7(const BYTE * pbData, DWORD cbData,
  23. CERT_PUBLIC_KEY_INFO * pKeyInfo,
  24. HRESULT * phResult);
  25. PCCERT_CONTEXT GetRequestContext(CCryptBlob& pkcs10, HRESULT * phRes);
  26. BOOL GetRequestInfoFromPKCS10(CCryptBlob& pkcs10,
  27. PCERT_REQUEST_INFO * pReqInfo,
  28. HRESULT * phRes);
  29. //BOOL GetRequestInfoFromRenewalRequest(CCryptBlob& renewal_req,
  30. // PCCERT_CONTEXT * pSignerCert,
  31. // HCERTSTORE hStore,
  32. // PCERT_REQUEST_INFO * pReqInfo,
  33. // HRESULT * phRes);
  34. PCCERT_CONTEXT GetReqCertByKey(IEnroll * pEnroll,
  35. CERT_PUBLIC_KEY_INFO * pKeyInfo,
  36. HRESULT * phResult);
  37. BOOL FormatDateString(CString& str,
  38. FILETIME ft,
  39. BOOL fIncludeTime,
  40. BOOL fLongFormat);
  41. BOOL
  42. GetKeyUsageProperty(PCCERT_CONTEXT pCertContext,
  43. CERT_ENHKEY_USAGE ** pKeyUsage,
  44. BOOL fPropertiesOnly,
  45. HRESULT * phRes);
  46. INT
  47. ContainsKeyUsageProperty(PCCERT_CONTEXT pCertContext,
  48. CArray<LPCSTR, LPCSTR>& uses,
  49. HRESULT * phRes);
  50. BOOL FormatEnhancedKeyUsageString(CString& str,
  51. PCCERT_CONTEXT pCertContext,
  52. BOOL fPropertiesOnly,
  53. BOOL fMultiline,
  54. HRESULT * phRes);
  55. PCCERT_CONTEXT
  56. GetInstalledCert(const CString& machine_name,
  57. const CString& server_name,
  58. IEnroll * pEnroll,
  59. HRESULT * phResult);
  60. BOOL
  61. InstallCertByHash(CRYPT_HASH_BLOB * pHash,
  62. const CString& machine_name,
  63. const CString& server_name,
  64. IEnroll * pEnroll,
  65. HRESULT * phResult);
  66. BOOL
  67. InstallHashToMetabase(CRYPT_HASH_BLOB * pHash,
  68. const CString& machine_name,
  69. const CString& server_name,
  70. HRESULT * phResult);
  71. HRESULT CreateRequest_Base64(const BSTR bstr_dn,
  72. IEnroll * pEnroll,
  73. BSTR csp_name,
  74. DWORD csp_type,
  75. BSTR * pOut);
  76. BOOL AttachFriendlyName(PCCERT_CONTEXT pContext, const CString& name, HRESULT * phRes);
  77. BOOL GetFriendlyName(PCCERT_CONTEXT pCertContext,
  78. CString& name,
  79. HRESULT * phRes);
  80. BOOL GetNameString(PCCERT_CONTEXT pCertContext,
  81. DWORD type,
  82. DWORD flag,
  83. CString& name,
  84. HRESULT * phRes);
  85. BOOL GetHashProperty(PCCERT_CONTEXT pCertContext, CCryptBlob& hash_blob, HRESULT * phRes);
  86. BOOL GetStringProperty(PCCERT_CONTEXT pCertContext, DWORD propId, CString& str, HRESULT * phRes);
  87. BOOL GetBlobProperty(PCCERT_CONTEXT pCertContext,
  88. DWORD propId,
  89. CCryptBlob& blob,
  90. HRESULT * phRes);
  91. BOOL EncodeString(CString& str, CCryptBlob& blob, HRESULT * phRes);
  92. BOOL EncodeInteger(int number, CCryptBlob& blob, HRESULT * phRes);
  93. BOOL EncodeBlob(CCryptBlob& in, CCryptBlob& out, HRESULT * phRes);
  94. BOOL DecodeBlob(CCryptBlob& in, CCryptBlob& out, HRESULT * phRes);
  95. BOOL GetServerComment(const CString& machine_name, const CString& server_name,
  96. CString& comment, HRESULT * phResult);
  97. void FormatRdnAttr(CString& str, DWORD dwValueType, CRYPT_DATA_BLOB& blob, BOOL fAppend);
  98. BOOL CreateDirectoryFromPath(LPCTSTR szPath, LPSECURITY_ATTRIBUTES lpSA);
  99. BOOL CompactPathToWidth(CWnd * pControl, CString& strPath);
  100. BOOL GetKeySizeLimits(IEnroll * pEnroll,
  101. DWORD * min, DWORD * max, DWORD * def,
  102. BOOL bGSC,
  103. HRESULT * phRes);
  104. HRESULT ShutdownSSL(CString& machine_name, CString& server_name);
  105. HRESULT HereIsVtArrayGimmieBinary(VARIANT * lpVarSrcObject,DWORD * cbBinaryBufferSize,char **pbBinaryBuffer,BOOL bReturnBinaryAsVT_VARIANT);
  106. CERT_CONTEXT * GetInstalledCertFromHash(HRESULT * phResult,DWORD cbHashBlob, char * pHashBlob);
  107. BOOL ViewCertificateDialog(CRYPT_HASH_BLOB* pcrypt_hash, HWND hWnd);
  108. HRESULT IsCertUsedBySSLBelowMe(CString& machine_name, CString& server_name, CStringList& listFillMe);
  109. CRYPT_HASH_BLOB * GetInstalledCertHash(const CString& machine_name,const CString& server_name,IEnroll * pEnroll,HRESULT * phResult);
  110. HRESULT EnumSitesWithCertInstalled(CString& machine_name,CString& user_name,CString& user_password,CString strCurrentMetabaseSite,CString strSiteToExclude,CStringListEx * MyStringList);
  111. BOOL GetServerComment(const CString& machine_name,const CString& user_name,const CString& user_password,CString& MetabaseNode,CString& comment,HRESULT * phResult);
  112. HRESULT EnumSites(CString& machine_name,CString& user_name,CString& user_password,CString strCurrentMetabaseSite,CString strSiteToExclude,CStringListEx * MyStringList);
  113. #define FAILURE 0
  114. #define DID_NOT_FIND_CONSTRAINT 1
  115. #define FOUND_CONSTRAINT_BUT_THIS_IS_A_CA_OR_ITS_NOT_AN_END_ENTITY 2
  116. #define FOUND_CONSTRAINT 3
  117. int CheckCertConstraints(PCCERT_CONTEXT pCC);
  118. BOOL IsCertExportable(PCCERT_CONTEXT pCertContext);
  119. BOOL IsCertExportableOnRemoteMachine(CString ServerName,CString UserName,CString UserPassword,CString InstanceName);
  120. BOOL DumpCertDesc(char * pBlobInfo);
  121. BOOL GetCertDescInfo(CString ServerName,CString UserName,CString UserPassword,CString InstanceName,CERT_DESCRIPTION* desc);
  122. BOOL IsWhistlerWorkstation(void);
  123. HRESULT IsWebServerExistRemote(CString& machine_name,CString& user_name,CString& user_password,CString csCurrentMetabaseInstanceName);
  124. BOOL IsWebSiteExistRemote(CString& machine_name,CString& user_name,CString& user_password,CString& site_instance_path,BOOL * bReturnIfCertificateExists);
  125. HRESULT IsCertObjExistRemote(CString& machine_name,CString& user_name,CString& user_password);
  126. void MsgboxPopup(HRESULT hResult);
  127. BOOL IsMachineLocal(CString& machine_name,CString& user_name,CString& user_password);
  128. CString ReturnGoodMetabaseServerPath(CString csInstanceName);
  129. BOOL GetAlternateSubjectName(PCCERT_CONTEXT pCertContext,TCHAR ** cwszOut);
  130. HRESULT DisplayUsageBySitesOfCert(LPCTSTR PFXFileName,LPCTSTR PFXPassword,CString &machine_name,CString &user_name,CString &user_password,CString &current_site);
  131. BOOL IsWebServerType(CString strMetabaseNode);
  132. BOOL WriteSSLPortToSite( const CString& machine_name,const CString& server_name,const CString& SSLPort,HRESULT * phResult);
  133. BOOL GetSSLPortFromSite(const CString& machine_name,const CString& server_name,CString& strSSLPort,HRESULT * phResult);
  134. BOOL IsSSLPortBeingUsedOnNonSSLPort(const CString& machine_name,const CString& server_name,const CString& strSSLPort,HRESULT * phResult);
  135. HRESULT CreateRequest_Base64(const BSTR bstr_dn, IEnroll * pEnroll, BSTR csp_name,DWORD csp_type,BSTR * pOut);
  136. BOOL CheckForCertificateRenewal(DWORD dwProtocol,PCCERT_CONTEXT pCertContext,PCCERT_CONTEXT *ppNewCertificate);
  137. #endif //_CERTUTIL_H