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.

505 lines
15 KiB

  1. //+--------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1996 - 1999
  5. //
  6. // File: csprop2.h
  7. //
  8. // Contents: Cert Server Property interfaces
  9. //
  10. //---------------------------------------------------------------------------
  11. #ifndef __CSPROP2_H__
  12. #define __CSPROP2_H__
  13. #ifndef _JET_RED_
  14. #include <certdb.h>
  15. #endif // _JET_RED_
  16. // begin_certsrv
  17. //+--------------------------------------------------------------------------
  18. // Name properties:
  19. #define wszPROPDISTINGUISHEDNAME TEXT("DistinguishedName")
  20. #define wszPROPRAWNAME TEXT("RawName")
  21. #define wszPROPNAMETYPE TEXT("NameType")
  22. #define wszPROPCOUNTRY TEXT("Country")
  23. #define wszPROPORGANIZATION TEXT("Organization")
  24. #define wszPROPORGUNIT TEXT("OrgUnit")
  25. #define wszPROPCOMMONNAME TEXT("CommonName")
  26. #define wszPROPLOCALITY TEXT("Locality")
  27. #define wszPROPSTATE TEXT("State")
  28. #define wszPROPTITLE TEXT("Title")
  29. #define wszPROPGIVENNAME TEXT("GivenName")
  30. #define wszPROPINITIALS TEXT("Initials")
  31. #define wszPROPSURNAME TEXT("SurName")
  32. #define wszPROPDOMAINCOMPONENT TEXT("DomainComponent")
  33. #define wszPROPEMAIL TEXT("EMail")
  34. #define wszPROPSTREETADDRESS TEXT("StreetAddress")
  35. //+--------------------------------------------------------------------------
  36. // Subject Name properties:
  37. #define wszPROPSUBJECTDOT TEXT("Subject.")
  38. #define wszPROPSUBJECTDISTINGUISHEDNAME \
  39. wszPROPSUBJECTDOT wszPROPDISTINGUISHEDNAME
  40. #define wszPROPSUBJECTRAWNAME wszPROPSUBJECTDOT wszPROPRAWNAME
  41. #define wszPROPSUBJECTNAMETYPE wszPROPSUBJECTDOT wszPROPNAMETYPE
  42. #define wszPROPSUBJECTCOUNTRY wszPROPSUBJECTDOT wszPROPCOUNTRY
  43. #define wszPROPSUBJECTORGANIZATION wszPROPSUBJECTDOT wszPROPORGANIZATION
  44. #define wszPROPSUBJECTORGUNIT wszPROPSUBJECTDOT wszPROPORGUNIT
  45. #define wszPROPSUBJECTCOMMONNAME wszPROPSUBJECTDOT wszPROPCOMMONNAME
  46. #define wszPROPSUBJECTLOCALITY wszPROPSUBJECTDOT wszPROPLOCALITY
  47. #define wszPROPSUBJECTSTATE wszPROPSUBJECTDOT wszPROPSTATE
  48. #define wszPROPSUBJECTTITLE wszPROPSUBJECTDOT wszPROPTITLE
  49. #define wszPROPSUBJECTGIVENNAME wszPROPSUBJECTDOT wszPROPGIVENNAME
  50. #define wszPROPSUBJECTINITIALS wszPROPSUBJECTDOT wszPROPINITIALS
  51. #define wszPROPSUBJECTSURNAME wszPROPSUBJECTDOT wszPROPSURNAME
  52. #define wszPROPSUBJECTDOMAINCOMPONENT wszPROPSUBJECTDOT wszPROPDOMAINCOMPONENT
  53. #define wszPROPSUBJECTEMAIL wszPROPSUBJECTDOT wszPROPEMAIL
  54. #define wszPROPSUBJECTSTREETADDRESS wszPROPSUBJECTDOT wszPROPSTREETADDRESS
  55. // end_certsrv
  56. //+--------------------------------------------------------------------------
  57. // Issuer Name properties:
  58. #define wszPROPISSUERDOT TEXT("Issuer.")
  59. #define wszPROPISSUERDISTINGUISHEDNAME \
  60. wszPROPISSUERDOT wszPROPDISTINGUISHEDNAME
  61. #define wszPROPISSUERRAWNAME wszPROPISSUERDOT wszPROPRAWNAME
  62. #define wszPROPISSUERNAMETYPE wszPROPISSUERDOT wszPROPNAMETYPE
  63. #define wszPROPISSUERCOUNTRY wszPROPISSUERDOT wszPROPCOUNTRY
  64. #define wszPROPISSUERORGANIZATION wszPROPISSUERDOT wszPROPORGANIZATION
  65. #define wszPROPISSUERORGUNIT wszPROPISSUERDOT wszPROPORGUNIT
  66. #define wszPROPISSUERCOMMONNAME wszPROPISSUERDOT wszPROPCOMMONNAME
  67. #define wszPROPISSUERLOCALITY wszPROPISSUERDOT wszPROPLOCALITY
  68. #define wszPROPISSUERSTATE wszPROPISSUERDOT wszPROPSTATE
  69. #define wszPROPISSUERTITLE wszPROPISSUERDOT wszPROPTITLE
  70. #define wszPROPISSUERGIVENNAME wszPROPISSUERDOT wszPROPGIVENNAME
  71. #define wszPROPISSUERINITIALS wszPROPISSUERDOT wszPROPINITIALS
  72. #define wszPROPISSUERSURNAME wszPROPISSUERDOT wszPROPSURNAME
  73. #define wszPROPISSUERDOMAINCOMPONENT wszPROPISSUERDOT wszPROPDOMAINCOMPONENT
  74. #define wszPROPISSUEREMAIL wszPROPISSUERDOT wszPROPEMAIL
  75. #define wszPROPISSUERSTREETADDRESS wszPROPSUBJECTDOT wszPROPSTREETADDRESS
  76. #define wszPROPISSUERCOUNTRYOBJID \
  77. wszPROPISSUERDOT TEXT(szOID_COUNTRY_NAME)
  78. #define wszPROPISSUERORGANIZATIONOBJID \
  79. wszPROPISSUERDOT TEXT(szOID_ORGANIZATION_NAME)
  80. #define wszPROPISSUERORGUNITOBJID \
  81. wszPROPISSUERDOT TEXT(szOID_ORGANIZATIONAL_UNIT_NAME)
  82. #define wszPROPISSUERCOMMONNAMEOBJID \
  83. wszPROPISSUERDOT TEXT(szOID_COMMON_NAME)
  84. #define wszPROPISSUERLOCALITYOBJID \
  85. wszPROPISSUERDOT TEXT(szOID_LOCALITY_NAME)
  86. #define wszPROPISSUERSTATEOBJID \
  87. wszPROPISSUERDOT TEXT(szOID_STATE_OR_PROVINCE_NAME)
  88. #define wszPROPISSUERTITLEOBJID \
  89. wszPROPISSUERDOT TEXT(szOID_TITLE)
  90. #define wszPROPISSUERGIVENNAMEOBJID \
  91. wszPROPISSUERDOT TEXT(szOID_GIVEN_NAME)
  92. #define wszPROPISSUERINITIALSOBJID \
  93. wszPROPISSUERDOT TEXT(szOID_INITIALS)
  94. #define wszPROPISSUERSURNAMEOBJID \
  95. wszPROPISSUERDOT TEXT(szOID_SUR_NAME)
  96. #define wszPROPISSUERDOMAINCOMPONENTOBJID \
  97. wszPROPISSUERDOT TEXT(szOID_DOMAIN_COMPONENT)
  98. #define wszPROPISSUEREMAILOBJID \
  99. wszPROPISSUERDOT TEXT(szOID_RSA_emailAddr)
  100. #define wszPROPISSUERSTREETADDRESSOBJID \
  101. wszPROPISSUERDOT TEXT(szOID_STREET_ADDRESS)
  102. //+--------------------------------------------------------------------------
  103. // For mapping request attribute names to internal property names:
  104. // Map to wszPROPSUBJECTCOUNTRY:
  105. #define wszATTRCOUNTRY1 TEXT("C")
  106. #define wszATTRCOUNTRY2 TEXT("Country")
  107. // Map to wszPROPSUBJECTORGANIZATION:
  108. #define wszATTRORG1 TEXT("O")
  109. #define wszATTRORG2 TEXT("Org")
  110. #define wszATTRORG3 TEXT("Organization")
  111. // Map to wszPROPSUBJECTORGUNIT:
  112. #define wszATTRORGUNIT1 TEXT("OU")
  113. #define wszATTRORGUNIT2 TEXT("OrgUnit")
  114. #define wszATTRORGUNIT3 TEXT("OrganizationUnit")
  115. #define wszATTRORGUNIT4 TEXT("OrganizationalUnit")
  116. // Map to wszPROPSUBJECTCOMMONNAME:
  117. #define wszATTRCOMMONNAME1 TEXT("CN")
  118. #define wszATTRCOMMONNAME2 TEXT("CommonName")
  119. // Map to wszPROPSUBJECTLOCALITY:
  120. #define wszATTRLOCALITY1 TEXT("L")
  121. #define wszATTRLOCALITY2 TEXT("Locality")
  122. // Map to wszPROPSUBJECTSTATE:
  123. #define wszATTRSTATE1 TEXT("S")
  124. #define wszATTRSTATE2 TEXT("ST")
  125. #define wszATTRSTATE3 TEXT("State")
  126. // Map to wszPROPSUBJECTTITLE:
  127. #define wszATTRTITLE1 TEXT("T")
  128. #define wszATTRTITLE2 TEXT("Title")
  129. // Map to wszPROPSUBJECTGIVENNAME:
  130. #define wszATTRGIVENNAME1 TEXT("G")
  131. #define wszATTRGIVENNAME2 TEXT("GivenName")
  132. // Map to wszPROPSUBJECTINITIALS:
  133. #define wszATTRINITIALS1 TEXT("I")
  134. #define wszATTRINITIALS2 TEXT("Initials")
  135. // Map to wszPROPSUBJECTSURNAME:
  136. #define wszATTRSURNAME1 TEXT("SN")
  137. #define wszATTRSURNAME2 TEXT("SurName")
  138. // Map to wszPROPSUBJECTDOMAINCOMPONENT:
  139. #define wszATTRDOMAINCOMPONENT1 TEXT("DC")
  140. #define wszATTRDOMAINCOMPONENT2 TEXT("DomainComponent")
  141. // Map to wszPROPSUBJECTEMAIL:
  142. #define wszATTREMAIL1 TEXT("E")
  143. #define wszATTREMAIL2 TEXT("EMail")
  144. // Map to wszPROPSUBJECTSTREETADDRESS:
  145. #define wszATTRSTREETADDRESS1 TEXT("Street")
  146. // begin_certsrv
  147. //+--------------------------------------------------------------------------
  148. // Request properties:
  149. #define wszPROPREQUESTREQUESTID TEXT("RequestID")
  150. #define wszPROPREQUESTRAWREQUEST TEXT("RawRequest")
  151. #define wszPROPREQUESTATTRIBUTES TEXT("RequestAttributes")
  152. #define wszPROPREQUESTTYPE TEXT("RequestType")
  153. #define wszPROPREQUESTFLAGS TEXT("RequestFlags")
  154. #define wszPROPREQUESTSTATUS TEXT("Status")
  155. #define wszPROPREQUESTSTATUSCODE TEXT("StatusCode")
  156. #define wszPROPREQUESTDISPOSITION TEXT("Disposition")
  157. #define wszPROPREQUESTDISPOSITIONMESSAGE TEXT("DispositionMessage")
  158. #define wszPROPREQUESTSUBMITTEDWHEN TEXT("SubmittedWhen")
  159. #define wszPROPREQUESTRESOLVEDWHEN TEXT("ResolvedWhen")
  160. #define wszPROPREQUESTREVOKEDWHEN TEXT("RevokedWhen")
  161. #define wszPROPREQUESTREVOKEDEFFECTIVEWHEN TEXT("RevokedEffectiveWhen")
  162. #define wszPROPREQUESTREVOKEDREASON TEXT("RevokedReason")
  163. #define wszPROPREQUESTSUBJECTNAMEID TEXT("SubjectNameID") // no_certsrv
  164. #define wszPROPREQUESTERNAME TEXT("RequesterName")
  165. #define wszPROPREQUESTERADDRESS TEXT("RequesterAddress") // no_certsrv
  166. //+--------------------------------------------------------------------------
  167. // Request attribute properties:
  168. #define wszPROPCHALLENGE TEXT("Challenge")
  169. #define wszPROPEXPECTEDCHALLENGE TEXT("ExpectedChallenge")
  170. //+--------------------------------------------------------------------------
  171. // Certificate properties:
  172. #define wszPROPCERTIFICATEREQUESTID TEXT("RequestID")
  173. #define wszPROPRAWCERTIFICATE TEXT("RawCertificate")
  174. #define wszPROPCERTIFICATEHASH TEXT("CertificateHash")
  175. #define wszPROPCERTIFICATETYPE TEXT("CertificateType")
  176. #define wszPROPCERTIFICATESERIALNUMBER TEXT("SerialNumber")
  177. #define wszPROPCERTIFICATEISSUERNAMEID TEXT("IssuerNameID") // no_certsrv
  178. #define wszPROPCERTIFICATESUBJECTNAMEID TEXT("SubjectNameID") // no_certsrv
  179. #define wszPROPCERTIFICATENOTBEFOREDATE TEXT("NotBefore")
  180. #define wszPROPCERTIFICATENOTAFTERDATE TEXT("NotAfter")
  181. #define wszPROPCERTIFICATERAWPUBLICKEY TEXT("RawPublicKey")
  182. #define wszPROPCERTIFICATEPUBLICKEYALGORITHM TEXT("PublicKeyAlgorithm")
  183. #define wszPROPCERTIFICATERAWPUBLICKEYALGORITHMPARAMETERS \
  184. TEXT("RawPublicKeyAlgorithmParameters")
  185. //+--------------------------------------------------------------------------
  186. // Certificate extension properties:
  187. #define EXTENSION_CRITICAL_FLAG 0x00000001
  188. #define EXTENSION_DISABLE_FLAG 0x00000002
  189. #define EXTENSION_POLICY_MASK 0x0000ffff // Settable by admin+policy
  190. #define EXTENSION_ORIGIN_REQUEST 0x00010000
  191. #define EXTENSION_ORIGIN_POLICY 0x00020000
  192. #define EXTENSION_ORIGIN_ADMIN 0x00030000
  193. #define EXTENSION_ORIGIN_SERVER 0x00040000
  194. #define EXTENSION_ORIGIN_MASK 0x000f0000
  195. //+--------------------------------------------------------------------------
  196. // GetProperty/SetProperty Flags:
  197. //
  198. // Choose one Type
  199. #define PROPTYPE_LONG 0x00000001 // Signed long
  200. #define PROPTYPE_DATE 0x00000002 // Date+Time
  201. #define PROPTYPE_BINARY 0x00000003 // Binary data
  202. #define PROPTYPE_STRING 0x00000004 // Unicode String
  203. #define PROPTYPE_ANSI 0x00000005 // Ansi String no_certsrv
  204. #define PROPTYPE_MASK 0x000000ff
  205. // end_certsrv
  206. // Choose one Caller:
  207. #define PROPCALLER_SERVER 0x00000100
  208. #define PROPCALLER_POLICY 0x00000200
  209. #define PROPCALLER_EXIT 0x00000300
  210. #define PROPCALLER_ADMIN 0x00000400
  211. #define PROPCALLER_REQUEST 0x00000500
  212. #define PROPCALLER_MASK 0x00000f00
  213. // Choose one Table:
  214. #define PROPTABLE_REQUEST 0x00001000
  215. #define PROPTABLE_CERTIFICATE 0x00002000
  216. #define PROPTABLE_EXTENSION 0x00003000
  217. #define PROPTABLE_ATTRIBUTE 0x00004000
  218. #define PROPTABLE_MASK 0x0000f000
  219. #define PROPTABLE_EXTENSIONFLAGS 0x00010000
  220. #define PROPTABLE_EXTENSIONVALUE 0x00020000
  221. #define _254 254 // arbirtrary length
  222. #define _64 64 // arbirtrary length
  223. #define cchATTRIBUTESMAX _254
  224. #define cchATTRIBUTEVALUEMAX _64
  225. #define cchATTRIBUTENAMEMAX _64
  226. #define cchREQUESTDISPOSITIONMESSAGE _64
  227. #define cchREQUESTERNAMEMAX _64
  228. #define cchREQUESTERADDRESSMAX _64
  229. #define cchHASHMAX _64
  230. #define cchSERIALNUMBERMAX _64
  231. #define cchOBJECTIDMAX 31
  232. #define cchPROPVALUEMAX _64
  233. #define cchDISTINGUISHEDNAMEMAX 254
  234. #define cchCOUNTRYNAMEMAX 2
  235. #define cchORGANIZATIONNAMEMAX _64
  236. #define cchORGANIZATIONALUNITNAMEMAX _64
  237. #define cchCOMMONNAMEMAX _64
  238. #define cchLOCALITYMANAMEMAX _64
  239. #define cchSTATEORPROVINCENAMEMAX _64
  240. #define cchTITLEMAX _64
  241. #define cchGIVENNAMEMAX _64
  242. #define cchINITIALSMAX _64
  243. #define cchSURNAMEMAX _64
  244. #define cchDOMAINCOMPONENTMAX _64
  245. #define cchEMAILMAX _64
  246. #define cchSTREETADDRESSMAX _64
  247. // begin_certsrv
  248. // Request Status property values:
  249. #define REQSTATUS_ACTIVE 1
  250. #define REQSTATUS_ACCEPTED 2
  251. #define REQSTATUS_DENIED 3
  252. #define REQSTATUS_PENDING 4
  253. #define REQSTATUS_ERROR 5
  254. // end_certsrv
  255. HRESULT
  256. PropParseRequest(
  257. #ifdef _JET_RED_
  258. IN DWORD ReqId,
  259. #else // _JET_RED_
  260. IN ICertDBRow *prow,
  261. #endif // _JET_RED_
  262. IN DWORD dwFlags,
  263. IN DWORD cbRequest,
  264. IN BYTE const *pbRequest);
  265. HRESULT
  266. PropSetRequestTimeProperty(
  267. #ifdef _JET_RED_
  268. IN DWORD ReqId,
  269. #else // _JET_RED_
  270. IN ICertDBRow *prow,
  271. #endif // _JET_RED_
  272. IN WCHAR const *pwszProp);
  273. HRESULT
  274. PropGetExtension(
  275. #ifdef _JET_RED_
  276. IN DWORD ReqId,
  277. #else // _JET_RED_
  278. IN ICertDBRow *prow,
  279. #endif // _JET_RED_
  280. IN DWORD Flags,
  281. IN WCHAR const *pwszExtensionName,
  282. OUT DWORD *pdwExtFlags,
  283. OUT DWORD *pcbValue,
  284. OUT BYTE **ppbValue);
  285. HRESULT
  286. PropSetExtension(
  287. #ifdef _JET_RED_
  288. IN DWORD ReqId,
  289. #else // _JET_RED_
  290. IN ICertDBRow *prow,
  291. #endif // _JET_RED_
  292. IN DWORD Flags,
  293. IN WCHAR const *pwszExtensionName,
  294. IN DWORD ExtFlags,
  295. IN DWORD cbValue,
  296. IN BYTE const *pbValue);
  297. // CertIF property callback support:
  298. typedef HRESULT (WINAPI FNCIGETPROPERTY)(
  299. IN LONG Context,
  300. IN DWORD Flags,
  301. IN WCHAR const *pwszPropertyName,
  302. OUT VARIANT *pvarPropertyValue);
  303. FNCIGETPROPERTY PropCIGetProperty;
  304. typedef HRESULT (WINAPI FNCISETPROPERTY)(
  305. IN LONG Context,
  306. IN DWORD Flags,
  307. IN WCHAR const *pwszPropertyName,
  308. IN VARIANT const *pvarPropertyValue);
  309. FNCISETPROPERTY PropCISetProperty;
  310. typedef HRESULT (WINAPI FNCIGETEXTENSION)(
  311. IN LONG Context,
  312. IN DWORD Flags,
  313. IN WCHAR const *pwszExtensionName,
  314. OUT DWORD *pdwExtFlags,
  315. OUT VARIANT *pvarValue);
  316. FNCIGETEXTENSION PropCIGetExtension;
  317. typedef HRESULT (WINAPI FNCISETEXTENSION)(
  318. IN LONG Context,
  319. IN DWORD Flags,
  320. IN WCHAR const *pwszExtensionName,
  321. IN DWORD ExtFlags,
  322. IN VARIANT const *pvarValue);
  323. FNCISETEXTENSION PropCISetExtension;
  324. // CertIF property enumeration callback support:
  325. #define CIE_OBJECTID 0x00000001 // return object ids for names
  326. #define CIE_TABLE_EXTENSIONS 0x00000010
  327. #define CIE_TABLE_ATTRIBUTES 0x00000020
  328. #define CIE_TABLE_MASK 0x000000f0
  329. class CIENUM {
  330. public:
  331. CIENUM() { m_penum = NULL; }
  332. HRESULT EnumSetup(IN LONG Context, IN DWORD Flags);
  333. HRESULT EnumNext(OUT BSTR *pstrPropertyName);
  334. HRESULT EnumClose();
  335. private:
  336. #ifdef _JET_RED_
  337. LONG m_Flags;
  338. HANDLE m_penum;
  339. #else // _JET_RED_
  340. IEnumCERTDBNAME *m_penum;
  341. #endif // _JET_RED_
  342. };
  343. typedef HRESULT (WINAPI FNCIENUMSETUP)(
  344. IN LONG Context,
  345. IN DWORD Flags,
  346. IN OUT CIENUM *pciEnum);
  347. FNCIENUMSETUP PropCIEnumSetup;
  348. typedef HRESULT (WINAPI FNCIENUMNEXT)(
  349. IN OUT CIENUM *pciEnum,
  350. OUT BSTR *pstrPropertyName);
  351. FNCIENUMNEXT PropCIEnumNext;
  352. typedef HRESULT (WINAPI FNCIENUMCLOSE)(
  353. IN OUT CIENUM *pciEnum);
  354. FNCIENUMCLOSE PropCIEnumClose;
  355. #ifdef _JET_RED_
  356. #define wszPROPCERTIFICATEEXTENSIONFLAGS TEXT("Flags")
  357. #define wszPROPCERTIFICATEEXTENSIONVALUE TEXT("Value")
  358. DWORD // ERROR_*
  359. PropCreateRequest(
  360. IN OUT DWORD *pReqId);
  361. DWORD // ERROR_*
  362. PropTerminateRequest(
  363. IN DWORD ReqId);
  364. DWORD // ERROR_*
  365. PropGetProperty(
  366. IN DWORD ReqId,
  367. IN WCHAR const *pwszPropName,
  368. IN DWORD Flags,
  369. IN OUT DWORD *pcbProp,
  370. OPTIONAL OUT BYTE *pbProp);
  371. DWORD // ERROR_*
  372. PropGetPropertyA(
  373. IN DWORD ReqId,
  374. IN WCHAR const *pwszPropName,
  375. IN DWORD Flags,
  376. IN OUT DWORD *pcbProp,
  377. OPTIONAL OUT BYTE *pbProp);
  378. DWORD // ERROR_*
  379. PropSetProperty(
  380. IN DWORD ReqId,
  381. IN WCHAR const *pwszPropName,
  382. IN DWORD Flags,
  383. IN DWORD cbProp,
  384. IN BYTE const *pbProp);
  385. #endif // _JET_RED_
  386. #endif // __CSPROP2_H__