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.

334 lines
15 KiB

  1. //depot/Lab03_N/DS/security/cryptoapi/common/keysvc/keysvc.idl#7 - edit change 8790 (text)
  2. //depot/Lab03_N/DS/security/cryptoapi/common/keysvc/keysvc.idl#4 - edit change 6380 (text)
  3. //+-------------------------------------------------------------------------
  4. //
  5. // Microsoft Windows
  6. //
  7. // Copyright (C) Microsoft Corporation, 1997 - 1999
  8. //
  9. // File: keysvc.idl
  10. //
  11. //--------------------------------------------------------------------------
  12. import "unknwn.idl";
  13. import "basetsd.h";
  14. ////////////////////////////
  15. // Interfaces
  16. [
  17. uuid(8d0ffe72-d252-11d0-bf8f-00c04fd9126b),
  18. version(1.0),
  19. pointer_default(unique)
  20. ]
  21. interface IKeySvc
  22. {
  23. typedef struct _KEYSVC_UNICODE_STRING {
  24. USHORT Length;
  25. USHORT MaximumLength;
  26. //#ifdef MIDL_PASS
  27. [size_is(MaximumLength / 2), length_is((Length) / 2) ]
  28. //#endif // MIDL_PASS
  29. USHORT *Buffer;
  30. } KEYSVC_UNICODE_STRING, *PKEYSVC_UNICODE_STRING;
  31. typedef enum _KEYSVC_TYPE {
  32. KeySvcMachine,
  33. KeySvcService
  34. } KEYSVC_TYPE;
  35. typedef enum _KEYSVC_DEFTYPE {
  36. DefUserProv,
  37. DefMachineProv
  38. } KEYSVC_DEFTYPE;
  39. typedef ULONG KEYSVC_HANDLE, *PKEYSVC_HANDLE;
  40. typedef struct _KEYSVC_BLOB {
  41. ULONG cb;
  42. [size_is(cb), length_is(cb)]
  43. BYTE *pb;
  44. } KEYSVC_BLOB, *PKEYSVC_BLOB;
  45. // provider type and provider information
  46. typedef struct _KEYSVC_PROVIDER_INFO {
  47. KEYSVC_UNICODE_STRING Name;
  48. ULONG Flags;
  49. ULONG ProviderType;
  50. } KEYSVC_PROVIDER_INFO, *PKEYSVC_PROVIDER_INFO;
  51. // key information structures
  52. typedef struct _KEY_ID {
  53. ULONG Algid;
  54. ULONG dwKeySpec;
  55. } KEY_ID, *PKEY_ID;
  56. typedef struct _KEYSVC_KEY_INFO {
  57. KEYSVC_UNICODE_STRING KeyName;
  58. KEY_ID KeyID;
  59. } KEYSVC_KEY_INFO, *PKEYSVC_KEY_INFO;
  60. typedef struct _KEYSVC_KEYS {
  61. KEYSVC_UNICODE_STRING KeyName;
  62. ULONG cKeyIDs;
  63. //#ifdef MIDL_PASS
  64. [size_is(cKeyIDs), length_is(cKeyIDs) ]
  65. //#endif
  66. PKEY_ID pKeyIDs;
  67. } KEYSVC_KEYS, *PKEYSVC_KEYS;
  68. typedef enum _KEYSVC_INFOTYPE {
  69. KeySvcPublicKey,
  70. KeySvcVerifyHaveKey
  71. } KEYSVC_INFOTYPE;
  72. typedef struct _KEYSVC_RSAINFO {
  73. ULONG Algid;
  74. ULONG cbHash;
  75. BYTE rgbHash[40];
  76. } KEYSVC_RSAINFO;
  77. typedef struct _KEYSVC_CERT_HASH {
  78. BYTE rgb[20];
  79. } KEYSVC_CERT_HASH;
  80. typedef struct _KEYSVC_CERT_INFO {
  81. PKEYSVC_BLOB pCert;
  82. KEYSVC_CERT_HASH CertHash;
  83. KEYSVC_UNICODE_STRING KeyName;
  84. } KEYSVC_CERT_INFO, *PKEYSVC_CERT_INFO;
  85. //
  86. typedef struct _KEYSVC_CERT_REQUEST_PVK_NEW {
  87. ULONG ulProvType; //Optional: The provider type. If this field
  88. // is 0, pwszProvider is ignored
  89. KEYSVC_UNICODE_STRING Provider; //Optional: The name of the provider.
  90. // NULL means the default
  91. ULONG ulProviderFlags; //Optional: The flag passed to CryptAcquireContext
  92. KEYSVC_UNICODE_STRING KeyContainer; //Optional: The private key container. If this value is NULL,
  93. // a new key container will be generated. Its name is guaranteed
  94. // to be unique.
  95. ULONG ulKeySpec; //Optional: The key specification of the private key
  96. ULONG ulGenKeyFlags; //Optional: The flags for CryptGenKey
  97. } KEYSVC_CERT_REQUEST_PVK_NEW, *PKEYSVC_CERT_REQUEST_PVK_NEW;
  98. typedef struct _KEYSVC_CERT_REQUEST_PVK_NEW_V2 {
  99. ULONG ulProvType; //Optional: The provider type. If this field
  100. // is 0, pwszProvider is ignored
  101. KEYSVC_UNICODE_STRING Provider; //Optional: The name of the provider.
  102. // NULL means the default
  103. ULONG ulProviderFlags; //Optional: The flag passed to CryptAcquireContext
  104. KEYSVC_UNICODE_STRING KeyContainer; //Optional: The private key container. If this value is NULL,
  105. // a new key container will be generated. Its name is guaranteed
  106. // to be unique.
  107. ULONG ulKeySpec; //Optional: The key specification of the private key
  108. ULONG ulGenKeyFlags; //Optional: The flags for CryptGenKey
  109. ULONG ulEnrollmentFlags; //Optional: The enrollment cert type flags
  110. ULONG ulSubjectNameFlags; //Optional: The subject name cert type flags
  111. ULONG ulPrivateKeyFlags; //Optional: The private key cert type flags
  112. ULONG ulGeneralFlags; //Optional: The general cert type flags
  113. } KEYSVC_CERT_REQUEST_PVK_NEW_V2, *PKEYSVC_CERT_REQUEST_PVK_NEW_V2;
  114. typedef struct _KEYSVC_CERT_BLOB {
  115. DWORD cbData;
  116. //#ifdef MIDL_PASS
  117. [size_is(cbData), length_is(cbData) ]
  118. //#endif
  119. BYTE *pbData;
  120. } KEYSVC_CERT_BLOB, *PKEYSVC_CERT_BLOB;
  121. typedef struct _KEYSVC_CERT_EXTENSION {
  122. LPSTR pszObjId;
  123. BOOL fCritical;
  124. DWORD cbData;
  125. //#ifdef MIDL_PASS
  126. [size_is(cbData), length_is(cbData) ]
  127. //#endif
  128. BYTE *pbData;
  129. // KEYSVC_CERT_BLOB Value;
  130. } KEYSVC_CERT_EXTENSION, *PKEYSVC_CERT_EXTENSION;
  131. typedef struct _KEYSVC_CERT_EXTENSIONS {
  132. ULONG cExtension;
  133. //#ifdef MIDL_PASS
  134. [size_is(cExtension), length_is(cExtension) ]
  135. //#endif
  136. KEYSVC_CERT_EXTENSION *rgExtension;
  137. } KEYSVC_CERT_EXTENSIONS, *PKEYSVC_CERT_EXTENSIONS;
  138. typedef struct _KEYSVC_CERT_ENROLL_INFO
  139. {
  140. KEYSVC_UNICODE_STRING UsageOID;
  141. KEYSVC_UNICODE_STRING CertDNName;
  142. ULONG ulPostOption; //Required: A bit wise OR of the following value:
  143. // REQUEST_POST_ON_DS
  144. // REQUEST_POST_ON_CSP
  145. KEYSVC_UNICODE_STRING FriendlyName; //Optional: The friendly name of the certificate
  146. KEYSVC_UNICODE_STRING Description; //Optional: The description of the certificate
  147. KEYSVC_UNICODE_STRING Attributes; //Optional: Attributes for certificate request
  148. ULONG cExtensions;
  149. //#ifdef MIDL_PASS
  150. [size_is(cExtensions), length_is(cExtensions) ]
  151. //#endif
  152. PKEYSVC_CERT_EXTENSIONS *prgExtensions;
  153. }KEYSVC_CERT_ENROLL_INFO, *PKEYSVC_CERT_ENROLL_INFO;
  154. typedef struct _KEYSVC_OPEN_KEYSVC_INFO {
  155. ULONG ulSize; // For struct versioning
  156. ULONG ulVersion;
  157. }KEYSVC_OPEN_KEYSVC_INFO, *PKEYSVC_OPEN_KEYSVC_INFO;
  158. typedef struct _KEYSVC_QUERY_CERT_REQUEST_INFO {
  159. ULONG ulSize; // sizeof(CRYPTUI_WIZ_QUERY_CERT_REQUEST_INFO)
  160. ULONG ulStatus; // set of flags, see below
  161. } KEYSVC_QUERY_CERT_REQUEST_INFO, *PKEYSVC_QUERY_CERT_REQUEST_INFO;
  162. ULONG KeyrOpenKeyService(
  163. [in] handle_t hRPCBinding,
  164. [in] KEYSVC_TYPE OwnerType,
  165. [in] PKEYSVC_UNICODE_STRING pOwnerName,
  166. [in] ULONG ulDesiredAccess,
  167. [in] PKEYSVC_BLOB pAuthentication,
  168. [in, out] PKEYSVC_BLOB *ppReserved,
  169. [out] KEYSVC_HANDLE *phKeySvc);
  170. ULONG KeyrEnumerateProviders(
  171. [in] handle_t hRPCBinding,
  172. [in] KEYSVC_HANDLE hKeySvc,
  173. [in, out] PKEYSVC_BLOB *ppReserved,
  174. [in, out] ULONG *pcProviderCount,
  175. [in, out][size_is(,*pcProviderCount)]
  176. PKEYSVC_PROVIDER_INFO *ppProviders);
  177. ULONG KeyrCloseKeyService(
  178. [in] handle_t hRPCBinding,
  179. [in] KEYSVC_HANDLE hKeySvc,
  180. [in, out] PKEYSVC_BLOB *ppReserved);
  181. ULONG KeyrGetDefaultProvider(
  182. [in] handle_t hRPCBinding,
  183. [in] KEYSVC_HANDLE hKeySvc,
  184. [in] ULONG ulProvType,
  185. [in] ULONG ulFlags,
  186. [in, out] PKEYSVC_BLOB *ppReserved,
  187. [out] ULONG *pulDefType,
  188. [out] PKEYSVC_PROVIDER_INFO *ppProvider);
  189. ULONG KeyrEnroll(
  190. [in] handle_t hRPCBinding,
  191. [in] BOOL fKeyService, //IN Required: Whether the function is called remotely
  192. [in] ULONG ulPurpose, //IN Required: Specify the purpose - enrollment/renewal
  193. [in] PKEYSVC_UNICODE_STRING pAcctName, //IN Optional: Account name the service runs under
  194. [in] PKEYSVC_UNICODE_STRING pCALocation, //IN Required: The ca machine name
  195. [in] PKEYSVC_UNICODE_STRING pCAName, //IN Required: The ca name
  196. [in] BOOL fNewKey, //IN Required: Set the TRUE if new private key is needed
  197. [in] PKEYSVC_CERT_REQUEST_PVK_NEW pKeyNew, //IN Required: The private key information
  198. [in] PKEYSVC_BLOB pCert, //IN Optional: The old cert when renewing
  199. [in] PKEYSVC_CERT_REQUEST_PVK_NEW pRenewKey, //IN Optional: The new private key information when renewing
  200. [in] PKEYSVC_UNICODE_STRING pHashAlg, //IN Optional: The hash algorithm
  201. [in] PKEYSVC_UNICODE_STRING pDesStore, //IN Optional: The destination store
  202. [in] ULONG ulStoreFlags, //IN Optional: Flags for cert store
  203. [in] PKEYSVC_CERT_ENROLL_INFO pRequestInfo, //IN Required: The information about the cert request
  204. [in] ULONG ulFlags, //IN Reserved: Should be 0
  205. [in, out] PKEYSVC_BLOB *ppReserved,
  206. [out] PKEYSVC_BLOB *ppPKCS7Blob, //OUT Optional: The PKCS7 from the CA
  207. [out] PKEYSVC_BLOB *ppHashBlob, //OUT Optioanl: The SHA1 hash of the enrolled/renewed certificate
  208. [out] ULONG *pulStatus); //OUT Optional: The status of the enrollment/renewal
  209. ULONG KeyrEnumerateAvailableCertTypes(
  210. [in] handle_t hRPCBinding,
  211. [in] KEYSVC_HANDLE hKeySvc,
  212. [in, out] PKEYSVC_BLOB *ppReserved,
  213. [in, out] ULONG *pcCertTypeCount,
  214. [in, out][size_is(,*pcCertTypeCount)]
  215. PKEYSVC_UNICODE_STRING *ppCertTypes);
  216. ULONG KeyrEnumerateCAs(
  217. [in] handle_t hRPCBinding,
  218. [in] KEYSVC_HANDLE hKeySvc,
  219. [in, out] PKEYSVC_BLOB *ppReserved,
  220. [in] ULONG ulFlags,
  221. [in, out] ULONG *pcCACount,
  222. [in, out][size_is(,*pcCACount)]
  223. PKEYSVC_UNICODE_STRING *ppCAs);
  224. ULONG KeyrEnroll_V2(
  225. [in] handle_t hRPCBinding,
  226. [in] BOOL fKeyService, //IN Required: Whether the function is called remotely
  227. [in] ULONG ulPurpose, //IN Required: Specify the purpose - enrollment/renewal
  228. [in] ULONG ulFlags, //IN Required: Enrollment flags.
  229. [in] PKEYSVC_UNICODE_STRING pAcctName, //IN Optional: Account name the service runs under
  230. [in] PKEYSVC_UNICODE_STRING pCALocation, //IN Required: The ca machine name
  231. [in] PKEYSVC_UNICODE_STRING pCAName, //IN Required: The ca name
  232. [in] BOOL fNewKey, //IN Required: Set the TRUE if new private key is needed
  233. [in] PKEYSVC_CERT_REQUEST_PVK_NEW_V2 pKeyNew, //IN Required: The private key information
  234. [in] PKEYSVC_BLOB pCert, //IN Optional: The old cert when renewing
  235. [in] PKEYSVC_CERT_REQUEST_PVK_NEW_V2 pRenewKey, //IN Optional: The new private key information when renewing
  236. [in] PKEYSVC_UNICODE_STRING pHashAlg, //IN Optional: The hash algorithm
  237. [in] PKEYSVC_UNICODE_STRING pDesStore, //IN Optional: The destination store
  238. [in] ULONG ulStoreFlags, //IN Optional: Flags for cert store
  239. [in] PKEYSVC_CERT_ENROLL_INFO pRequestInfo, //IN Required: The information about the cert request
  240. [in] ULONG ulReservedFlags, //IN Reserved: Must be 0.
  241. [in, out] PKEYSVC_BLOB *ppReserved, //IN OUT Reserved: Must be NULL.
  242. [in, out] PKEYSVC_BLOB *phRequest, //OUT Optional: The HANDLE to a created request (in 3-stage enrollment)
  243. [out] PKEYSVC_BLOB *ppPKCS7Blob, //OUT Optional: The PKCS7 from the CA
  244. [out] PKEYSVC_BLOB *ppHashBlob, //OUT Optioanl: The SHA1 hash of the enrolled/renewed certificate
  245. [out] ULONG *pulStatus); //OUT Optional: The status of the enrollment/renewal
  246. ULONG KeyrQueryRequestStatus
  247. ([in] handle_t hRPCBinding,
  248. [in] unsigned __int64 hRequest,
  249. [out, ref] KEYSVC_QUERY_CERT_REQUEST_INFO *pQueryInfo);
  250. }
  251. [
  252. uuid(a3b749b1-e3d0-4967-a521-124055d1c37d),
  253. version(1.0),
  254. pointer_default(unique)
  255. ]
  256. interface IKeySvcR // Remote keysvc
  257. {
  258. ULONG RKeyrOpenKeyService
  259. ([in] handle_t hRPCBinding,
  260. [in] KEYSVC_TYPE OwnerType,
  261. [in] PKEYSVC_UNICODE_STRING pOwnerName,
  262. [in] ULONG ulDesiredAccess,
  263. [in] PKEYSVC_BLOB pAuthentication,
  264. [in, out] PKEYSVC_BLOB *ppReserved,
  265. [out] KEYSVC_HANDLE *phKeySvc);
  266. ULONG RKeyrCloseKeyService
  267. ([in] handle_t hRPCBinding,
  268. [in] KEYSVC_HANDLE hKeySvc,
  269. [in, out] PKEYSVC_BLOB *ppReserved);
  270. ULONG RKeyrPFXInstall
  271. ([in] handle_t hRPCBinding,
  272. [in] PKEYSVC_BLOB pPFX,
  273. [in] PKEYSVC_UNICODE_STRING pPassword,
  274. [in] ULONG ulFlags);
  275. }
  276. // Define version constants.
  277. cpp_quote("#define KEYSVC_VERSION_W2K 0x0001")
  278. cpp_quote("#define KEYSVC_VERSION_WHISTLER 0x0002")