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.

381 lines
17 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 KeyrEnumerateProviderTypes(
  178. [in] handle_t hRPCBinding,
  179. [in] KEYSVC_HANDLE hKeySvc,
  180. [in, out] PKEYSVC_BLOB *ppReserved,
  181. [in, out] ULONG *pcProviderCount,
  182. [in, out][size_is(,*pcProviderCount)]
  183. PKEYSVC_PROVIDER_INFO *ppProviders);
  184. ULONG KeyrEnumerateProvContainers(
  185. [in] handle_t hRPCBinding,
  186. [in] KEYSVC_HANDLE hKeySvc,
  187. [in] KEYSVC_PROVIDER_INFO Provider,
  188. [in, out] PKEYSVC_BLOB *ppReserved,
  189. [in, out] ULONG *pcContainerCount,
  190. [in, out][size_is(,*pcContainerCount)]
  191. PKEYSVC_UNICODE_STRING *ppContainers);
  192. ULONG KeyrCloseKeyService(
  193. [in] handle_t hRPCBinding,
  194. [in] KEYSVC_HANDLE hKeySvc,
  195. [in, out] PKEYSVC_BLOB *ppReserved);
  196. ULONG KeyrGetDefaultProvider(
  197. [in] handle_t hRPCBinding,
  198. [in] KEYSVC_HANDLE hKeySvc,
  199. [in] ULONG ulProvType,
  200. [in] ULONG ulFlags,
  201. [in, out] PKEYSVC_BLOB *ppReserved,
  202. [out] ULONG *pulDefType,
  203. [out] PKEYSVC_PROVIDER_INFO *ppProvider);
  204. ULONG KeyrSetDefaultProvider(
  205. [in] handle_t hRPCBinding,
  206. [in] KEYSVC_HANDLE hKeySvc,
  207. [in] ULONG ulFlags,
  208. [in, out] PKEYSVC_BLOB *ppReserved,
  209. [in] KEYSVC_PROVIDER_INFO Provider);
  210. ULONG KeyrEnroll(
  211. [in] handle_t hRPCBinding,
  212. [in] BOOL fKeyService, //IN Required: Whether the function is called remotely
  213. [in] ULONG ulPurpose, //IN Required: Specify the purpose - enrollment/renewal
  214. [in] PKEYSVC_UNICODE_STRING pAcctName, //IN Optional: Account name the service runs under
  215. [in] PKEYSVC_UNICODE_STRING pCALocation, //IN Required: The ca machine name
  216. [in] PKEYSVC_UNICODE_STRING pCAName, //IN Required: The ca name
  217. [in] BOOL fNewKey, //IN Required: Set the TRUE if new private key is needed
  218. [in] PKEYSVC_CERT_REQUEST_PVK_NEW pKeyNew, //IN Required: The private key information
  219. [in] PKEYSVC_BLOB pCert, //IN Optional: The old cert when renewing
  220. [in] PKEYSVC_CERT_REQUEST_PVK_NEW pRenewKey, //IN Optional: The new private key information when renewing
  221. [in] PKEYSVC_UNICODE_STRING pHashAlg, //IN Optional: The hash algorithm
  222. [in] PKEYSVC_UNICODE_STRING pDesStore, //IN Optional: The destination store
  223. [in] ULONG ulStoreFlags, //IN Optional: Flags for cert store
  224. [in] PKEYSVC_CERT_ENROLL_INFO pRequestInfo, //IN Required: The information about the cert request
  225. [in] ULONG ulFlags, //IN Reserved: Should be 0
  226. [in, out] PKEYSVC_BLOB *ppReserved,
  227. [out] PKEYSVC_BLOB *ppPKCS7Blob, //OUT Optional: The PKCS7 from the CA
  228. [out] PKEYSVC_BLOB *ppHashBlob, //OUT Optioanl: The SHA1 hash of the enrolled/renewed certificate
  229. [out] ULONG *pulStatus); //OUT Optional: The status of the enrollment/renewal
  230. ULONG KeyrExportCert(
  231. [in] handle_t hRPCBinding,
  232. [in] KEYSVC_HANDLE hKeySvc,
  233. [in] PKEYSVC_UNICODE_STRING pPassword,
  234. [in] PKEYSVC_UNICODE_STRING pCertStore,
  235. [in] ULONG cHashCount,
  236. [in][size_is(cHashCount)]
  237. KEYSVC_CERT_HASH *pHashes,
  238. [in] ULONG ulFlags,
  239. [in, out] PKEYSVC_BLOB *ppReserved,
  240. [out] PKEYSVC_BLOB *ppPFXBlob);
  241. ULONG KeyrImportCert(
  242. [in] handle_t hRPCBinding,
  243. [in] KEYSVC_HANDLE hKeySvc,
  244. [in] PKEYSVC_UNICODE_STRING pPassword,
  245. [in] PKEYSVC_UNICODE_STRING pCertStore,
  246. [in] PKEYSVC_BLOB pPFXBlob,
  247. [in] ULONG ulFlags,
  248. [in, out] PKEYSVC_BLOB *ppReserved);
  249. ULONG KeyrEnumerateAvailableCertTypes(
  250. [in] handle_t hRPCBinding,
  251. [in] KEYSVC_HANDLE hKeySvc,
  252. [in, out] PKEYSVC_BLOB *ppReserved,
  253. [in, out] ULONG *pcCertTypeCount,
  254. [in, out][size_is(,*pcCertTypeCount)]
  255. PKEYSVC_UNICODE_STRING *ppCertTypes);
  256. ULONG KeyrEnumerateCAs(
  257. [in] handle_t hRPCBinding,
  258. [in] KEYSVC_HANDLE hKeySvc,
  259. [in, out] PKEYSVC_BLOB *ppReserved,
  260. [in] ULONG ulFlags,
  261. [in, out] ULONG *pcCACount,
  262. [in, out][size_is(,*pcCACount)]
  263. PKEYSVC_UNICODE_STRING *ppCAs);
  264. ULONG KeyrEnroll_V2(
  265. [in] handle_t hRPCBinding,
  266. [in] BOOL fKeyService, //IN Required: Whether the function is called remotely
  267. [in] ULONG ulPurpose, //IN Required: Specify the purpose - enrollment/renewal
  268. [in] ULONG ulFlags, //IN Required: Enrollment flags.
  269. [in] PKEYSVC_UNICODE_STRING pAcctName, //IN Optional: Account name the service runs under
  270. [in] PKEYSVC_UNICODE_STRING pCALocation, //IN Required: The ca machine name
  271. [in] PKEYSVC_UNICODE_STRING pCAName, //IN Required: The ca name
  272. [in] BOOL fNewKey, //IN Required: Set the TRUE if new private key is needed
  273. [in] PKEYSVC_CERT_REQUEST_PVK_NEW_V2 pKeyNew, //IN Required: The private key information
  274. [in] PKEYSVC_BLOB pCert, //IN Optional: The old cert when renewing
  275. [in] PKEYSVC_CERT_REQUEST_PVK_NEW_V2 pRenewKey, //IN Optional: The new private key information when renewing
  276. [in] PKEYSVC_UNICODE_STRING pHashAlg, //IN Optional: The hash algorithm
  277. [in] PKEYSVC_UNICODE_STRING pDesStore, //IN Optional: The destination store
  278. [in] ULONG ulStoreFlags, //IN Optional: Flags for cert store
  279. [in] PKEYSVC_CERT_ENROLL_INFO pRequestInfo, //IN Required: The information about the cert request
  280. [in] ULONG ulReservedFlags, //IN Reserved: Must be 0.
  281. [in, out] PKEYSVC_BLOB *ppReserved, //IN OUT Reserved: Must be NULL.
  282. [in, out] PKEYSVC_BLOB *phRequest, //OUT Optional: The HANDLE to a created request (in 3-stage enrollment)
  283. [out] PKEYSVC_BLOB *ppPKCS7Blob, //OUT Optional: The PKCS7 from the CA
  284. [out] PKEYSVC_BLOB *ppHashBlob, //OUT Optioanl: The SHA1 hash of the enrolled/renewed certificate
  285. [out] ULONG *pulStatus); //OUT Optional: The status of the enrollment/renewal
  286. ULONG KeyrQueryRequestStatus
  287. ([in] handle_t hRPCBinding,
  288. [in] unsigned __int64 hRequest,
  289. [out, ref] KEYSVC_QUERY_CERT_REQUEST_INFO *pQueryInfo);
  290. }
  291. [
  292. uuid(a3b749b1-e3d0-4967-a521-124055d1c37d),
  293. version(1.0),
  294. pointer_default(unique)
  295. ]
  296. interface IKeySvcR // Remote keysvc
  297. {
  298. ULONG RKeyrOpenKeyService
  299. ([in] handle_t hRPCBinding,
  300. [in] KEYSVC_TYPE OwnerType,
  301. [in] PKEYSVC_UNICODE_STRING pOwnerName,
  302. [in] ULONG ulDesiredAccess,
  303. [in] PKEYSVC_BLOB pAuthentication,
  304. [in, out] PKEYSVC_BLOB *ppReserved,
  305. [out] KEYSVC_HANDLE *phKeySvc);
  306. ULONG RKeyrCloseKeyService
  307. ([in] handle_t hRPCBinding,
  308. [in] KEYSVC_HANDLE hKeySvc,
  309. [in, out] PKEYSVC_BLOB *ppReserved);
  310. ULONG RKeyrPFXInstall
  311. ([in] handle_t hRPCBinding,
  312. [in] PKEYSVC_BLOB pPFX,
  313. [in] PKEYSVC_UNICODE_STRING pPassword,
  314. [in] ULONG ulFlags);
  315. }
  316. // Define version constants.
  317. cpp_quote("#define KEYSVC_VERSION_W2K 0x0001")
  318. cpp_quote("#define KEYSVC_VERSION_WHISTLER 0x0002")