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.

243 lines
6.4 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows NT Security
  4. // Copyright (C) Microsoft Corporation, 1997 - 1999
  5. //
  6. // File: rporprov.h
  7. //
  8. // Contents: Remote PKI Object Retrieval Provider Prototypes
  9. //
  10. // History: 23-Jul-97 kirtd Created
  11. // 01-Jan-02 philh Moved from wininet to winhttp
  12. //
  13. //----------------------------------------------------------------------------
  14. #if !defined(__RPORPROV_H__)
  15. #define __RPORPROV_H__
  16. #include <md5.h>
  17. #if defined(__cplusplus)
  18. extern "C" {
  19. #endif
  20. // The cached URL Blob Arrays are stored at:
  21. // - %UserProfile%\Microsoft\CryptnetUrlCache\MetaData
  22. // - %UserProfile%\Microsoft\CryptnetUrlCache\Content
  23. //
  24. // Where each filename is the ASCII HEX of the MD5 hash of its Unicode URL
  25. // string excluding the NULL terminator.
  26. #define SCHEME_URL_FILENAME_LEN (MD5DIGESTLEN * 2 + 1)
  27. #define SCHEME_CRYPTNET_URL_CACHE_DIR L"\\Microsoft\\CryptnetUrlCache\\"
  28. #define SCHEME_META_DATA_SUBDIR L"MetaData"
  29. #define SCHEME_CCH_META_DATA_SUBDIR (wcslen(SCHEME_META_DATA_SUBDIR))
  30. #define SCHEME_CONTENT_SUBDIR L"Content"
  31. #define SCHEME_CCH_CONTENT_SUBDIR (wcslen(SCHEME_CONTENT_SUBDIR))
  32. // The MetaData file consists of:
  33. // - SCHEME_CACHE_META_DATA_HEADER (cbSize bytes in length)
  34. // - DWORD rgcbBlob[cBlob] - length of each blob in the Content file
  35. // - BYTE rgbUrl[cbUrl] - NULL terminated Unicode URL
  36. // The Content file consists of:
  37. // BYTE rgbBlob[][cBlob] - where the length of each blob is obtained from
  38. // rgcbBlob[] in the MetaData file
  39. typedef struct _SCHEME_CACHE_META_DATA_HEADER {
  40. DWORD cbSize;
  41. DWORD dwMagic;
  42. DWORD cBlob;
  43. DWORD cbUrl;
  44. FILETIME LastSyncTime;
  45. } SCHEME_CACHE_META_DATA_HEADER, *PSCHEME_CACHE_META_DATA_HEADER;
  46. #define SCHEME_CACHE_META_DATA_MAGIC 0x20020101
  47. //
  48. // Scheme provider prototypes
  49. //
  50. typedef BOOL (WINAPI *PFN_SCHEME_RETRIEVE_FUNC) (
  51. IN LPCWSTR pwszUrl,
  52. IN LPCSTR pszObjectOid,
  53. IN DWORD dwRetrievalFlags,
  54. IN DWORD dwTimeout,
  55. OUT PCRYPT_BLOB_ARRAY pObject,
  56. OUT PFN_FREE_ENCODED_OBJECT_FUNC* ppfnFreeObject,
  57. OUT LPVOID* ppvFreeContext,
  58. IN HCRYPTASYNC hAsyncRetrieve,
  59. IN PCRYPT_CREDENTIALS pCredentials,
  60. IN PCRYPT_RETRIEVE_AUX_INFO pAuxInfo
  61. );
  62. typedef BOOL (WINAPI *PFN_CONTEXT_CREATE_FUNC) (
  63. IN LPCSTR pszObjectOid,
  64. IN DWORD dwRetrievalFlags,
  65. IN PCRYPT_BLOB_ARRAY pObject,
  66. OUT LPVOID* ppvContext
  67. );
  68. //
  69. // Generic scheme provider utility functions
  70. //
  71. BOOL WINAPI
  72. SchemeCacheCryptBlobArray (
  73. IN LPCWSTR pwszUrl,
  74. IN DWORD dwRetrievalFlags,
  75. IN PCRYPT_BLOB_ARRAY pcba,
  76. IN PCRYPT_RETRIEVE_AUX_INFO pAuxInfo
  77. );
  78. BOOL WINAPI
  79. SchemeRetrieveCachedCryptBlobArray (
  80. IN LPCWSTR pwszUrl,
  81. IN DWORD dwRetrievalFlags,
  82. OUT PCRYPT_BLOB_ARRAY pcba,
  83. OUT PFN_FREE_ENCODED_OBJECT_FUNC* ppfnFreeObject,
  84. OUT LPVOID* ppvFreeContext,
  85. IN OUT PCRYPT_RETRIEVE_AUX_INFO pAuxInfo
  86. );
  87. BOOL WINAPI
  88. SchemeRetrieveUncachedAuxInfo (
  89. IN PCRYPT_RETRIEVE_AUX_INFO pAuxInfo
  90. );
  91. BOOL WINAPI
  92. SchemeDeleteUrlCacheEntry (
  93. IN LPCWSTR pwszUrl
  94. );
  95. VOID WINAPI
  96. SchemeFreeEncodedCryptBlobArray (
  97. IN LPCSTR pszObjectOid,
  98. IN PCRYPT_BLOB_ARRAY pcba,
  99. IN LPVOID pvFreeContext
  100. );
  101. BOOL WINAPI
  102. SchemeGetPasswordCredentialsW (
  103. IN PCRYPT_CREDENTIALS pCredentials,
  104. OUT PCRYPT_PASSWORD_CREDENTIALSW pPasswordCredentials,
  105. OUT BOOL* pfFreeCredentials
  106. );
  107. VOID WINAPI
  108. SchemeFreePasswordCredentialsW (
  109. IN PCRYPT_PASSWORD_CREDENTIALSW pPasswordCredentials
  110. );
  111. BOOL WINAPI
  112. SchemeGetAuthIdentityFromPasswordCredentialsW (
  113. IN PCRYPT_PASSWORD_CREDENTIALSW pPasswordCredentials,
  114. OUT PSEC_WINNT_AUTH_IDENTITY_W pAuthIdentity
  115. );
  116. VOID WINAPI
  117. SchemeFreeAuthIdentityFromPasswordCredentialsW (
  118. IN PCRYPT_PASSWORD_CREDENTIALSW pPasswordCredentials,
  119. IN OUT PSEC_WINNT_AUTH_IDENTITY_W pAuthIdentity
  120. );
  121. //
  122. // LDAP
  123. //
  124. #include <ldapsp.h>
  125. //
  126. // HTTP, HTTPS
  127. //
  128. #include <inetsp.h>
  129. //
  130. // Win32 File I/O
  131. //
  132. #include <filesp.h>
  133. //
  134. // Context Provider prototypes
  135. //
  136. //
  137. // Any, controlled via fQuerySingleContext and dwExpectedContentTypeFlags
  138. //
  139. BOOL WINAPI CreateObjectContext (
  140. IN DWORD dwRetrievalFlags,
  141. IN PCRYPT_BLOB_ARRAY pObject,
  142. IN DWORD dwExpectedContentTypeFlags,
  143. IN BOOL fQuerySingleContext,
  144. OUT LPVOID* ppvContext
  145. );
  146. //
  147. // Certificate
  148. //
  149. BOOL WINAPI CertificateCreateObjectContext (
  150. IN LPCSTR pszObjectOid,
  151. IN DWORD dwRetrievalFlags,
  152. IN PCRYPT_BLOB_ARRAY pObject,
  153. OUT LPVOID* ppvContext
  154. );
  155. //
  156. // CTL
  157. //
  158. BOOL WINAPI CTLCreateObjectContext (
  159. IN LPCSTR pszObjectOid,
  160. IN DWORD dwRetrievalFlags,
  161. IN PCRYPT_BLOB_ARRAY pObject,
  162. OUT LPVOID* ppvContext
  163. );
  164. //
  165. // CRL
  166. //
  167. BOOL WINAPI CRLCreateObjectContext (
  168. IN LPCSTR pszObjectOid,
  169. IN DWORD dwRetrievalFlags,
  170. IN PCRYPT_BLOB_ARRAY pObject,
  171. OUT LPVOID* ppvContext
  172. );
  173. //
  174. // PKCS7
  175. //
  176. BOOL WINAPI Pkcs7CreateObjectContext (
  177. IN LPCSTR pszObjectOid,
  178. IN DWORD dwRetrievalFlags,
  179. IN PCRYPT_BLOB_ARRAY pObject,
  180. OUT LPVOID* ppvContext
  181. );
  182. //
  183. // CAPI2 objects
  184. //
  185. BOOL WINAPI Capi2CreateObjectContext (
  186. IN LPCSTR pszObjectOid,
  187. IN DWORD dwRetrievalFlags,
  188. IN PCRYPT_BLOB_ARRAY pObject,
  189. OUT LPVOID* ppvContext
  190. );
  191. #if defined(__cplusplus)
  192. }
  193. #endif
  194. #endif