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.

164 lines
5.0 KiB

  1. //+--------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (c) 1997-1999 Microsoft Corporation
  5. //
  6. // File: clrhouse.h
  7. //
  8. // Contents:
  9. // All Clearing house related function
  10. //
  11. // History:
  12. //
  13. // Note:
  14. //---------------------------------------------------------------------------
  15. #ifndef __LICENSE_SERVER_CLEARING_HOUSE_H__
  16. #define __LICENSE_SERVER_CLEARING_HOUSE_H__
  17. //-----------------------------------------------------------------------------
  18. //
  19. // Registry key for storing various certificates
  20. //
  21. #define LSERVER_CERTIFICATE_STORE_BASE LSERVER_SERVER_CERTIFICATE_REGKEY
  22. //-----------------------------------------------------------------------------
  23. // Actual License Server Certificate
  24. //
  25. #define LSERVER_CERTIFICATE_STORE_SIGNATURE "Signature"
  26. #define LSERVER_CERTIFICATE_STORE_EXCHANGE "Exchange"
  27. //-----------------------------------------------------------------------------
  28. // License Server Certificate Chain
  29. //
  30. #define LSERVER_CERTIFICATE_CHAIN_SIGNATURE "SignatureChain"
  31. #define LSERVER_CERTIFICATE_CHAIN_EXCHANGE "ExchangeChain"
  32. #define LSERVER_CERTIFICATE_STORE_CA "CA"
  33. #define LSERVER_CERTIFICATE_STORE_RA "RA"
  34. #define LSERVER_CERTIFICATE_STORE_CH "CH"
  35. #define LSERVER_CERTIFICATE_STORE_ROOT "ROOT"
  36. //------------------------------------------------------------------------------
  37. //
  38. // Registry key for CA certificate
  39. //
  40. #define LSERVER_CERTIFICATE_REG_CA_SIGNATURE \
  41. LSERVER_CERTIFICATE_STORE_BASE _TEXT("\\") _TEXT(LSERVER_CERTIFICATE_STORE_SIGNATURE) _TEXT("\\") _TEXT(LSERVER_CERTIFICATE_STORE_CA)
  42. #define LSERVER_CERTIFICATE_REG_CA_EXCHANGE \
  43. LSERVER_CERTIFICATE_STORE_BASE _TEXT("\\") _TEXT(LSERVER_CERTIFICATE_STORE_EXCHANGE) _TEXT("\\") _TEXT(LSERVER_CERTIFICATE_STORE_CA)
  44. //------------------------------------------------------------------------------
  45. //
  46. // Registry key for RA certificate
  47. //
  48. #define LSERVER_CERTIFICATE_REG_MF_SIGNATURE \
  49. LSERVER_CERTIFICATE_STORE_BASE _TEXT("\\") _TEXT(LSERVER_CERTIFICATE_STORE_SIGNATURE) _TEXT("\\") _TEXT(LSERVER_CERTIFICATE_STORE_RA)
  50. #define LSERVER_CERTIFICATE_REG_MF_EXCHANGE \
  51. LSERVER_CERTIFICATE_STORE_BASE _TEXT("\\") _TEXT(LSERVER_CERTIFICATE_STORE_EXCHANGE) _TEXT("\\") _TEXT(LSERVER_CERTIFICATE_STORE_RA)
  52. //------------------------------------------------------------------------------
  53. //
  54. // Registry key for CH certificate
  55. //
  56. #define LSERVER_CERTIFICATE_REG_CH_SIGNATURE \
  57. LSERVER_CERTIFICATE_STORE_BASE _TEXT("\\") _TEXT(LSERVER_CERTIFICATE_STORE_SIGNATURE) _TEXT("\\") _TEXT(LSERVER_CERTIFICATE_STORE_CH)
  58. #define LSERVER_CERTIFICATE_REG_CH_EXCHANGE \
  59. LSERVER_CERTIFICATE_STORE_BASE _TEXT("\\") _TEXT(LSERVER_CERTIFICATE_STORE_EXCHANGE) _TEXT("\\") _TEXT(LSERVER_CERTIFICATE_STORE_CH)
  60. //------------------------------------------------------------------------------
  61. //
  62. // Registry key for ROOT certificate
  63. //
  64. #define LSERVER_CERTIFICATE_REG_ROOT_SIGNATURE \
  65. LSERVER_CERTIFICATE_STORE_BASE _TEXT("\\") _TEXT(LSERVER_CERTIFICATE_STORE_SIGNATURE) _TEXT("\\") _TEXT(LSERVER_CERTIFICATE_STORE_ROOT)
  66. #define LSERVER_CERTIFICATE_REG_ROOT_EXCHANGE \
  67. LSERVER_CERTIFICATE_STORE_BASE _TEXT("\\") _TEXT(LSERVER_CERTIFICATE_STORE_EXCHANGE) _TEXT("\\") _TEXT(LSERVER_CERTIFICATE_STORE_ROOT)
  68. #ifdef __cplusplus
  69. extern "C" {
  70. #endif
  71. BOOL
  72. TLSChainIssuerCertificate(
  73. HCRYPTPROV hCryptProv,
  74. HCERTSTORE hChainFromStore,
  75. HCERTSTORE hChainToStore,
  76. PCCERT_CONTEXT pSubjectContext
  77. );
  78. HCERTSTORE
  79. CertOpenRegistryStore(
  80. HKEY hKeyType,
  81. LPCTSTR szSubKey,
  82. HCRYPTPROV hCryptProv,
  83. HKEY* phKey
  84. );
  85. DWORD
  86. TLSSaveCertAsPKCS7(
  87. PBYTE pbCert,
  88. DWORD cbCert,
  89. PBYTE* ppbEncodedCert,
  90. PDWORD pcbEncodedCert
  91. );
  92. DWORD
  93. IsCertificateLicenseServerCertificate(
  94. IN HCRYPTPROV hCryptProv,
  95. IN DWORD dwCertType,
  96. IN DWORD cbPKCS7Cert,
  97. IN PBYTE pbPKCS7Cert,
  98. IN OUT DWORD* cbLsCert,
  99. IN OUT PBYTE* pbLsCert
  100. );
  101. DWORD
  102. TLSSaveRootCertificateToReg(
  103. HCRYPTPROV hCryptProv,
  104. HKEY hKey,
  105. DWORD cbEncodedCert,
  106. PBYTE pbEncodedCert
  107. );
  108. DWORD
  109. TLSSaveCertificateToReg(
  110. HCRYPTPROV hCryptProv,
  111. HKEY hKey,
  112. DWORD cbPKCS7Cert,
  113. PBYTE pbPKCS7Cert
  114. );
  115. DWORD
  116. TLSSaveRootCertificatesToStore(
  117. IN HCRYPTPROV hCryptProv,
  118. IN DWORD cbSignatureCert,
  119. IN PBYTE pbSignatureCert,
  120. IN DWORD cbExchangeCert,
  121. IN PBYTE pbExchangeCert
  122. );
  123. DWORD
  124. TLSSaveCertificatesToStore(
  125. IN HCRYPTPROV hCryptProv,
  126. IN DWORD dwCertType,
  127. IN DWORD dwCertLevel,
  128. IN DWORD cbSignatureCert,
  129. IN PBYTE pbSignatureCert,
  130. IN DWORD cbExchangeCert,
  131. IN PBYTE pbExchangeCert
  132. );
  133. #ifdef __cplusplus
  134. }
  135. #endif
  136. #endif