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.

199 lines
5.2 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows NT Security
  4. // Copyright (C) Microsoft Corporation, 1997 - 1999
  5. //
  6. // File: orm.h
  7. //
  8. // Contents: Object Retrieval Manager class definition
  9. //
  10. // History: 24-Jul-97 kirtd Created
  11. // 01-Jan-02 philh Changed to internally use UNICODE Urls
  12. //
  13. //----------------------------------------------------------------------------
  14. #if !defined(__ORM_H__)
  15. #define __ORM_H__
  16. //
  17. // IRefCountedObject. Abstract base class to provide reference counting
  18. //
  19. class IRefCountedObject
  20. {
  21. public:
  22. virtual VOID AddRef () = 0;
  23. virtual VOID Release () = 0;
  24. };
  25. //
  26. // IObjectRetriever. Abstract base class for object retrieval
  27. //
  28. class IObjectRetriever : public IRefCountedObject
  29. {
  30. public:
  31. virtual BOOL RetrieveObjectByUrl (
  32. LPCWSTR pwszUrl,
  33. LPCSTR pszObjectOid,
  34. DWORD dwRetrievalFlags,
  35. DWORD dwTimeout,
  36. LPVOID* ppvObject,
  37. PFN_FREE_ENCODED_OBJECT_FUNC* ppfnFreeObject,
  38. LPVOID* ppvFreeContext,
  39. HCRYPTASYNC hAsyncRetrieve,
  40. PCRYPT_CREDENTIALS pCredentials,
  41. LPVOID pvVerify,
  42. PCRYPT_RETRIEVE_AUX_INFO pAuxInfo
  43. ) = 0;
  44. virtual BOOL CancelAsyncRetrieval () = 0;
  45. };
  46. //
  47. // CObjectRetrievalManager. Manages retrieval of PKI objects when requested
  48. // via CryptRetrieveObjectByUrl.
  49. //
  50. class CObjectRetrievalManager : public IObjectRetriever
  51. {
  52. public:
  53. //
  54. // Construction
  55. //
  56. CObjectRetrievalManager ();
  57. ~CObjectRetrievalManager ();
  58. //
  59. // IRefCountedObject methods
  60. //
  61. virtual VOID AddRef ();
  62. virtual VOID Release ();
  63. //
  64. // IObjectRetriever methods
  65. //
  66. virtual BOOL RetrieveObjectByUrl (
  67. LPCWSTR pwszUrl,
  68. LPCSTR pszObjectOid,
  69. DWORD dwRetrievalFlags,
  70. DWORD dwTimeout,
  71. LPVOID* ppvObject,
  72. PFN_FREE_ENCODED_OBJECT_FUNC* ppfnFreeObject,
  73. LPVOID* ppvFreeContext,
  74. HCRYPTASYNC hAsyncRetrieve,
  75. PCRYPT_CREDENTIALS pCredentials,
  76. LPVOID pvVerify,
  77. PCRYPT_RETRIEVE_AUX_INFO pAuxInfo
  78. );
  79. virtual BOOL CancelAsyncRetrieval ();
  80. //
  81. // Retrieval Notification methods
  82. //
  83. BOOL OnRetrievalCompletion (
  84. DWORD dwCompletionCode,
  85. LPCWSTR pwszUrl,
  86. LPCSTR pszObjectOid,
  87. DWORD dwRetrievalFlags,
  88. PCRYPT_BLOB_ARRAY pObject,
  89. PFN_FREE_ENCODED_OBJECT_FUNC pfnFreeObject,
  90. LPVOID pvFreeContext,
  91. LPVOID pvVerify,
  92. LPVOID* ppvObject
  93. );
  94. private:
  95. //
  96. // Reference count
  97. //
  98. ULONG m_cRefs;
  99. //
  100. // Scheme Provider entry points
  101. //
  102. HCRYPTOIDFUNCADDR m_hSchemeRetrieve;
  103. PFN_SCHEME_RETRIEVE_FUNC m_pfnSchemeRetrieve;
  104. //
  105. // Context Provider entry points
  106. //
  107. HCRYPTOIDFUNCADDR m_hContextCreate;
  108. PFN_CONTEXT_CREATE_FUNC m_pfnContextCreate;
  109. //
  110. // Private methods
  111. //
  112. //
  113. // Parameter validation
  114. //
  115. BOOL ValidateRetrievalArguments (
  116. LPCWSTR pwszUrl,
  117. LPCSTR pszObjectOid,
  118. DWORD dwRetrievalFlags,
  119. DWORD dwTimeout,
  120. LPVOID* ppvObject,
  121. HCRYPTASYNC hAsyncRetrieve,
  122. PCRYPT_CREDENTIALS pCredentials,
  123. LPVOID pvVerify,
  124. PCRYPT_RETRIEVE_AUX_INFO pAuxInfo
  125. );
  126. //
  127. // Provider initialization
  128. //
  129. BOOL LoadProviders (
  130. LPCWSTR pwszUrl,
  131. LPCSTR pszObjectOid
  132. );
  133. VOID UnloadProviders ();
  134. //
  135. // Provider entry point usage
  136. //
  137. BOOL CallSchemeRetrieveObjectByUrl (
  138. LPCWSTR pwszUrl,
  139. LPCSTR pszObjectOid,
  140. DWORD dwRetrievalFlags,
  141. DWORD dwTimeout,
  142. PCRYPT_BLOB_ARRAY pObject,
  143. PFN_FREE_ENCODED_OBJECT_FUNC* ppfnFreeObject,
  144. LPVOID* ppvFreeContext,
  145. HCRYPTASYNC hAsyncRetrieve,
  146. PCRYPT_CREDENTIALS pCredentials,
  147. PCRYPT_RETRIEVE_AUX_INFO pAuxInfo
  148. );
  149. BOOL CallContextCreateObjectContext (
  150. LPCSTR pszObjectOid,
  151. DWORD dwRetrievalFlags,
  152. PCRYPT_BLOB_ARRAY pObject,
  153. LPVOID* ppvContext
  154. );
  155. };
  156. //
  157. // Provider table externs
  158. //
  159. extern HCRYPTOIDFUNCSET hSchemeRetrieveFuncSet;
  160. extern HCRYPTOIDFUNCSET hContextCreateFuncSet;
  161. #endif