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.

112 lines
4.1 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. BOOL
  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);
  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. #endif //_CERTUTIL_H