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.

227 lines
5.6 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1997.
  5. //
  6. // File: certutil.h
  7. //
  8. // Contents:
  9. //
  10. // Classes:
  11. //
  12. // Functions:
  13. //
  14. // History: 03-18-97 HueiWang Created
  15. //
  16. //----------------------------------------------------------------------------
  17. #ifndef __LICENSE_VERIFY_H__
  18. #define __LICENSE_VERIFY_H__
  19. #include <windows.h>
  20. #include <wincrypt.h>
  21. typedef BOOL (*EnumerateCertNameInfoCallBack)(PCERT_RDN_ATTR pCertRdnAttr, HANDLE dwUserData);
  22. #ifndef AllocateMemory
  23. #define AllocMemory(size) LocalAlloc(LPTR, size)
  24. #define FreeMemory(ptr) if(ptr) LocalFree(ptr)
  25. #endif
  26. //
  27. // SP3 build environment problem.
  28. //
  29. #define LSCERT_ALT_NAME_OTHER_NAME 1
  30. #define LSCERT_ALT_NAME_RFC822_NAME 2
  31. #define LSCERT_ALT_NAME_DNS_NAME 3
  32. #define LSCERT_ALT_NAME_X400_ADDRESS 4
  33. #define LSCERT_ALT_NAME_DIRECTORY_NAME 5
  34. #define LSCERT_ALT_NAME_EDI_PARTY_NAME 6
  35. #define LSCERT_ALT_NAME_URL 7
  36. #define LSCERT_ALT_NAME_IP_ADDRESS 8
  37. #define LSCERT_ALT_NAME_REGISTERED_ID 9
  38. typedef struct _LSCERT_ALT_NAME_ENTRY {
  39. DWORD dwAltNameChoice;
  40. union {
  41. CRYPT_ATTRIBUTE_TYPE_VALUE OtherName;
  42. LPWSTR pwszRfc822Name;
  43. LPWSTR pwszDNSName;
  44. CRYPT_ATTRIBUTE_TYPE_VALUE x400Address;
  45. CERT_NAME_BLOB DirectoryName;
  46. LPWSTR pwszEdiPartyName;
  47. LPWSTR pszURL;
  48. CRYPT_DATA_BLOB IPAddress;
  49. LPSTR pszRegisteredID;
  50. };
  51. } LSCERT_ALT_NAME_ENTRY, *PLSCERT_ALT_NAME_ENTRY;
  52. typedef struct _LSCERT_ALT_NAME_INFO {
  53. DWORD cAltEntry;
  54. PLSCERT_ALT_NAME_ENTRY rgAltEntry;
  55. } LSCERT_ALT_NAME_INFO, *PLSCERT_ALT_NAME_INFO;
  56. typedef struct _LSCERT_AUTHORITY_KEY_ID2_INFO {
  57. CRYPT_DATA_BLOB KeyId;
  58. LSCERT_ALT_NAME_INFO AuthorityCertIssuer;
  59. CRYPT_INTEGER_BLOB AuthorityCertSerialNumber;
  60. } LSCERT_AUTHORITY_KEY_ID2_INFO, *PLSCERT_AUTHORITY_KEY_ID2_INFO;
  61. #define szOID_X509_AUTHORITY_KEY_ID2 "2.5.29.35"
  62. #define szOID_X509_AUTHORITY_ACCESS_INFO "1.3.6.1.5.5.7.1.1"
  63. #define szOID_X509_ACCESS_PKIX_OCSP "1.3.6.1.5.5.7.48.1"
  64. typedef struct _LSCERT_ACCESS_DESCRIPTION {
  65. LPSTR pszAccessMethod; // pszObjId
  66. LSCERT_ALT_NAME_ENTRY AccessLocation;
  67. } LSCERT_ACCESS_DESCRIPTION, *PLSCERT_ACCESS_DESCRIPTION;
  68. typedef struct _LSCERT_AUTHORITY_INFO_ACCESS {
  69. DWORD cAccDescr;
  70. PLSCERT_ACCESS_DESCRIPTION rgAccDescr;
  71. } LSCERT_AUTHORITY_INFO_ACCESS, *PLSCERT_AUTHORITY_INFO_ACCESS;
  72. #if UNICODE
  73. #define CAST_PBYTE (USHORT *)
  74. #else
  75. #define CAST_PBYTE
  76. #endif
  77. #define CERT_X509_MULTI_BYTE_INTEGER ((LPCSTR) 28)
  78. #ifdef __cplusplus
  79. extern "C" {
  80. #endif
  81. void
  82. LSShutdownCertutilLib();
  83. BOOL
  84. LSInitCertutilLib(
  85. HCRYPTPROV hProv
  86. );
  87. void
  88. LSFreeLicensedProduct(
  89. PLICENSEDPRODUCT pLicensedProduct
  90. );
  91. LICENSE_STATUS
  92. LSVerifyDecodeClientLicense(
  93. IN PBYTE pbLicense,
  94. IN DWORD cbLicense,
  95. IN PBYTE pbSecretKey,
  96. IN DWORD cbSecretKey,
  97. IN OUT PDWORD pdwNumLicensedInfo,
  98. IN OUT PLICENSEDPRODUCT pLicensedInfo
  99. );
  100. LICENSE_STATUS
  101. LSVerifyCertificateChain(
  102. HCRYPTPROV hCryptProv,
  103. HCERTSTORE hCertStore
  104. );
  105. DWORD
  106. LSCryptDecodeObject(
  107. IN DWORD dwEncodingType,
  108. IN LPCSTR lpszStructType,
  109. IN const BYTE * pbEncoded,
  110. IN DWORD cbEncoded,
  111. IN DWORD dwFlags,
  112. OUT void ** pvStructInfo,
  113. IN OUT DWORD * pcbStructInfo
  114. );
  115. DWORD
  116. LSLicensedProductInfoToExtension(
  117. DWORD dwQuantity,
  118. DWORD dwPlatformId,
  119. DWORD dwLangId,
  120. PBYTE pbOriginalProductId,
  121. DWORD cbOriginalProductId,
  122. PBYTE pbAdjustedProductId,
  123. DWORD cbAdjustedProductId,
  124. LICENSED_VERSION_INFO* pLicensedVersionInfo,
  125. DWORD dwNumLicensedVersionInfo,
  126. PBYTE *pbData,
  127. PDWORD cbData
  128. );
  129. DWORD
  130. LSExtensionToMsLicensedProductInfo(
  131. PBYTE pbData,
  132. DWORD cbData,
  133. PDWORD pdwQuantity,
  134. PDWORD pdwPlatformId,
  135. PDWORD pdwLanguagId,
  136. PBYTE* ppbOriginalProductId,
  137. PDWORD pcbOriginalProductId,
  138. PBYTE* ppbAdjustedProductId,
  139. PDWORD pcbAdjustedProductId,
  140. LICENSED_VERSION_INFO** ppLicenseInfo,
  141. PDWORD pdwNumberLicensedVersionInfo
  142. );
  143. DWORD
  144. LSEnumerateCertNameInfo(
  145. LPBYTE pbData,
  146. DWORD cbData,
  147. EnumerateCertNameInfoCallBack func,
  148. HANDLE dwUserData
  149. );
  150. LICENSE_STATUS
  151. LSEncryptClientHWID(HWID* pHwid,
  152. PBYTE pbData,
  153. PDWORD cbData,
  154. PBYTE pbSecretKey,
  155. DWORD cbSecretKey);
  156. LICENSE_STATUS
  157. LSDecodeClientHWID( PBYTE pbData,
  158. DWORD cbData,
  159. PBYTE pbSecretKey,
  160. DWORD cbSecretKey,
  161. HWID* pHwid);
  162. LICENSE_STATUS
  163. LicenseGetSecretKey(
  164. PDWORD pcbSecretKey,
  165. BYTE FAR * pSecretKey
  166. );
  167. LICENSE_STATUS
  168. LSExtensionToMsLicenseServerInfo(
  169. PBYTE pbData,
  170. DWORD cbData,
  171. LPTSTR* szIssuer,
  172. LPTSTR* szIssuerId,
  173. LPTSTR* szScope
  174. );
  175. LICENSE_STATUS
  176. LSMsLicenseServerInfoToExtension(
  177. LPTSTR szIssuer,
  178. LPTSTR szIssuerId,
  179. LPTSTR szScope,
  180. PBYTE* pbData,
  181. PDWORD cbData
  182. );
  183. LICENSE_STATUS
  184. DecodeLicense20(
  185. IN PCERT_INFO pCertInfo,
  186. IN PBYTE pbSecretKey,
  187. IN DWORD cbSecretKey,
  188. IN OUT PLICENSEDPRODUCT pLicensedInfo,
  189. IN OUT ULARGE_INTEGER* ulSerialNumber
  190. );
  191. #ifdef __cplusplus
  192. };
  193. #endif
  194. #endif