got a lot of crypt32 stuff working
[reactos.git] / reactos / w32api / include / wincrypt.h
1 #ifndef _WINCRYPT_H
2 #define _WINCRYPT_H
3 #if __GNUC__ >= 3
4 #pragma GCC system_header
5 #endif
6
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
10 #define MS_DEF_PROV_A "Microsoft Base Cryptographic Provider v1.0"
11 #define MS_DEF_PROV_W L"Microsoft Base Cryptographic Provider v1.0"
12 #define MS_ENHANCED_PROV_A "Microsoft Enhanced Cryptographic Provider v1.0"
13 #define MS_ENHANCED_PROV_W L"Microsoft Enhanced Cryptographic Provider v1.0"
14 #define MS_STRONG_PROV_A "Microsoft Strong Cryptographic Provider"
15 #define MS_STRONG_PROV_W L"Microsoft Strong Cryptographic Provider"
16 #define MS_DEF_RSA_SIG_PROV_A "Microsoft RSA Signature Cryptographic Provider"
17 #define MS_DEF_RSA_SIG_PROV_W L"Microsoft RSA Signature Cryptographic Provider"
18 #define MS_DEF_RSA_SCHANNEL_PROV_A "Microsoft RSA SChannel Cryptographic Provider"
19 #define MS_DEF_RSA_SCHANNEL_PROV_W L"Microsoft RSA SChannel Cryptographic Provider"
20 #define MS_DEF_DSS_PROV_A "Microsoft Base DSS Cryptographic Provider"
21 #define MS_DEF_DSS_PROV_W L"Microsoft Base DSS Cryptographic Provider"
22 #define MS_DEF_DSS_DH_PROV_A "Microsoft Base DSS and Diffie-Hellman Cryptographic Provider"
23 #define MS_DEF_DSS_DH_PROV_W L"Microsoft Base DSS and Diffie-Hellman Cryptographic Provider"
24 #define MS_ENH_DSS_DH_PROV_A "Microsoft Enhanced DSS and Diffie-Hellman Cryptographic Provider"
25 #define MS_ENH_DSS_DH_PROV_W L"Microsoft Enhanced DSS and Diffie-Hellman Cryptographic Provider"
26 #define MS_DEF_DH_SCHANNEL_PROV_A "Microsoft DH SChannel Cryptographic Provider"
27 #define MS_DEF_DH_SCHANNEL_PROV_W L"Microsoft DH SChannel Cryptographic Provider"
28 #define MS_SCARD_PROV_A "Microsoft Base Smart Card Crypto Provider"
29 #define MS_SCARD_PROV_W L"Microsoft Base Smart Card Crypto Provider"
30 #define GET_ALG_CLASS(x) (x&57344)
31 #define GET_ALG_TYPE(x) (x&7680)
32 #define GET_ALG_SID(x) (x&511)
33 #define ALG_CLASS_ANY 0
34 #define ALG_CLASS_SIGNATURE 8192
35 #define ALG_CLASS_MSG_ENCRYPT 16384
36 #define ALG_CLASS_DATA_ENCRYPT 24576
37 #define ALG_CLASS_HASH 32768
38 #define ALG_CLASS_KEY_EXCHANGE 40960
39 #define ALG_CLASS_ALL 57344 /* (7 << 13) */
40 #define ALG_TYPE_ANY 0
41 #define ALG_TYPE_DSS 512
42 #define ALG_TYPE_RSA 1024
43 #define ALG_TYPE_BLOCK 1536
44 #define ALG_TYPE_STREAM 2048
45 #define ALG_TYPE_DH 2560 /* (5 << 9) */
46 #define ALG_TYPE_SECURECHANNEL 3072 /* (6 << 9) */
47 #define ALG_SID_ANY 0
48 #define ALG_SID_RSA_ANY 0
49 #define ALG_SID_RSA_PKCS 1
50 #define ALG_SID_RSA_MSATWORK 2
51 #define ALG_SID_RSA_ENTRUST 3
52 #define ALG_SID_RSA_PGP 4
53 #define ALG_SID_DSS_ANY 0
54 #define ALG_SID_DSS_PKCS 1
55 #define ALG_SID_DSS_DMS 2
56 #define ALG_SID_DES 1
57 #define ALG_SID_3DES 3
58 #define ALG_SID_DESX 4
59 #define ALG_SID_IDEA 5
60 #define ALG_SID_CAST 6
61 #define ALG_SID_SAFERSK64 7
62 #define ALG_SID_SAFERSK128 8
63 #define ALG_SID_3DES_112 9
64 #define ALG_SID_SKIPJACK 10
65 #define ALG_SID_TEK 11
66 #define ALG_SID_CYLINK_MEK 12
67 #define ALG_SID_RC5 13
68 #define ALG_SID_RC2 2
69 #define ALG_SID_RC4 1
70 #define ALG_SID_SEAL 2
71 #define ALG_SID_MD2 1
72 #define ALG_SID_MD4 2
73 #define ALG_SID_MD5 3
74 #define ALG_SID_SHA 4
75 #define ALG_SID_MAC 5
76 #define ALG_SID_RIPEMD 6
77 #define ALG_SID_RIPEMD160 7
78 #define ALG_SID_SSL3SHAMD5 8
79 #define ALG_SID_HMAC 9
80 #define ALG_SID_TLS1PRF 10
81 #define ALG_SID_EXAMPLE 80
82
83 /* some typedefs for function parameters */
84 typedef unsigned int ALG_ID;
85 typedef unsigned long HCRYPTPROV;
86 typedef unsigned long HCRYPTKEY;
87 typedef unsigned long HCRYPTHASH;
88 typedef void *HCERTSTORE;
89 typedef void *HCRYPTMSG;
90 typedef void *HCERTSTOREPROV;
91 typedef void *HCRYPTOIDFUNCSET;
92 typedef void *HCRYPTOIDFUNCADDR;
93
94 #define CALG_MD2 (ALG_CLASS_HASH|ALG_TYPE_ANY|ALG_SID_MD2)
95 #define CALG_MD4 (ALG_CLASS_HASH|ALG_TYPE_ANY|ALG_SID_MD4)
96 #define CALG_MD5 (ALG_CLASS_HASH|ALG_TYPE_ANY|ALG_SID_MD5)
97 #define CALG_SHA (ALG_CLASS_HASH|ALG_TYPE_ANY|ALG_SID_SHA)
98 #define CALG_MAC (ALG_CLASS_HASH|ALG_TYPE_ANY|ALG_SID_MAC)
99 #define CALG_3DES (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|3)
100 #define CALG_CYLINK_MEK (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|12)
101 #define CALG_SKIPJACK (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|10)
102 #define CALG_KEA_KEYX (ALG_CLASS_KEY_EXCHANGE|ALG_TYPE_STREAM|ALG_TYPE_DSS|4)
103 #define CALG_RSA_SIGN (ALG_CLASS_SIGNATURE|ALG_TYPE_RSA|ALG_SID_RSA_ANY)
104 #define CALG_DSS_SIGN (ALG_CLASS_SIGNATURE|ALG_TYPE_DSS|ALG_SID_DSS_ANY)
105 #define CALG_RSA_KEYX (ALG_CLASS_KEY_EXCHANGE|ALG_TYPE_RSA|ALG_SID_RSA_ANY)
106 #define CALG_DES (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_DES)
107 #define CALG_RC2 (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_RC2)
108 #define CALG_RC4 (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_STREAM|ALG_SID_RC4)
109 #define CALG_SEAL (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_STREAM|ALG_SID_SEAL)
110 #define CALG_DH_EPHEM (ALG_CLASS_KEY_EXCHANGE|ALG_TYPE_STREAM|ALG_TYPE_DSS|ALG_SID_DSS_DMS)
111 #define CALG_DESX (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_DESX)
112 #define CALG_TLS1PRF (ALG_CLASS_DHASH|ALG_TYPE_ANY|ALG_SID_TLS1PRF)
113
114 typedef struct _CERT_PRIVATE_KEY_VALIDITY {
115 FILETIME NotBefore;
116 FILETIME NotAfter;
117 } CERT_PRIVATE_KEY_VALIDITY, *PCERT_PRIVATE_KEY_VALIDITY;
118
119
120 /* access state flags */
121 #define CERT_ACCESS_STATE_WRITE_PERSIST_FLAG 0x1
122 #define CERT_ACCESS_STATE_SYSTEM_STORE_FLAG 0x2
123 #define CERT_ACCESS_STATE_LM_SYSTEM_STORE_FLAG 0x4
124
125 /* CERT_RDN attribute dwValueType types */
126 #define CERT_RDN_TYPE_MASK 0x000000ff
127 #define CERT_RDN_ANY_TYPE 0
128 #define CERT_RDN_ENCODED_BLOB 1
129 #define CERT_RDN_OCTET_STRING 2
130 #define CERT_RDN_NUMERIC_STRING 3
131 #define CERT_RDN_PRINTABLE_STRING 4
132 #define CERT_RDN_TELETEX_STRING 5
133 #define CERT_RDN_T61_STRING 5
134 #define CERT_RDN_VIDEOTEX_STRING 6
135 #define CERT_RDN_IA5_STRING 7
136 #define CERT_RDN_GRAPHIC_STRING 8
137 #define CERT_RDN_VISIBLE_STRING 9
138 #define CERT_RDN_ISO646_STRING 9
139 #define CERT_RDN_GENERAL_STRING 10
140 #define CERT_RDN_UNIVERSAL_STRING 11
141 #define CERT_RDN_INT4_STRING 11
142 #define CERT_RDN_BMP_STRING 12
143 #define CERT_RDN_UNICODE_STRING 12
144 #define CERT_RDN_UTF8_STRING 13
145
146 /* CERT_RDN attribute dwValueType flags */
147 #define CERT_RDN_FLAGS_MASK 0xff000000
148 #define CERT_RDN_ENABLE_T61_UNICODE_FLAG 0x80000000
149 #define CERT_RDN_DISABLE_CHECK_TYPE_FLAG 0x4000000
150 #define CERT_RDN_ENABLE_UTF8_UNICODE_FLAG 0x2000000
151 #define CERT_RDN_DISABLE_IE4_UTF8_FLAG 0x0100000
152
153 /* physical store dwFlags, also used by CertAddStoreToCollection as
154 * dwUpdateFlags
155 */
156 #define CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG 0x1
157 #define CERT_PHYSICAL_STORE_OPEN_DISABLE_FLAG 0x2
158 #define CERT_PHYSICAL_STORE_REMOVE_OPEN_DISABLE_FLAG 0x4
159 #define CERT_PHYSICAL_STORE_INSERT_COMPUTER_NAME_ENABLE_FLAG 0x8
160
161 /* dwFlag values for CertEnumPhysicalStore callback */
162 #define CERT_PHYSICAL_STORE_PREDEFINED_ENUM_FLAG 0x1
163
164 /* predefined store names */
165 #if defined(__GNUC__)
166 # define CERT_PHYSICAL_STORE_DEFAULT_NAME (const WCHAR[])\
167 {'.','D','e','f','a','u','l','t','0'}
168 # define CERT_PHYSICAL_STORE_GROUP_POLICY_NAME (const WCHAR[])\
169 {'.','G','r','o','u','p','P','o','l','i','c','y',0}
170 # define CERT_PHYSICAL_STORE_LOCAL_MACHINE_NAME (const WCHAR[])\
171 {'.','L','o','c','a','l','M','a','c','h','i','n','e',0}
172 # define CERT_PHYSICAL_STORE_DS_USER_CERTIFICATE_NAME (const WCHAR[])\
173 {'.','U','s','e','r','C','e','r','t','i','f','i','c','a','t','e',0}
174 # define CERT_PHYSICAL_STORE_LOCAL_MACHINE_GROUP_POLICY_NAME (const WCHAR[])\
175 {'.','L','o','c','a','l','M','a','c','h','i','n','e','G','r','o','u','p',\
176 'P','o','l','i','c','y',0}
177 # define CERT_PHYSICAL_STORE_ENTERPRISE_NAME (const WCHAR[])\
178 {'.','E','n','t','e','r','p','r','i','s','e',0}
179 # define CERT_PHYSICAL_STORE_AUTH_ROOT_NAME (const WCHAR[])\
180 {'.','A','u','t','h','R','o','o','t',0}
181 #elif defined(_MSC_VER)
182 # define CERT_PHYSICAL_STORE_DEFAULT_NAME \
183 L".Default"
184 # define CERT_PHYSICAL_STORE_GROUP_POLICY_NAME \
185 L".GroupPolicy"
186 # define CERT_PHYSICAL_STORE_LOCAL_MACHINE_NAME \
187 L".LocalMachine"
188 # define CERT_PHYSICAL_STORE_DS_USER_CERTIFICATE_NAME \
189 L".UserCertificate"
190 # define CERT_PHYSICAL_STORE_LOCAL_MACHINE_GROUP_POLICY_NAME \
191 L".LocalMachineGroupPolicy"
192 # define CERT_PHYSICAL_STORE_ENTERPRISE_NAME \
193 L".Enterprise"
194 # define CERT_PHYSICAL_STORE_AUTH_ROOT_NAME \
195 L".AuthRoot"
196 #else
197 static const WCHAR CERT_PHYSICAL_STORE_DEFAULT_NAME[] =
198 {'.','D','e','f','a','u','l','t','0'};
199 static const WCHAR CERT_PHYSICAL_STORE_GROUP_POLICY_NAME[] =
200 {'.','G','r','o','u','p','P','o','l','i','c','y',0};
201 static const WCHAR CERT_PHYSICAL_STORE_LOCAL_MACHINE_NAME[] =
202 {'.','L','o','c','a','l','M','a','c','h','i','n','e',0};
203 static const WCHAR CERT_PHYSICAL_STORE_DS_USER_CERTIFICATE_NAME[] =
204 {'.','U','s','e','r','C','e','r','t','i','f','i','c','a','t','e',0};
205 static const WCHAR CERT_PHYSICAL_STORE_LOCAL_MACHINE_GROUP_POLICY_NAME[] =
206 {'.','L','o','c','a','l','M','a','c','h','i','n','e','G','r','o','u','p',
207 'P','o','l','i','c','y',0};
208 static const WCHAR CERT_PHYSICAL_STORE_ENTERPRISE_NAME[] =
209 {'.','E','n','t','e','r','p','r','i','s','e',0};
210 static const WCHAR CERT_PHYSICAL_STORE_AUTH_ROOT_NAME[] =
211 {'.','A','u','t','h','R','o','o','t',0};
212 #endif
213
214 /* system store locations */
215 #define CERT_SYSTEM_STORE_LOCATION_MASK 0x00ff0000
216 #define CERT_SYSTEM_STORE_LOCATION_SHIFT 16
217
218 /* system store location ids */
219 /* hkcu */
220 #define CERT_SYSTEM_STORE_CURRENT_USER_ID 1
221 /* hklm */
222 #define CERT_SYSTEM_STORE_LOCAL_MACHINE_ID 2
223 /* hklm\Software\Microsoft\Cryptography\Services */
224 #define CERT_SYSTEM_STORE_CURRENT_SERVICE_ID 4
225 #define CERT_SYSTEM_STORE_SERVICES_ID 5
226 /* HKEY_USERS */
227 #define CERT_SYSTEM_STORE_USERS_ID 6
228 /* hkcu\Software\Policies\Microsoft\SystemCertificates */
229 #define CERT_SYSTEM_STORE_CURRENT_USER_GROUP_POLICY_ID 7
230 /* hklm\Software\Policies\Microsoft\SystemCertificates */
231 #define CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY_ID 8
232 /* hklm\Software\Microsoft\EnterpriseCertificates */
233 #define CERT_SYSTEM_STORE_LOCAL_MACHINE_ENTERPRISE_ID 9
234
235 /* system store location values */
236 #define CERT_SYSTEM_STORE_CURRENT_USER \
237 (CERT_SYSTEM_STORE_CURRENT_USER_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
238 #define CERT_SYSTEM_STORE_LOCAL_MACHINE \
239 (CERT_SYSTEM_STORE_LOCAL_MACHINE_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
240 #define CERT_SYSTEM_STORE_CURRENT_SERVICE \
241 (CERT_SYSTEM_STORE_CURRENT_SERVICE_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
242 #define CERT_SYSTEM_STORE_SERVICES \
243 (CERT_SYSTEM_STORE_SERVICES_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
244 #define CERT_SYSTEM_STORE_USERS \
245 (CERT_SYSTEM_STORE_USERS_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
246 #define CERT_SYSTEM_STORE_CURRENT_USER_GROUP_POLICY \
247 (CERT_SYSTEM_STORE_CURRENT_USER_GROUP_POLICY_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
248 #define CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY \
249 (CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
250 #define CERT_SYSTEM_STORE_LOCAL_MACHINE_ENTERPRISE \
251 (CERT_SYSTEM_STORE_LOCAL_MACHINE_ENTERPRISE_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
252
253 #if defined(__GNUC__)
254 #define CERT_LOCAL_MACHINE_SYSTEM_STORE_REGPATH (const WCHAR[])\
255 {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t',\
256 '\\','S','y','s','t','e','m','C','e','r','t','i','f','i','c','a','t','e','s',\
257 0 }
258 #define CERT_GROUP_POLICY_SYSTEM_STORE_REGPATH (const WCHAR[])\
259 {'S','o','f','t','w','a','r','e','\\','P','o','l','i','c','i','e','s','\\',\
260 'M','i','c','r','o','s','o','f','t','\\','S','y','s','t','e','m','C','e','r',\
261 't','i','f','i','c','a','t','e','s',0 }
262 #elif defined(_MSC_VER)
263 #define CERT_LOCAL_MACHINE_SYSTEM_STORE_REGPATH \
264 L"Software\\Microsoft\\SystemCertificates"
265 #define CERT_GROUP_POLICY_SYSTEM_STORE_REGPATH \
266 L"Software\\Policies\\Microsoft\\SystemCertificates"
267 #else
268 static const WCHAR CERT_LOCAL_MACHINE_SYSTEM_STORE_REGPATH[] =
269 {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
270 'S','y','s','t','e','m','C','e','r','t','i','f','i','c','a','t','e','s',0 };
271 static const WCHAR CERT_GROUP_POLICY_SYSTEM_STORE_REGPATH[] =
272 {'S','o','f','t','w','a','r','e','\\','P','o','l','i','c','i','e','s','\\',
273 'M','i','c','r','o','s','o','f','t','\\','S','y','s','t','e','m','C','e','r',
274 't','i','f','i','c','a','t','e','s',0 };
275 #endif
276
277 /* flags for CertOpenStore dwFlags */
278 #define CERT_STORE_NO_CRYPT_RELEASE_FLAG 0x00000001
279 #define CERT_STORE_SET_LOCALIZED_NAME_FLAG 0x00000002
280 #define CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG 0x00000004
281 #define CERT_STORE_DELETE_FLAG 0x00000010
282 #define CERT_STORE_UNSAFE_PHYSICAL_FLAG 0x00000020
283 #define CERT_STORE_SHARE_STORE_FLAG 0x00000040
284 #define CERT_STORE_SHARE_CONTEXT_FLAG 0x00000080
285 #define CERT_STORE_MANIFOLD_FLAG 0x00000100
286 #define CERT_STORE_ENUM_ARCHIVED_FLAG 0x00000200
287 #define CERT_STORE_UPDATE_KEYID_FLAG 0x00000400
288 #define CERT_STORE_BACKUP_RESTORE_FLAG 0x00000800
289 #define CERT_STORE_MAXIMUM_ALLOWED_FLAG 0x00001000
290 #define CERT_STORE_CREATE_NEW_FLAG 0x00002000
291 #define CERT_STORE_OPEN_EXISTING_FLAG 0x00004000
292 #define CERT_STORE_READONLY_FLAG 0x00008000
293
294 /* dwAddDisposition */
295 #define CERT_STORE_ADD_NEW 1
296 #define CERT_STORE_ADD_USE_EXISTING 2
297 #define CERT_STORE_ADD_REPLACE_EXISTING 3
298 #define CERT_STORE_ADD_ALWAYS 4
299 #define CERT_STORE_ADD_REPLACE_EXISTING_INHERIT_PROPERTIES 5
300 #define CERT_STORE_ADD_NEWER 6
301 #define CERT_STORE_ADD_NEWER_INHERIT_PROPERTIES 7
302
303 /* cert store provider types */
304 #define CERT_STORE_PROV_MSG ((LPCSTR)1)
305 #define CERT_STORE_PROV_MEMORY ((LPCSTR)2)
306 #define CERT_STORE_PROV_FILE ((LPCSTR)3)
307 #define CERT_STORE_PROV_REG ((LPCSTR)4)
308 #define CERT_STORE_PROV_PKCS7 ((LPCSTR)5)
309 #define CERT_STORE_PROV_SERIALIZED ((LPCSTR)6)
310 #define CERT_STORE_PROV_FILENAME_A ((LPCSTR)7)
311 #define CERT_STORE_PROV_FILENAME_W ((LPCSTR)8)
312 #define CERT_STORE_PROV_SYSTEM_A ((LPCSTR)9)
313 #define CERT_STORE_PROV_SYSTEM_W ((LPCSTR)10)
314 #define CERT_STORE_PROV_SYSTEM CERT_STORE_PROV_SYSTEM_W
315 #define CERT_STORE_PROV_COLLECTION ((LPCSTR)11)
316 #define CERT_STORE_PROV_SYSTEM_REGISTRY_A ((LPCSTR)12)
317 #define CERT_STORE_PROV_SYSTEM_REGISTRY_W ((LPCSTR)13)
318 #define CERT_STORE_PROV_SYSTEM_REGISTRY CERT_STORE_PROV_SYSTEM_REGISTRY_W
319 #define CERT_STORE_PROV_PHYSICAL_W ((LPCSTR)14)
320 #define CERT_STORE_PROV_PHYSICAL CERT_STORE_PROV_PHYSICAL_W
321 #define CERT_STORE_PROV_SMART_CARD_W ((LPCSTR)15)
322 #define CERT_STORE_PROV_SMART_CARD CERT_STORE_PROV_SMART_CARD_W
323 #define CERT_STORE_PROV_LDAP_W ((LPCSTR)16)
324 #define CERT_STORE_PROV_LDAP CERT_STORE_PROV_LDAP_W
325
326 #define sz_CERT_STORE_PROV_MEMORY "Memory"
327 #define sz_CERT_STORE_PROV_FILENAME_W "File"
328 #define sz_CERT_STORE_PROV_FILENAME sz_CERT_STORE_PROV_FILENAME_W
329 #define sz_CERT_STORE_PROV_SYSTEM_W "System"
330 #define sz_CERT_STORE_PROV_SYSTEM sz_CERT_STORE_PROV_SYSTEM_W
331 #define sz_CERT_STORE_PROV_PKCS7 "PKCS7"
332 #define sz_CERT_STORE_PROV_SERIALIZED "Serialized"
333 #define sz_CERT_STORE_PROV_COLLECTION "Collection"
334 #define sz_CERT_STORE_PROV_SYSTEM_REGISTRY_W "SystemRegistry"
335 #define sz_CERT_STORE_PROV_SYSTEM_REGISTRY sz_CERT_STORE_PROV_SYSTEM_REGISTRY_W
336 #define sz_CERT_STORE_PROV_PHYSICAL_W "Physical"
337 #define sz_CERT_STORE_PROV_PHYSICAL sz_CERT_STORE_PROV_PHYSICAL_W
338 #define sz_CERT_STORE_PROV_SMART_CARD_W "SmartCard"
339 #define sz_CERT_STORE_PROV_SMART_CARD sz_CERT_STORE_PROV_SMART_CARD_W
340 #define sz_CERT_STORE_PROV_LDAP_W "Ldap"
341 #define sz_CERT_STORE_PROV_LDAP sz_CERT_STORE_PROV_LDAP_W
342
343 #define CRYPT_VERIFYCONTEXT 0xF0000000
344 #define CRYPT_NEWKEYSET 8
345 #define CRYPT_DELETEKEYSET 16
346 #define CRYPT_MACHINE_KEYSET 32
347 #define CRYPT_SILENT 64
348 #define CRYPT_EXPORTABLE 1
349 #define CRYPT_USER_PROTECTED 2
350 #define CRYPT_CREATE_SALT 4
351 #define CRYPT_UPDATE_KEY 8
352 #define SIMPLEBLOB 1
353 #define PUBLICKEYBLOB 6
354 #define PRIVATEKEYBLOB 7
355 #define PLAINTEXTKEYBLOB 8
356 #define OPAQUEKEYBLOB 9
357 #define PUBLICKEYBLOBEX 10
358 #define SYMMETRICWRAPKEYBLOB 11
359 #define AT_KEYEXCHANGE 1
360 #define AT_SIGNATURE 2
361 #define CRYPT_USERDATA 1
362 #define PKCS5_PADDING 1
363 #define CRYPT_MODE_CBC 1
364 #define CRYPT_MODE_ECB 2
365 #define CRYPT_MODE_OFB 3
366 #define CRYPT_MODE_CFB 4
367 #define CRYPT_MODE_CTS 5
368 #define CRYPT_MODE_CBCI 6
369 #define CRYPT_MODE_CFBP 7
370 #define CRYPT_MODE_OFBP 8
371 #define CRYPT_MODE_CBCOFM 9
372 #define CRYPT_MODE_CBCOFMI 10
373 #define CRYPT_ENCRYPT 1
374 #define CRYPT_DECRYPT 2
375 #define CRYPT_EXPORT 4
376 #define CRYPT_READ 8
377 #define CRYPT_WRITE 16
378 #define CRYPT_MAC 32
379 /* Crypt{Get|Set}Provider */
380 #define CRYPT_MACHINE_DEFAULT 0x00000001
381 #define CRYPT_USER_DEFAULT 0x00000002
382 #define CRYPT_DELETE_DEFAULT 0x00000004
383
384 /* cert system store flags */
385 #define CERT_SYSTEM_STORE_MASK 0xffff0000
386 #define CERT_SYSTEM_STORE_RELOCATE_FLAG 0x80000000
387
388 /* CertFindChainInStore dwFindType types */
389 #define CERT_CHAIN_FIND_BY_ISSUER 1
390
391 /* CERT_INFO versions/flags */
392 #define CERT_V1 0
393 #define CERT_V2 1
394 #define CERT_V3 2
395 #define CERT_INFO_VERSION_FLAG 1
396 #define CERT_INFO_SERIAL_NUMBER_FLAG 2
397 #define CERT_INFO_SIGNATURE_ALGORITHM_FLAG 3
398 #define CERT_INFO_ISSUER_FLAG 4
399 #define CERT_INFO_NOT_BEFORE_FLAG 5
400 #define CERT_INFO_NOT_AFTER_FLAG 6
401 #define CERT_INFO_SUBJECT_FLAG 7
402 #define CERT_INFO_SUBJECT_PUBLIC_KEY_INFO_FLAG 8
403 #define CERT_INFO_ISSUER_UNIQUE_ID_FLAG 9
404 #define CERT_INFO_SUBJECT_UNIQUE_ID_FLAG 10
405 #define CERT_INFO_EXTENSION_FLAG 11
406
407 /* CERT_REQUEST_INFO versions */
408 #define CERT_REQUEST_V1 0
409
410 /* CERT_KEYGEN_REQUEST_INFO versions */
411 #define CERT_KEYGEN_REQUEST_V1 0
412
413 /* CRL versions */
414 #define CRL_V1 0
415 #define CRL_V2 1
416
417 /* CTL versions */
418 #define CTL_V1 0
419
420 /* Certificate, CRL, CTL property IDs */
421 #define CERT_KEY_PROV_HANDLE_PROP_ID 1
422 #define CERT_KEY_PROV_INFO_PROP_ID 2
423 #define CERT_SHA1_HASH_PROP_ID 3
424 #define CERT_HASH_PROP_ID CERT_SHA1_HASH_PROP_ID
425 #define CERT_MD5_HASH_PROP_ID 4
426 #define CERT_KEY_CONTEXT_PROP_ID 5
427 #define CERT_KEY_SPEC_PROP_ID 6
428 #define CERT_IE30_RESERVED_PROP_ID 7
429 #define CERT_PUBKEY_HASH_RESERVED_PROP_ID 8
430 #define CERT_ENHKEY_USAGE_PROP_ID 9
431 #define CERT_CTL_USAGE_PROP_ID CERT_ENHKEY_USAGE_PROP_ID
432 #define CERT_NEXT_UPDATE_LOCATION_PROP_ID 10
433 #define CERT_FRIENDLY_NAME_PROP_ID 11
434 #define CERT_PVK_FILE_PROP_ID 12
435 #define CERT_DESCRIPTION_PROP_ID 13
436 #define CERT_ACCESS_STATE_PROP_ID 14
437 #define CERT_SIGNATURE_HASH_PROP_ID 15
438 #define CERT_SMART_CARD_DATA_PROP_ID 16
439 #define CERT_EFS_PROP_ID 17
440 #define CERT_FORTEZZA_DATA_PROP 18
441 #define CERT_ARCHIVED_PROP_ID 19
442 #define CERT_KEY_IDENTIFIER_PROP_ID 20
443 #define CERT_AUTO_ENROLL_PROP_ID 21
444 #define CERT_PUBKEY_ALG_PARA_PROP_ID 22
445 #define CERT_CROSS_CERT_DIST_POINTS_PROP_ID 23
446 #define CERT_ISSUER_PUBLIC_KEY_MD5_HASH_PROP_ID 24
447 #define CERT_SUBJECT_PUBLIC_KEY_MD5_HASH_PROP_ID 25
448 #define CERT_ENROLLMENT_PROP_ID 26
449 #define CERT_DATE_STAMP_PROP_ID 27
450 #define CERT_ISSUER_SERIAL_NUMBER_MD5_HASH_PROP_ID 28
451 #define CERT_SUBJECT_NAME_MD5_HASH_PROP_ID 29
452 #define CERT_EXTENDED_ERROR_INFO_PROP_ID 30
453 /* 31 -- unused?
454 32 -- cert prop id
455 33 -- CRL prop id
456 34 -- CTL prop id
457 35 -- KeyId prop id
458 36-63 -- reserved
459 */
460 #define CERT_RENEWAL_PROP_ID 64
461 #define CERT_ARCHIVED_KEY_HASH_PROP_ID 65
462 #define CERT_AUTO_ENROLL_RETRY_PROP_ID 66
463 #define CERT_AIA_URL_RETRIEVED_PROP_ID 67
464 #define CERT_FIRST_RESERVED_PROP_ID 68
465 #define CERT_LAST_RESERVED_PROP_ID 0x00007fff
466 #define CERT_FIRST_USER_PROP_ID 0x00008000
467 #define CERT_LAST_USER_PROP_ID 0x0000ffff
468
469 /* Algorithm IDs */
470
471 #define GET_ALG_CLASS(x) (x & (7 << 13))
472 #define GET_ALG_TYPE(x) (x & (15 << 9))
473 #define GET_ALG_SID(x) (x & (511))
474
475 /* Algorithm Classes */
476 #define ALG_CLASS_ANY (0)
477 #define ALG_CLASS_SIGNATURE (1 << 13)
478 #define ALG_CLASS_MSG_ENCRYPT (2 << 13)
479 #define ALG_CLASS_DATA_ENCRYPT (3 << 13)
480 #define ALG_CLASS_HASH (4 << 13)
481 #define ALG_CLASS_KEY_EXCHANGE (5 << 13)
482 /* Algorithm types */
483 #define ALG_TYPE_ANY (0)
484 #define ALG_TYPE_DSS (1 << 9)
485 #define ALG_TYPE_RSA (2 << 9)
486 #define ALG_TYPE_BLOCK (3 << 9)
487 #define ALG_TYPE_STREAM (4 << 9)
488 #define ALG_TYPE_DH (5 << 9)
489 #define ALG_TYPE_SECURECHANNEL (6 << 9)
490
491 /* SIDs */
492 #define ALG_SID_ANY (0)
493 /* RSA SIDs */
494 #define ALG_SID_RSA_ANY 0
495 #define ALG_SID_RSA_PKCS 1
496 #define ALG_SID_RSA_MSATWORK 2
497 #define ALG_SID_RSA_ENTRUST 3
498 #define ALG_SID_RSA_PGP 4
499 /* DSS SIDs */
500 #define ALG_SID_DSS_ANY 0
501 #define ALG_SID_DSS_PKCS 1
502 #define ALG_SID_DSS_DMS 2
503
504 /* DES SIDs */
505 #define ALG_SID_DES 1
506 #define ALG_SID_3DES 3
507 #define ALG_SID_DESX 4
508 #define ALG_SID_IDEA 5
509 #define ALG_SID_CAST 6
510 #define ALG_SID_SAFERSK64 7
511 #define ALG_SID_SAFERSK128 8
512 #define ALG_SID_3DES_112 9
513 /* Diffie-Hellmans SIDs */
514 #define ALG_SID_DH_SANDF 1
515 #define ALG_SID_DH_EPHEM 2
516 #define ALG_SID_AGREED_KEY_ANY 3
517 #define ALG_SID_KEA 4
518 /* RC2 SIDs */
519 #define ALG_SID_RC4 1
520 #define ALG_SID_RC2 2
521 #define ALG_SID_SEAL 2
522 /* Hash SIDs */
523 #define ALG_SID_MD2 1
524 #define ALG_SID_MD4 2
525 #define ALG_SID_MD5 3
526 #define ALG_SID_SHA 4
527 #define ALG_SID_SHA1 CALG_SHA
528 #define ALG_SID_MAC 5
529 #define ALG_SID_RIPEMD 6
530 #define ALG_SID_RIPEMD160 7
531 #define ALG_SID_SSL3SHAMD5 8
532 #define ALG_SID_HMAC 9
533 #define ALG_SID_TLS1PRF 10
534 /* SCHANNEL SIDs */
535 #define ALG_SID_SSL3_MASTER 1
536 #define ALG_SID_SCHANNEL_MASTER_HASH 2
537 #define ALG_SID_SCHANNEL_MAC_KEY 3
538 #define ALG_SID_PCT1_MASTER 4
539 #define ALG_SID_SSL2_MASTER 5
540 #define ALG_SID_TLS1_MASTER 6
541 #define ALG_SID_SCHANNEL_ENC_KEY 7
542 #define ALG_SID_EXAMPLE 80
543
544 /* Algorithm Definitions */
545 #define CALG_MD2 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MD2)
546 #define CALG_MD4 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MD4)
547 #define CALG_MD5 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MD5)
548 #define CALG_SHA (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA)
549 #define CALG_SHA1 CALG_SHA
550 #define CALG_MAC (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MAC)
551 #define CALG_SSL3_SHAMD5 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SSL3SHAMD5)
552 #define CALG_HMAC (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_HMAC)
553 #define CALG_TLS1PRF (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_TLS1PRF)
554 #define CALG_RSA_SIGN (ALG_CLASS_SIGNATURE | ALG_TYPE_RSA | ALG_SID_RSA_ANY)
555 #define CALG_DSS_SIGN (ALG_CLASS_SIGNATURE | ALG_TYPE_DSS | ALG_SID_DSS_ANY)
556 #define CALG_DH_SF (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_DH | ALG_SID_DH_SANDF)
557 #define CALG_DH_EPHEM (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_DH | ALG_SID_DH_EPHEM)
558 #define CALG_RSA_KEYX (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_RSA | ALG_SID_RSA_ANY)
559 #define CALG_DES (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_DES)
560 #define CALG_RC2 (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_RC2)
561 #define CALG_3DES (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_3DES)
562 #define CALG_3DES_112 (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_3DES_112)
563 #define CALG_RC4 (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_STREAM | ALG_SID_RC4)
564 #define CALG_SEAL (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_STREAM | ALG_SID_SEAL)
565 #define CALG_SSL3_MASTER (ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL | ALG_SID_SSL3_MASTER)
566 #define CALG_SCHANNEL_MASTER_HASH (ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL | ALG_SID_SCHANNEL_MASTER_HASH)
567 #define CALG_SCHANNEL_MAC_KEY (ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL | ALG_SID_SCHANNEL_MAC_KEY)
568 #define CALG_SCHANNEL_ENC_KEY (ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL | ALG_SID_SCHANNEL_ENC_KEY)
569 #define CALG_PCT1_MASTER (ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL | ALG_SID_PCT1_MASTER)
570 #define CALG_SSL2_MASTER (ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL | ALG_SID_SSL2_MASTER)
571 #define CALG_TLS1_MASTER (ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL | ALG_SID_TLS1_MASTER)
572
573 /* CRL reason codes */
574 #define CRL_REASON_UNSPECIFIED 0
575 #define CRL_REASON_KEY_COMPROMISE 1
576 #define CRL_REASON_CA_COMPROMISE 2
577 #define CRL_REASON_AFFILIATION_CHANGED 3
578 #define CRL_REASON_SUPERSEDED 4
579 #define CRL_REASON_CESSATION_OF_OPERATION 5
580 #define CRL_REASON_CERTIFICATE_HOLD 6
581 #define CRL_REASON_REMOVE_FROM_CRL 8
582
583 /* CertControlStore control types */
584 #define CERT_STORE_CTRL_RESYNC 1
585 #define CERT_STORE_CTRL_NOTIFY_CHANGE 2
586 #define CERT_STORE_CTRL_COMMIT 3
587 #define CERT_STORE_CTRL_AUTO_RESYNC 4
588 #define CERT_STORE_CTRL_CANCEL_NOTIFY 5
589
590 #define CERT_STORE_CTRL_COMMIT_FORCE_FLAG 0x1
591 #define CERT_STORE_CTRL_COMMIT_CLEAR_FLAG 0x2
592
593 /* access state flags */
594 #define CERT_ACCESS_STATE_WRITE_PERSIST_FLAG 0x1
595 #define CERT_ACCESS_STATE_SYSTEM_STORE_FLAG 0x2
596 #define CERT_ACCESS_STATE_LM_SYSTEM_STORE_FLAG 0x4
597
598 /* PFN_CERT_STORE_PROV_WRITE_CERT dwFlags values */
599 #define CERT_STORE_PROV_WRITE_ADD_FLAG 0x1
600
601 /* CertAddSerializedElementToStore context types */
602 #define CERT_STORE_CERTIFICATE_CONTEXT 1
603 #define CERT_STORE_CRL_CONTEXT 2
604 #define CERT_STORE_CTL_CONTEXT 3
605 #define CERT_STORE_ALL_CONTEXT_FLAG ~0U
606 #define CERT_STORE_CERTIFICATE_CONTEXT_FLAG \
607 (1 << CERT_STORE_CERTIFICATE_CONTEXT)
608 #define CERT_STORE_CRL_CONTEXT_FLAG (1 << CERT_STORE_CRL_CONTEXT)
609 #define CERT_STORE_CTL_CONTEXT_FLAG (1 << CERT_STORE_CTL_CONTEXT)
610
611 /* OIDs */
612 #define szOID_RSA "1.2.840.113549"
613 #define szOID_PKCS "1.2.840.113549.1"
614 #define szOID_RSA_HASH "1.2.840.113549.2"
615 #define szOID_RSA_ENCRYPT "1.2.840.113549.3"
616 #define szOID_PKCS_1 "1.2.840.113549.1.1"
617 #define szOID_PKCS_2 "1.2.840.113549.1.2"
618 #define szOID_PKCS_3 "1.2.840.113549.1.3"
619 #define szOID_PKCS_4 "1.2.840.113549.1.4"
620 #define szOID_PKCS_5 "1.2.840.113549.1.5"
621 #define szOID_PKCS_6 "1.2.840.113549.1.6"
622 #define szOID_PKCS_7 "1.2.840.113549.1.7"
623 #define szOID_PKCS_8 "1.2.840.113549.1.8"
624 #define szOID_PKCS_9 "1.2.840.113549.1.9"
625 #define szOID_PKCS_10 "1.2.840.113549.1.10"
626 #define szOID_PKCS_11 "1.2.840.113549.1.12"
627 #define szOID_RSA_RSA "1.2.840.113549.1.1.1"
628 #define CERT_RSA_PUBLIC_KEY_OBJID szOID_RSA_RSA
629 #define CERT_DEFAULT_OID_PUBLIC_KEY_SIGN szOID_RSA_RSA
630 #define CERT_DEFAULT_OID_PUBLIC_KEY_XCHG szOID_RSA_RSA
631 #define szOID_RSA_MD2RSA "1.2.840.113549.1.1.2"
632 #define szOID_RSA_MD4RSA "1.2.840.113549.1.1.3"
633 #define szOID_RSA_MD5RSA "1.2.840.113549.1.1.4"
634 #define szOID_RSA_SHA1RSA "1.2.840.113549.1.1.5"
635 #define szOID_RSA_SET0AEP_RSA "1.2.840.113549.1.1.6"
636 #define szOID_RSA_DH "1.2.840.113549.1.3.1"
637 #define szOID_RSA_data "1.2.840.113549.1.7.1"
638 #define szOID_RSA_signedData "1.2.840.113549.1.7.2"
639 #define szOID_RSA_envelopedData "1.2.840.113549.1.7.3"
640 #define szOID_RSA_signEnvData "1.2.840.113549.1.7.4"
641 #define szOID_RSA_digestedData "1.2.840.113549.1.7.5"
642 #define szOID_RSA_hashedData "1.2.840.113549.1.7.5"
643 #define szOID_RSA_encryptedData "1.2.840.113549.1.7.6"
644 #define szOID_RSA_emailAddr "1.2.840.113549.1.9.1"
645 #define szOID_RSA_unstructName "1.2.840.113549.1.9.2"
646 #define szOID_RSA_contentType "1.2.840.113549.1.9.3"
647 #define szOID_RSA_messageDigest "1.2.840.113549.1.9.4"
648 #define szOID_RSA_signingTime "1.2.840.113549.1.9.5"
649 #define szOID_RSA_counterSign "1.2.840.113549.1.9.6"
650 #define szOID_RSA_challengePwd "1.2.840.113549.1.9.7"
651 #define szOID_RSA_unstructAddr "1.2.840.113549.1.9.9"
652 #define szOID_RSA_extCertAttrs "1.2.840.113549.1.9.9"
653 #define szOID_RSA_certExtensions "1.2.840.113549.1.9.14"
654 #define szOID_RSA_SMIMECapabilities "1.2.840.113549.1.9.15"
655 #define szOID_RSA_preferSignedData "1.2.840.113549.1.9.15.1"
656 #define szOID_RSA_SMIMEalg "1.2.840.113549.1.9.16.3"
657 #define szOID_RSA_SMIMEalgESDH "1.2.840.113549.1.9.16.3.5"
658 #define szOID_RSA_SMIMEalgCMS3DESwrap "1.2.840.113549.1.9.16.3.6"
659 #define szOID_RSA_SMIMEalgCMSRC2wrap "1.2.840.113549.1.9.16.3.7"
660 #define szOID_RSA_MD2 "1.2.840.113549.2.2"
661 #define szOID_RSA_MD4 "1.2.840.113549.2.4"
662 #define szOID_RSA_MD5 "1.2.840.113549.2.5"
663 #define szOID_RSA_RC2CBC "1.2.840.113549.3.2"
664 #define szOID_RSA_RC4 "1.2.840.113549.3.4"
665 #define szOID_RSA_DES_EDE3_CBC "1.2.840.113549.3.7"
666 #define szOID_RSA_RC5_CBCPad "1.2.840.113549.3.9"
667 #define szOID_ANSI_X942 "1.2.840.10046"
668 #define szOID_ANSI_X942_DH "1.2.840.10046.2.1"
669 #define szOID_X957 "1.2.840.10040"
670 #define szOID_X957_DSA "1.2.840.10040.4.1"
671 #define szOID_X957_SHA1DSA "1.2.840.10040.4.3"
672 #define szOID_DS "2.5"
673 #define szOID_DSALG "2.5.8"
674 #define szOID_DSALG_CRPT "2.5.8.1"
675 #define szOID_DSALG_HASH "2.5.8.2"
676 #define szOID_DSALG_SIGN "2.5.8.3"
677 #define szOID_DSALG_RSA "2.5.8.1.1"
678 #define szOID_OIW "1.3.14"
679 #define szOID_OIWSEC "1.3.14.3.2"
680 #define szOID_OIWSEC_md4RSA "1.3.14.3.2.2"
681 #define szOID_OIWSEC_md5RSA "1.3.14.3.2.3"
682 #define szOID_OIWSEC_md4RSA2 "1.3.14.3.2.4"
683 #define szOID_OIWSEC_desECB "1.3.14.3.2.6"
684 #define szOID_OIWSEC_desCBC "1.3.14.3.2.7"
685 #define szOID_OIWSEC_desOFB "1.3.14.3.2.8"
686 #define szOID_OIWSEC_desCFB "1.3.14.3.2.9"
687 #define szOID_OIWSEC_desMAC "1.3.14.3.2.10"
688 #define szOID_OIWSEC_rsaSign "1.3.14.3.2.11"
689 #define szOID_OIWSEC_dsa "1.3.14.3.2.12"
690 #define szOID_OIWSEC_shaDSA "1.3.14.3.2.13"
691 #define szOID_OIWSEC_mdc2RSA "1.3.14.3.2.14"
692 #define szOID_OIWSEC_shaRSA "1.3.14.3.2.15"
693 #define szOID_OIWSEC_dhCommMod "1.3.14.3.2.16"
694 #define szOID_OIWSEC_desEDE "1.3.14.3.2.17"
695 #define szOID_OIWSEC_sha "1.3.14.3.2.18"
696 #define szOID_OIWSEC_mdc2 "1.3.14.3.2.19"
697 #define szOID_OIWSEC_dsaComm "1.3.14.3.2.20"
698 #define szOID_OIWSEC_dsaCommSHA "1.3.14.3.2.21"
699 #define szOID_OIWSEC_rsaXchg "1.3.14.3.2.22"
700 #define szOID_OIWSEC_keyHashSeal "1.3.14.3.2.23"
701 #define szOID_OIWSEC_md2RSASign "1.3.14.3.2.24"
702 #define szOID_OIWSEC_md5RSASign "1.3.14.3.2.25"
703 #define szOID_OIWSEC_sha1 "1.3.14.3.2.26"
704 #define szOID_OIWSEC_dsaSHA1 "1.3.14.3.2.27"
705 #define szOID_OIWSEC_dsaCommSHA1 "1.3.14.3.2.28"
706 #define szOID_OIWSEC_sha1RSASign "1.3.14.3.2.29"
707 #define szOID_OIWDIR "1.3.14.7.2"
708 #define szOID_OIWDIR_CRPT "1.3.14.7.2.1"
709 #define szOID_OIWDIR_HASH "1.3.14.7.2.2"
710 #define szOID_OIWDIR_SIGN "1.3.14.7.2.3"
711 #define szOID_OIWDIR_md2 "1.3.14.7.2.2.1"
712 #define szOID_OIWDIR_md2RSA "1.3.14.7.2.3.1"
713 #define szOID_INFOSEC "2.16.840.1.101.2.1"
714 #define szOID_INFOSEC_sdnsSignature "2.16.840.1.101.2.1.1.1"
715 #define szOID_INFOSEC_mosaicSignature "2.16.840.1.101.2.1.1.2"
716 #define szOID_INFOSEC_sdnsConfidentiality "2.16.840.1.101.2.1.1.3"
717 #define szOID_INFOSEC_mosaicConfidentiality "2.16.840.1.101.2.1.1.4"
718 #define szOID_INFOSEC_sdnsIntegrity "2.16.840.1.101.2.1.1.5"
719 #define szOID_INFOSEC_mosaicIntegrity "2.16.840.1.101.2.1.1.6"
720 #define szOID_INFOSEC_sdnsTokenProtection "2.16.840.1.101.2.1.1.7"
721 #define szOID_INFOSEC_mosaicTokenProtection "2.16.840.1.101.2.1.1.8"
722 #define szOID_INFOSEC_sdnsKeyManagement "2.16.840.1.101.2.1.1.9"
723 #define szOID_INFOSEC_mosaicKeyManagement "2.16.840.1.101.2.1.1.10"
724 #define szOID_INFOSEC_sdnsKMandSig "2.16.840.1.101.2.1.1.11"
725 #define szOID_INFOSEC_mosaicKMandSig "2.16.840.1.101.2.1.1.12"
726 #define szOID_INFOSEC_SuiteASignature "2.16.840.1.101.2.1.1.13"
727 #define szOID_INFOSEC_SuiteAConfidentiality "2.16.840.1.101.2.1.1.14"
728 #define szOID_INFOSEC_SuiteAIntegrity "2.16.840.1.101.2.1.1.15"
729 #define szOID_INFOSEC_SuiteATokenProtection "2.16.840.1.101.2.1.1.16"
730 #define szOID_INFOSEC_SuiteAKeyManagement "2.16.840.1.101.2.1.1.17"
731 #define szOID_INFOSEC_SuiteAKMandSig "2.16.840.1.101.2.1.1.18"
732 #define szOID_INFOSEC_mosaicUpdatedSig "2.16.840.1.101.2.1.1.19"
733 #define szOID_INFOSEC_mosaicKMandUpdSig "2.16.840.1.101.2.1.1.20"
734 #define szOID_INFOSEC_mosaicUpdateInteg "2.16.840.1.101.2.1.1.21"
735 #define szOID_COMMON_NAME "2.5.4.3"
736 #define szOID_SUR_NAME "2.5.4.4"
737 #define szOID_DEVICE_SERIAL_NUMBER "2.5.4.5"
738 #define szOID_COUNTRY_NAME "2.5.4.6"
739 #define szOID_LOCALITY_NAME "2.5.4.7"
740 #define szOID_STATE_OR_PROVINCE_NAME "2.5.4.8"
741 #define szOID_STREET_ADDRESS "2.5.4.9"
742 #define szOID_ORGANIZATION_NAME "2.5.4.10"
743 #define szOID_ORGANIZATIONAL_UNIT_NAME "2.5.4.11"
744 #define szOID_TITLE "2.5.4.12"
745 #define szOID_DESCRIPTION "2.5.4.13"
746 #define szOID_SEARCH_GUIDE "2.5.4.14"
747 #define szOID_BUSINESS_CATEGORY "2.5.4.15"
748 #define szOID_POSTAL_ADDRESS "2.5.4.16"
749 #define szOID_POSTAL_CODE "2.5.4.17"
750 #define szOID_POST_OFFICE_BOX "2.5.4.18"
751 #define szOID_PHYSICAL_DELIVERY_OFFICE_NAME "2.5.4.19"
752 #define szOID_TELEPHONE_NUMBER "2.5.4.20"
753 #define szOID_TELEX_NUMBER "2.5.4.21"
754 #define szOID_TELETEXT_TERMINAL_IDENTIFIER "2.5.4.22"
755 #define szOID_FACSIMILE_TELEPHONE_NUMBER "2.5.4.23"
756 #define szOID_X21_ADDRESS "2.5.4.24"
757 #define szOID_INTERNATIONAL_ISDN_NUMBER "2.5.4.25"
758 #define szOID_REGISTERED_ADDRESS "2.5.4.26"
759 #define szOID_DESTINATION_INDICATOR "2.5.4.27"
760 #define szOID_PREFERRED_DELIVERY_METHOD "2.5.4.28"
761 #define szOID_PRESENTATION_ADDRESS "2.5.4.29"
762 #define szOID_SUPPORTED_APPLICATION_CONTEXT "2.5.4.30"
763 #define szOID_MEMBER "2.5.4.31"
764 #define szOID_OWNER "2.5.4.32"
765 #define szOID_ROLE_OCCUPANT "2.5.4.33"
766 #define szOID_SEE_ALSO "2.5.4.34"
767 #define szOID_USER_PASSWORD "2.5.4.35"
768 #define szOID_USER_CERTIFICATE "2.5.4.36"
769 #define szOID_CA_CERTIFICATE "2.5.4.37"
770 #define szOID_AUTHORITY_REVOCATION_LIST "2.5.4.38"
771 #define szOID_CERTIFICATE_REVOCATION_LIST "2.5.4.39"
772 #define szOID_CROSS_CERTIFICATE_PAIR "2.5.4.40"
773 #define szOID_GIVEN_NAME "2.5.4.42"
774 #define szOID_INITIALS "2.5.4.43"
775 #define szOID_DN_QUALIFIER "2.5.4.46"
776 #define szOID_AUTHORITY_KEY_IDENTIFIER "2.5.29.1"
777 #define szOID_KEY_ATTRIBUTES "2.5.29.2"
778 #define szOID_CERT_POLICIES_95 "2.5.29.3"
779 #define szOID_KEY_USAGE_RESTRICTION "2.5.29.4"
780 #define szOID_LEGACY_POLICY_MAPPINGS "2.5.29.5"
781 #define szOID_SUBJECT_ALT_NAME "2.5.29.7"
782 #define szOID_ISSUER_ALT_NAME "2.5.29.8"
783 #define szOID_SUBJECT_DIR_ATTRS "2.5.29.9"
784 #define szOID_BASIC_CONSTRAINTS "2.5.29.10"
785 #define szOID_SUBJECT_KEY_IDENTIFIER "2.5.29.14"
786 #define szOID_KEY_USAGE "2.5.29.15"
787 #define szOID_PRIVATEKEY_USAGE_PERIOD "2.5.29.16"
788 #define szOID_SUBJECT_ALT_NAME2 "2.5.29.17"
789 #define szOID_ISSUER_ALT_NAME2 "2.5.29.18"
790 #define szOID_BASIC_CONSTRAINTS2 "2.5.29.19"
791 #define szOID_CRL_NUMBER "2.5.29.20"
792 #define szOID_CRL_REASON_CODE "2.5.29.21"
793 #define szOID_REASON_CODE_HOLD "2.5.29.23"
794 #define szOID_DELTA_CRL_INDICATOR "2.5.29.27"
795 #define szOID_ISSUING_DIST_POINT "2.5.29.28"
796 #define szOID_NAME_CONSTRAINTS "2.5.29.30"
797 #define szOID_CRL_DIST_POINTS "2.5.29.31"
798 #define szOID_CERT_POLICIES "2.5.29.32"
799 #define szOID_ANY_CERT_POLICY "2.5.29.32.0"
800 #define szOID_POLICY_MAPPINGS "2.5.29.33"
801 #define szOID_AUTHORITY_KEY_IDENTIFIER2 "2.5.29.35"
802 #define szOID_POLICY_CONSTRAINTS "2.5.29.36"
803 #define szOID_ENHANCED_KEY_USAGE "2.5.29.37"
804 #define szOID_FRESHEST_CRL "2.5.29.46"
805 #define szOID_DOMAIN_COMPONENT "0.9.2342.19200300.100.1.25"
806 #define szOID_PKCS_12_FRIENDLY_NAME_ATTR "1.2.840.113549.1.9.20"
807 #define szOID_PKCS_12_LOCAL_KEY_ID "1.2.840.113549.1.9.21"
808 #define szOID_CERT_EXTENSIONS "1.3.6.1.4.1.311.2.1.14"
809 #define szOID_NEXT_UPDATE_LOCATION "1.3.6.1.4.1.311.10.2"
810 #define szOID_REMOVE_CERTIFICATE "1.3.6.1.4.1.311.10.8.1"
811 #define szOID_CROSS_CERT_DIST_POINTS "1.3.6.1.4.1.311.10.9.1"
812 #define szOID_CTL "1.3.6.1.4.1.311.10.10.1"
813 #define szOID_SORTED_CTL "1.3.6.1.4.1.311.10.10.1.1"
814 #define szOID_ANY_APPLICATION_POLICY "1.3.6.1.4.1.311.10.12.1"
815 #define szOID_RENEWAL_CERTIFICATE "1.3.6.1.4.1.311.13.1"
816 #define szOID_ENROLLMENT_NAME_VALUE_PAIR "1.3.6.1.4.1.311.13.2.1"
817 #define szOID_ENROLLMENT_CSP_PROVIDER "1.3.6.1.4.1.311.13.2.2"
818 #define szOID_OS_VERSION "1.3.6.1.4.1.311.13.2.3"
819 #define szOID_PKCS_12_KEY_PROVIDER_NAME_ATTR "1.3.6.1.4.1.311.17.1"
820 #define szOID_LOCAL_MACHINE_KEYSET "1.3.6.1.4.1.311.17.2"
821 #define szOID_AUTO_ENROLL_CTL_USAGE "1.3.6.1.4.1.311.20.1"
822 #define szOID_ENROLL_CERTTYPE_EXTENSION "1.3.6.1.4.1.311.20.2"
823 #define szOID_ENROLLMENT_AGENT "1.3.6.1.4.1.311.20.2.1"
824 #define szOID_CERT_MANIFOLD "1.3.6.1.4.1.311.20.3"
825 #define szOID_CERTSRV_PREVIOUS_CERT_HASH "1.3.6.1.4.1.311.21.2"
826 #define szOID_CRL_VIRTUAL_BASE "1.3.6.1.4.1.311.21.3"
827 #define szOID_CRL_NEXT_PUBLISH "1.3.6.1.4.1.311.21.4"
828 #define szOID_KP_CA_EXCHANGE "1.3.6.1.4.1.311.21.5"
829 #define szOID_KP_KEY_RECOVERY_AGENT "1.3.6.1.4.1.311.21.6"
830 #define szOID_CERTIFICATE_TEMPLATE "1.3.6.1.4.1.311.21.7"
831 #define szOID_ENTERPRISE_OID_ROOT "1.3.6.1.4.1.311.21.8"
832 #define szOID_RDN_DUMMY_SIGNER "1.3.6.1.4.1.311.21.9"
833 #define szOID_APPLICATION_CERT_POLICIES "1.3.6.1.4.1.311.21.10"
834 #define szOID_APPLICATION_POLICY_MAPPINGS "1.3.6.1.4.1.311.21.11"
835 #define szOID_APPLICATION_POLICY_CONSTRAINTS "1.3.6.1.4.1.311.21.12"
836 #define szOID_ARCHIVED_KEY_ATTR "1.3.6.1.4.1.311.21.13"
837 #define szOID_CRL_SELF_CDP "1.3.6.1.4.1.311.21.14"
838 #define szOID_REQUIRE_CERT_CHAIN_POLICY "1.3.6.1.4.1.311.21.15"
839 #define szOID_ARCHIVED_KEY_CERT_HASH "1.3.6.1.4.1.311.21.16"
840 #define szOID_ISSUED_CERT_HASH "1.3.6.1.4.1.311.21.17"
841 #define szOID_DS_EMAIL_REPLICATION "1.3.6.1.4.1.311.21.19"
842 #define szOID_REQUEST_CLIENT_INFO "1.3.6.1.4.1.311.21.20"
843 #define szOID_ENCRYPTED_KEY_HASH "1.3.6.1.4.1.311.21.21"
844 #define szOID_CERTSRV_CROSSCA_VERSION "1.3.6.1.4.1.311.21.22"
845 #define szOID_KEYID_RDN "1.3.6.1.4.1.311.10.7.1"
846 #define szOID_PKIX "1.3.6.1.5.5.7"
847 #define szOID_PKIX_PE "1.3.6.1.5.5.7.1"
848 #define szOID_AUTHORITY_INFO_ACCESS "1.3.6.1.5.5.7.1.1"
849 #define szOID_PKIX_POLICY_QUALIFIER_CPS "1.3.6.1.5.5.7.2.1"
850 #define szOID_PKIX_POLICY_QUALIFIER_USERNOTICE "1.3.6.1.5.5.7.2.2"
851 #define szOID_PKIX_KP "1.3.6.1.5.5.7.3"
852 #define szOID_PKIX_KP_SERVER_AUTH "1.3.6.1.5.5.7.3.1"
853 #define szOID_PKIX_KP_CLIENT_AUTH "1.3.6.1.5.5.7.3.2"
854 #define szOID_PKIX_KP_CODE_SIGNING "1.3.6.1.5.5.7.3.3"
855 #define szOID_PKIX_KP_EMAIL_PROTECTION "1.3.6.1.5.5.7.3.4"
856 #define szOID_PKIX_KP_IPSEC_END_SYSTEM "1.3.6.1.5.5.7.3.5"
857 #define szOID_PKIX_KP_IPSEC_TUNNEL "1.3.6.1.5.5.7.3.6"
858 #define szOID_PKIX_KP_IPSEC_USER "1.3.6.1.5.5.7.3.7"
859 #define szOID_PKIX_KP_TIMESTAMP_SIGNING "1.3.6.1.5.5.7.3.8"
860 #define szOID_IPSEC_KP_IKE_INTERMEDIATE "1.3.6.1.5.5.8.2.2"
861
862 #ifndef szOID_SERIALIZED
863 #define szOID_SERIALIZED "1.3.6.1.4.1.311.10.3.3.1"
864 #endif
865
866 #ifndef szOID_NT_PRINCIPAL_NAME
867 #define szOID_NT_PRINCIPAL_NAME "1.3.6.1.4.1.311.20.2.3"
868 #endif
869
870 #ifndef szOID_CERTSRV_CA_VERSION
871 #define szOID_CERTSRV_CA_VERSION "1.3.6.1.4.1.311.21.1"
872 #endif
873
874 #ifndef szOID_PRODUCT_UPDATE
875 #define szOID_PRODUCT_UPDATE "1.3.6.1.4.1.311.31.1"
876 #endif
877
878 #define CRYPT_ENCODE_DECODE_NONE 0
879 #define X509_CERT ((LPCSTR)1)
880 #define X509_CERT_TO_BE_SIGNED ((LPCSTR)2)
881 #define X509_CERT_CRL_TO_BE_SIGNED ((LPCSTR)3)
882 #define X509_CERT_REQUEST_TO_BE_SIGNED ((LPCSTR)4)
883 #define X509_EXTENSIONS ((LPCSTR)5)
884 #define X509_NAME_VALUE ((LPCSTR)6)
885 #define X509_ANY_STRING X509_NAME_VALUE
886 #define X509_NAME ((LPCSTR)7)
887 #define X509_PUBLIC_KEY_INFO ((LPCSTR)8)
888 #define X509_AUTHORITY_KEY_ID ((LPCSTR)9)
889 #define X509_KEY_ATTRIBUTES ((LPCSTR)10)
890 #define X509_KEY_USAGE_RESTRICTION ((LPCSTR)11)
891 #define X509_ALTERNATE_NAME ((LPCSTR)12)
892 #define X509_BASIC_CONSTRAINTS ((LPCSTR)13)
893 #define X509_KEY_USAGE ((LPCSTR)14)
894 #define X509_BASIC_CONSTRAINTS2 ((LPCSTR)15)
895 #define X509_CERT_POLICIES ((LPCSTR)16)
896 #define PKCS_UTC_TIME ((LPCSTR)17)
897 #define PKCS_TIME_REQUEST ((LPCSTR)18)
898 #define RSA_CSP_PUBLICKEYBLOB ((LPCSTR)19)
899 #define X509_UNICODE_NAME ((LPCSTR)20)
900 #define X509_KEYGEN_REQUEST_TO_BE_SIGNED ((LPCSTR)21)
901 #define PKCS_ATTRIBUTE ((LPCSTR)22)
902 #define PKCS_CONTENT_INFO_SEQUENCE_OF_ANY ((LPCSTR)23)
903 #define X509_UNICODE_NAME_VALUE ((LPCSTR)24)
904 #define X509_UNICODE_ANY_STRING X509_UNICODE_NAME_VALUE
905 #define X509_OCTET_STRING ((LPCSTR)25)
906 #define X509_BITS ((LPCSTR)26)
907 #define X509_INTEGER ((LPCSTR)27)
908 #define X509_MULTI_BYTE_INTEGER ((LPCSTR)28)
909 #define X509_ENUMERATED ((LPCSTR)29)
910 #define X509_CRL_REASON_CODE X509_ENUMERATED
911 #define X509_CHOICE_OF_TIME ((LPCSTR)30)
912 #define X509_AUTHORITY_KEY_ID2 ((LPCSTR)31)
913 #define X509_AUTHORITY_INFO_ACCESS ((LPCSTR)32)
914 #define PKCS_CONTENT_INFO ((LPCSTR)33)
915 #define X509_SEQUENCE_OF_ANY ((LPCSTR)34)
916 #define X509_CRL_DIST_POINTS ((LPCSTR)35)
917 #define X509_ENHANCED_KEY_USAGE ((LPCSTR)36)
918 #define PKCS_CTL ((LPCSTR)37)
919 #define X509_MULTI_BYTE_UINT ((LPCSTR)38)
920 #define X509_DSS_PUBLICKEY X509_MULTI_BYTE_UINT
921 #define X509_DSS_PARAMETERS ((LPCSTR)39)
922 #define X509_DSS_SIGNATURE ((LPCSTR)40)
923 #define PKCS_RC2_CBC_PARAMETERS ((LPCSTR)41)
924 #define PKCS_SMIME_CAPABILITIES ((LPCSTR)42)
925 #define PKCS_RSA_PRIVATE_KEY ((LPCSTR)43)
926 #define PKCS_PRIVATE_KEY_INFO ((LPCSTR)44)
927 #define PKCS_ENCRYPTED_PRIVATE_KEY_INFO ((LPCSTR)45)
928 #define X509_PKIX_POLICY_QUALIFIER_USERNOTICE ((LPCSTR)46)
929 #define X509_DH_PUBLICKEY X509_MULTI_BYTE_UINT
930 #define X509_DH_PARAMETERS ((LPCSTR)47)
931 #define PKCS_ATTRIBUTES ((LPCSTR)48)
932 #define PKCS_SORTED_CTL ((LPCSTR)49)
933 #define X942_DH_PARAMETERS ((LPCSTR)50)
934 #define X509_BITS_WITHOUT_TRAILING_ZEROES ((LPCSTR)51)
935 #define X942_OTHER_INFO ((LPCSTR)52)
936 #define X509_CERT_PAIR ((LPCSTR)53)
937 #define X509_ISSUING_DIST_POINT ((LPCSTR)54)
938 #define X509_NAME_CONSTRAINTS ((LPCSTR)55)
939 #define X509_POLICY_MAPPINGS ((LPCSTR)56)
940 #define X509_POLICY_CONSTRAINTS ((LPCSTR)57)
941 #define X509_CROSS_CERT_DIST_POINTS ((LPCSTR)58)
942 #define CMC_DATA ((LPCSTR)59)
943 #define CMC_RESPONSE ((LPCSTR)60)
944 #define CMC_STATUS ((LPCSTR)61)
945 #define CMC_ADD_EXTENSIONS ((LPCSTR)62)
946 #define CMC_ADD_ATTRIBUTES ((LPCSTR)63)
947 #define X509_CERTIFICATE_TEMPLATE ((LPCSTR)64)
948 #define PKCS7_SIGNER_INFO ((LPCSTR)500)
949 #define CMS_SIGNER_INFO ((LPCSTR)501)
950
951 /* encode/decode flags */
952 #define CRYPT_ENCODE_NO_SIGNATURE_BYTE_REVERSAL_FLAG 0x00008
953 #define CRYPT_ENCODE_ALLOC_FLAG 0x08000
954 #define CRYPT_SORTED_CTL_ENCODE_HASHED_SUBJECT_IDENTIFIER_FLAG 0x10000
955 #define CRYPT_UNICODE_NAME_ENCODE_ENABLE_T61_UNICODE_FLAG \
956 CERT_RDN_ENABLE_T61_UNICODE_FLAG
957 #define CRYPT_UNICODE_NAME_ENCODE_ENABLE_UTF8_UNICODE_FLAG \
958 CERT_RDN_ENABLE_UTF8_UNICODE_FLAG
959 #define CRYPT_UNICODE_NAME_ENCODE_DISABLE_CHECK_TYPE_FLAG \
960 CERT_RDN_DISABLE_CHECK_TYPE_FLAG
961
962 #define CRYPT_DECODE_NOCOPY_FLAG 0x00001
963 #define CRYPT_DECODE_TO_BE_SIGNED_FLAG 0x00002
964 #define CRYPT_DECODE_SHARE_OID_STRING_FLAG 0x00004
965 #define CRYPT_DECODE_NO_SIGNATURE_BYTE_REVERSAL_FLAG 0x00008
966 #define CRYPT_DECODE_ALLOC_FLAG 0x08000
967 #define CRYPT_UNICODE_NAME_DECODE_DISABLE_IE4_UTF8_FLAG \
968 CERT_RDN_DISABLE_IE4_UTF8_FLAG
969
970 /* types for CertOpenStore dwEncodingType */
971 #define CERT_ENCODING_TYPE_MASK 0x0000ffff
972 #define CMSG_ENCODING_TYPE_MASK 0xffff0000
973 #define GET_CERT_ENCODING_TYPE(x) ((x) & CERT_ENCODING_TYPE_MASK)
974 #define GET_CMSG_ENCODING_TYPE(x) ((x) & CMSG_ENCODING_TYPE_MASK)
975
976 #define CRYPT_ASN_ENCODING 0x00000001
977 #define CRYPT_NDR_ENCODING 0x00000002
978 #define X509_ASN_ENCODING 0x00000001
979 #define X509_NDR_ENCODING 0x00000002
980 #define PKCS_7_ASN_ENCODING 0x00010000
981 #define PKCS_7_NDR_ENCODING 0x00020000
982
983 /* Installable OID function defs */
984 #define CRYPT_OID_OPEN_STORE_PROV_FUNC "CertDllOpenStoreProv"
985 #define CRYPT_OID_ENCODE_OBJECT_FUNC "CryptDllEncodeObject"
986 #define CRYPT_OID_DECODE_OBJECT_FUNC "CryptDllDecodeObject"
987 #define CRYPT_OID_ENCODE_OBJECT_EX_FUNC "CryptDllEncodeObjectEx"
988 #define CRYPT_OID_DECODE_OBJECT_EX_FUNC "CryptDllDecodeObjectEx"
989 #define CRYPT_OID_CREATE_COM_OBJECT_FUNC "CryptDllCreateComObject"
990 #define CRYPT_OID_VERIFY_REVOCATION_FUNC "CertDllVerifyRevocation"
991 #define CRYPT_OID_VERIFY_CTL_USAGE_FUNC "CertDllVerifyCTLUsage"
992 #define CRYPT_OID_FORMAT_OBJECT_FUNC "CryptDllFormatObject"
993 #define CRYPT_OID_FIND_OID_INFO_FUNC "CryptDllFindOIDInfo"
994 #define CRYPT_OID_FIND_LOCALIZED_NAME_FUNC "CryptDllFindLocalizedName"
995 #define CRYPT_OID_EXPORT_PUBLIC_KEY_INFO_FUNC "CryptDllExportPublicKeyInfoEx"
996 #define CRYPT_OID_IMPORT_PUBLIC_KEY_INFO_FUNC "CryptDllImportPublicKeyInfoEx"
997 #define CRYPT_OID_EXPORT_PRIVATE_KEY_INFO_FUNC "CryptDllExportPrivateKeyInfoEx"
998 #define CRYPT_OID_IMPORT_PRIVATE_KEY_INFO_FUNC "CryptDllImportPrivateKeyInfoEx"
999 #define CRYPT_OID_VERIFY_CERTIFICATE_CHAIN_POLICY_FUNC \
1000 "CertDllVerifyCertificateChainPolicy"
1001 #define URL_OID_GET_OBJECT_URL_FUNC "UrlDllGetObjectUrl"
1002 #define TIME_VALID_OID_GET_OBJECT_FUNC "TimeValidDllGetObject"
1003
1004 #define HP_ALGID 1
1005 #define HP_HASHVAL 2
1006 #define HP_HASHSIZE 4
1007 #define CRYPT_FAILED FALSE
1008 #define CRYPT_SUCCEED TRUE
1009 #define RCRYPT_SUCCEEDED(r) ((r)==CRYPT_SUCCEED)
1010 #define RCRYPT_FAILED(r) ((r)==CRYPT_FAILED)
1011 #define PP_CLIENT_HWND 1
1012 #define PP_ENUMALGS 1
1013 #define PP_ENUMCONTAINERS 2
1014 #define PP_IMPTYPE 3
1015 #define PP_NAME 4
1016 #define PP_VERSION 5
1017 #define PP_CONTAINER 6
1018 #define PP_CHANGE_PASSWORD 7
1019 #define PP_KEYSET_SEC_DESCR 8
1020 #define PP_CERTCHAIN 9
1021 #define PP_KEY_TYPE_SUBTYPE 10
1022 #define PP_PROVTYPE 16
1023 #define PP_KEYSTORAGE 17
1024 #define PP_APPLI_CERT 18
1025 #define PP_SYM_KEYSIZE 19
1026 #define PP_SESSION_KEYSIZE 20
1027 #define PP_UI_PROMPT 21
1028 #define PP_ENUMALGS_EX 22
1029 #define PP_ENUMMANDROOTS 25
1030 #define PP_ENUMELECTROOTS 26
1031 #define PP_KEYSET_TYPE 27
1032 #define PP_ADMIN_PIN 31
1033 #define PP_KEYEXCHANGE_PIN 32
1034 #define PP_SIGNATURE_PIN 33
1035 #define PP_SIG_KEYSIZE_INC 34
1036 #define PP_KEYX_KEYSIZE_INC 35
1037 #define PP_UNIQUE_CONTAINER 36
1038 #define PP_SGC_INFO 37
1039 #define PP_USE_HARDWARE_RNG 38
1040 #define PP_KEYSPEC 39
1041 #define PP_ENUMEX_SIGNING_PROT 40
1042 #define CRYPT_FIRST 1
1043 #define CRYPT_NEXT 2
1044 #define CRYPT_IMPL_HARDWARE 1
1045 #define CRYPT_IMPL_SOFTWARE 2
1046 #define CRYPT_IMPL_MIXED 3
1047 #define CRYPT_IMPL_UNKNOWN 4
1048 #define PROV_RSA_FULL 1
1049 #define PROV_RSA_SIG 2
1050 #define PROV_DSS 3
1051 #define PROV_FORTEZZA 4
1052 #define PROV_MS_MAIL 5
1053 #define PROV_SSL 6
1054 #define PROV_STT_MER 7
1055 #define PROV_STT_ACQ 8
1056 #define PROV_STT_BRND 9
1057 #define PROV_STT_ROOT 10
1058 #define PROV_STT_ISS 11
1059 #define PROV_RSA_SCHANNEL 12
1060 #define PROV_DSS_DH 13
1061 #define PROV_EC_ECDSA_SIG 14
1062 #define PROV_EC_ECNRA_SIG 15
1063 #define PROV_EC_ECDSA_FULL 16
1064 #define PROV_EC_ECNRA_FULL 17
1065 #define PROV_DH_SCHANNEL 18
1066 #define PROV_SPYRUS_LYNKS 20
1067 #define PROV_RNG 21
1068 #define PROV_INTEL_SEC 22
1069 #define MAXUIDLEN 64
1070 #define CUR_BLOB_VERSION 2
1071 #define X509_ASN_ENCODING 1
1072 #define PKCS_7_ASN_ENCODING 65536
1073 #define CERT_V1 0
1074 #define CERT_V2 1
1075 #define CERT_V3 2
1076 #define CERT_E_CHAINING (-2146762486)
1077 #define CERT_E_CN_NO_MATCH (-2146762481)
1078 #define CERT_E_EXPIRED (-2146762495)
1079 #define CERT_E_PURPOSE (-2146762490)
1080 #define CERT_E_REVOCATION_FAILURE (-2146762482)
1081 #define CERT_E_REVOKED (-2146762484)
1082 #define CERT_E_ROLE (-2146762493)
1083 #define CERT_E_UNTRUSTEDROOT (-2146762487)
1084 #define CERT_E_UNTRUSTEDTESTROOT (-2146762483)
1085 #define CERT_E_VALIDITYPERIODNESTING (-2146762494)
1086 #define CERT_E_WRONG_USAGE (-2146762480)
1087 #define CERT_E_PATHLENCONST (-2146762492)
1088 #define CERT_E_CRITICAL (-2146762491)
1089 #define CERT_E_ISSUERCHAINING (-2146762489)
1090 #define CERT_E_MALFORMED (-2146762488)
1091 #define CRYPT_E_REVOCATION_OFFLINE (-2146885613)
1092 #define CRYPT_E_REVOKED (-2146885616)
1093 #define TRUST_E_BASIC_CONSTRAINTS (-2146869223)
1094 #define TRUST_E_CERT_SIGNATURE (-2146869244)
1095 #define TRUST_E_FAIL (-2146762485)
1096 #define CERT_TRUST_NO_ERROR 0
1097 #define CERT_TRUST_IS_NOT_TIME_VALID 1
1098 #define CERT_TRUST_IS_NOT_TIME_NESTED 2
1099 #define CERT_TRUST_IS_REVOKED 4
1100 #define CERT_TRUST_IS_NOT_SIGNATURE_VALID 8
1101 #define CERT_TRUST_IS_NOT_VALID_FOR_USAGE 16
1102 #define CERT_TRUST_IS_UNTRUSTED_ROOT 32
1103 #define CERT_TRUST_REVOCATION_STATUS_UNKNOWN 64
1104 #define CERT_TRUST_IS_CYCLIC 128
1105 #define CERT_TRUST_IS_PARTIAL_CHAIN 65536
1106 #define CERT_TRUST_CTL_IS_NOT_TIME_VALID 131072
1107 #define CERT_TRUST_CTL_IS_NOT_SIGNATURE_VALID 262144
1108 #define CERT_TRUST_CTL_IS_NOT_VALID_FOR_USAGE 524288
1109 #define CERT_TRUST_HAS_EXACT_MATCH_ISSUER 1
1110 #define CERT_TRUST_HAS_KEY_MATCH_ISSUER 2
1111 #define CERT_TRUST_HAS_NAME_MATCH_ISSUER 4
1112 #define CERT_TRUST_IS_SELF_SIGNED 8
1113 #define CERT_TRUST_IS_COMPLEX_CHAIN 65536
1114 #define CERT_CHAIN_POLICY_BASE ((LPCSTR) 1)
1115 #define CERT_CHAIN_POLICY_AUTHENTICODE ((LPCSTR) 2)
1116 #define CERT_CHAIN_POLICY_AUTHENTICODE_TS ((LPCSTR) 3)
1117 #define CERT_CHAIN_POLICY_SSL ((LPCSTR) 4)
1118 #define CERT_CHAIN_POLICY_BASIC_CONSTRAINTS ((LPCSTR) 5)
1119 #define CERT_CHAIN_POLICY_NT_AUTH ((LPCSTR) 6)
1120 #define USAGE_MATCH_TYPE_AND 0
1121 #define USAGE_MATCH_TYPE_OR 1
1122 #define CERT_SIMPLE_NAME_STR 1
1123 #define CERT_OID_NAME_STR 2
1124 #define CERT_X500_NAME_STR 3
1125 #define CERT_NAME_STR_SEMICOLON_FLAG 1073741824
1126 #define CERT_NAME_STR_CRLF_FLAG 134217728
1127 #define CERT_NAME_STR_NO_PLUS_FLAG 536870912
1128 #define CERT_NAME_STR_NO_QUOTING_FLAG 268435456
1129 #define CERT_NAME_STR_REVERSE_FLAG 33554432
1130 #define CERT_NAME_STR_ENABLE_T61_UNICODE_FLAG 131072
1131 #define CERT_FIND_ANY 0
1132 #define CERT_FIND_CERT_ID 1048576
1133 #define CERT_FIND_CTL_USAGE 655360
1134 #define CERT_FIND_ENHKEY_USAGE 655360
1135 #define CERT_FIND_EXISTING 851968
1136 #define CERT_FIND_HASH 65536
1137 #define CERT_FIND_ISSUER_ATTR 196612
1138 #define CERT_FIND_ISSUER_NAME 131076
1139 #define CERT_FIND_ISSUER_OF 786432
1140 #define CERT_FIND_KEY_IDENTIFIER 983040
1141 #define CERT_FIND_KEY_SPEC 589824
1142 #define CERT_FIND_MD5_HASH 262144
1143 #define CERT_FIND_PROPERTY 327680
1144 #define CERT_FIND_PUBLIC_KEY 393216
1145 #define CERT_FIND_SHA1_HASH 65536
1146 #define CERT_FIND_SIGNATURE_HASH 917504
1147 #define CERT_FIND_SUBJECT_ATTR 196615
1148 #define CERT_FIND_SUBJECT_CERT 720896
1149 #define CERT_FIND_SUBJECT_NAME 131079
1150 #define CERT_FIND_SUBJECT_STR_A 458759
1151 #define CERT_FIND_SUBJECT_STR_W 524295
1152 #define CERT_FIND_ISSUER_STR_A 458756
1153 #define CERT_FIND_ISSUER_STR_W 524292
1154 #define CERT_FIND_OR_ENHKEY_USAGE_FLAG 16
1155 #define CERT_FIND_OPTIONAL_ENHKEY_USAGE_FLAG 1
1156 #define CERT_FIND_NO_ENHKEY_USAGE_FLAG 8
1157 #define CERT_FIND_VALID_ENHKEY_USAGE_FLAG 32
1158 #define CERT_FIND_EXT_ONLY_ENHKEY_USAGE_FLAG 2
1159 #define CERT_CASE_INSENSITIVE_IS_RDN_ATTRS_FLAG 2
1160 #define CERT_UNICODE_IS_RDN_ATTRS_FLAG 1
1161 #define CERT_CHAIN_FIND_BY_ISSUER 1
1162 #define CERT_CHAIN_FIND_BY_ISSUER_COMPARE_KEY_FLAG 1
1163 #define CERT_CHAIN_FIND_BY_ISSUER_COMPLEX_CHAIN_FLAG 2
1164 #define CERT_CHAIN_FIND_BY_ISSUER_CACHE_ONLY_FLAG 32768
1165 #define CERT_CHAIN_FIND_BY_ISSUER_CACHE_ONLY_URL_FLAG 4
1166 #define CERT_CHAIN_FIND_BY_ISSUER_LOCAL_MACHINE_FLAG 8
1167 #define CERT_CHAIN_FIND_BY_ISSUER_NO_KEY_FLAG 16384
1168 #define CERT_STORE_PROV_SYSTEM 10
1169 #define CERT_SYSTEM_STORE_LOCAL_MACHINE 131072
1170 #define szOID_PKIX_KP_SERVER_AUTH "4235600"
1171 #define szOID_SERVER_GATED_CRYPTO "4235658"
1172 #define szOID_SGC_NETSCAPE "2.16.840.1.113730.4.1"
1173 #define szOID_PKIX_KP_CLIENT_AUTH "1.3.6.1.5.5.7.3.2"
1174 #define CRYPT_NOHASHOID 0x00000001
1175 #define CRYPT_NO_SALT 0x10
1176 #define CRYPT_PREGEN 0x40
1177 #define CRYPT_RECIPIENT 0x10
1178 #define CRYPT_INITIATOR 0x40
1179 #define CRYPT_ONLINE 0x80
1180 #define CRYPT_SF 0x100
1181 #define CRYPT_CREATE_IV 0x200
1182 #define CRYPT_KEK 0x400
1183 #define CRYPT_DATA_KEY 0x800
1184 #define CRYPT_VOLATILE 0x1000
1185 #define CRYPT_SGCKEY 0x2000
1186 #define KP_IV 0x00000001
1187 #define KP_SALT 0x00000002
1188 #define KP_PADDING 0x00000003
1189 #define KP_MODE 0x00000004
1190 #define KP_MODE_BITS 0x00000005
1191 #define KP_PERMISSIONS 0x00000006
1192 #define KP_ALGID 0x00000007
1193 #define KP_BLOCKLEN 0x00000008
1194 #define KP_KEYLEN 0x00000009
1195 #define KP_SALT_EX 0x0000000a
1196 #define KP_P 0x0000000b
1197 #define KP_G 0x0000000c
1198 #define KP_Q 0x0000000d
1199 #define KP_X 0x0000000e
1200 #define KP_Y 0x0000000f
1201 #define KP_RA 0x00000010
1202 #define KP_RB 0x00000011
1203 #define KP_INFO 0x00000012
1204 #define KP_EFFECTIVE_KEYLEN 0x00000013
1205 #define KP_SCHANNEL_ALG 0x00000014
1206 #define KP_PUB_PARAMS 0x00000027
1207 #define CRYPT_FLAG_PCT1 0x0001
1208 #define CRYPT_FLAG_SSL2 0x0002
1209 #define CRYPT_FLAG_SSL3 0x0004
1210 #define CRYPT_FLAG_TLS1 0x0008
1211 #define CRYPT_FLAG_IPSEC 0x0010
1212 #define CRYPT_FLAG_SIGNING 0x0020
1213 #define SCHANNEL_MAC_KEY 0x00000000
1214 #define SCHANNEL_ENC_KEY 0x00000001
1215 #define INTERNATIONAL_USAGE 0x00000001
1216
1217 typedef UINT ALG_ID;
1218 typedef struct _VTableProvStruc {
1219 DWORD Version;
1220 FARPROC pFuncVerifyImage;
1221 FARPROC pFuncReturnhWnd;
1222 DWORD dwProvType;
1223 BYTE *pbContextInfo;
1224 DWORD cbContextInfo;
1225 LPSTR pszProvName;
1226 } VTableProvStruc, *PVTableProvStruc;
1227 typedef ULONG HCRYPTPROV;
1228 typedef ULONG HCRYPTKEY;
1229 typedef ULONG HCRYPTHASH;
1230 typedef PVOID HCERTSTORE;
1231 typedef PVOID HCRYPTMSG;
1232 typedef PVOID HCERTCHAINENGINE;
1233 typedef struct _CRYPTOAPI_BLOB {
1234 DWORD cbData;
1235 BYTE* pbData;
1236 } CRYPT_INTEGER_BLOB, *PCRYPT_INTEGER_BLOB,
1237 CRYPT_UINT_BLOB, *PCRYPT_UINT_BLOB,
1238 CRYPT_OBJID_BLOB, *PCRYPT_OBJID_BLOB,
1239 CERT_NAME_BLOB, *PCERT_NAME_BLOB,
1240 CERT_RDN_VALUE_BLOB,*PCERT_RDN_VALUE_BLOB,
1241 CERT_BLOB, *PCERT_BLOB,
1242 CRL_BLOB, *PCRL_BLOB,
1243 DATA_BLOB, *PDATA_BLOB,
1244 CRYPT_DATA_BLOB, *PCRYPT_DATA_BLOB,
1245 CRYPT_HASH_BLOB, *PCRYPT_HASH_BLOB,
1246 CRYPT_DIGEST_BLOB, *PCRYPT_DIGEST_BLOB,
1247 CRYPT_DER_BLOB, *PCRYPT_DER_BLOB,
1248 CRYPT_ATTR_BLOB, *PCRYPT_ATTR_BLOB;
1249 /* not described in SDK; has the same layout as HTTPSPolicyCallbackData */
1250 typedef struct _SSL_EXTRA_CERT_CHAIN_POLICY_PARA {
1251 DWORD cbStruct;
1252 DWORD dwAuthType;
1253 DWORD fdwChecks;
1254 LPWSTR pwszServerName;
1255 } SSL_EXTRA_CERT_CHAIN_POLICY_PARA, *PSSL_EXTRA_CERT_CHAIN_POLICY_PARA,
1256 HTTPSPolicyCallbackData, *PHTTPSPolicyCallbackData;
1257 /* #if (_WIN32_WINNT>=0x500) */
1258 typedef struct _CERT_CHAIN_POLICY_PARA {
1259 DWORD cbSize;
1260 DWORD dwFlags;
1261 void* pvExtraPolicyPara;
1262 } CERT_CHAIN_POLICY_PARA, *PCERT_CHAIN_POLICY_PARA;
1263 typedef struct _CERT_CHAIN_POLICY_STATUS {
1264 DWORD cbSize;
1265 DWORD dwError;
1266 LONG lChainIndex;
1267 LONG lElementIndex;
1268 void* pvExtraPolicyStatus;
1269 } CERT_CHAIN_POLICY_STATUS, *PCERT_CHAIN_POLICY_STATUS;
1270 /* #endif */
1271 typedef struct _CRYPT_ALGORITHM_IDENTIFIER {
1272 LPSTR pszObjId;
1273 CRYPT_OBJID_BLOB Parameters;
1274 } CRYPT_ALGORITHM_IDENTIFIER, *PCRYPT_ALGORITHM_IDENTIFIER;
1275 typedef struct _CRYPT_BIT_BLOB {
1276 DWORD cbData;
1277 BYTE* pbData;
1278 DWORD cUnusedBits;
1279 } CRYPT_BIT_BLOB, *PCRYPT_BIT_BLOB;
1280 typedef struct _CERT_PUBLIC_KEY_INFO {
1281 CRYPT_ALGORITHM_IDENTIFIER Algorithm;
1282 CRYPT_BIT_BLOB PublicKey;
1283 } CERT_PUBLIC_KEY_INFO, *PCERT_PUBLIC_KEY_INFO;
1284 typedef struct _CERT_EXTENSION {
1285 LPSTR pszObjId;
1286 BOOL fCritical;
1287 CRYPT_OBJID_BLOB Value;
1288 } CERT_EXTENSION, *PCERT_EXTENSION;
1289 typedef struct _CERT_INFO {
1290 DWORD dwVersion;
1291 CRYPT_INTEGER_BLOB SerialNumber;
1292 CRYPT_ALGORITHM_IDENTIFIER SignatureAlgorithm;
1293 CERT_NAME_BLOB Issuer;
1294 FILETIME NotBefore;
1295 FILETIME NotAfter;
1296 CERT_NAME_BLOB Subject;
1297 CERT_PUBLIC_KEY_INFO SubjectPublicKeyInfo;
1298 CRYPT_BIT_BLOB IssuerUniqueId;
1299 CRYPT_BIT_BLOB SubjectUniqueId;
1300 DWORD cExtension;
1301 PCERT_EXTENSION rgExtension;
1302 } CERT_INFO, *PCERT_INFO;
1303 typedef struct _CERT_CONTEXT {
1304 DWORD dwCertEncodingType;
1305 BYTE* pbCertEncoded;
1306 DWORD cbCertEncoded;
1307 PCERT_INFO pCertInfo;
1308 HCERTSTORE hCertStore;
1309 } CERT_CONTEXT, *PCERT_CONTEXT;
1310 typedef const CERT_CONTEXT *PCCERT_CONTEXT;
1311 typedef struct _CTL_USAGE {
1312 DWORD cUsageIdentifier;
1313 LPSTR *rgpszUsageIdentifier;
1314 } CTL_USAGE, *PCTRL_USAGE,
1315 CERT_ENHKEY_USAGE, *PCERT_ENHKEY_USAGE;
1316 typedef struct _CERT_USAGE_MATCH {
1317 DWORD dwType;
1318 CERT_ENHKEY_USAGE Usage;
1319 } CERT_USAGE_MATCH, *PCERT_USAGE_MATCH;
1320 typedef struct _CRYPT_ATTRIBUTE_TYPE_VALUE {
1321 LPSTR pszObjId;
1322 CRYPT_OBJID_BLOB Value;
1323 } CRYPT_ATTRIBUTE_TYPE_VALUE, *PCRYPT_ATTRIBUTE_TYPE_VALUE;
1324 /* #if (_WIN32_WINNT>=0x500) */
1325 typedef struct _CERT_CHAIN_PARA {
1326 DWORD cbSize;
1327 CERT_USAGE_MATCH RequestedUsage;
1328 #if CERT_CHAIN_PARA_HAS_EXTRA_FIELDS
1329 CERT_USAGE_MATCH RequestedIssuancePolicy;
1330 DWORD dwUrlRetrievalTimeout;
1331 BOOL fCheckRevocationFreshnessTime;
1332 DWORD dwRevocationFreshnessTime;
1333 #endif
1334 } CERT_CHAIN_PARA, *PCERT_CHAIN_PARA;
1335 typedef BOOL (WINAPI *PFN_CERT_CHAIN_FIND_BY_ISSUER_CALLBACK)(PCCERT_CONTEXT,void*);
1336 typedef struct _CERT_CHAIN_FIND_BY_ISSUER_PARA {
1337 DWORD cbSize;
1338 LPCSTR pszUsageIdentifier;
1339 DWORD dwKeySpec;
1340 DWORD dwAcquirePrivateKeyFlags;
1341 DWORD cIssuer;
1342 CERT_NAME_BLOB* rgIssuer;
1343 PFN_CERT_CHAIN_FIND_BY_ISSUER_CALLBACK pfnFIndCallback;
1344 void* pvFindArg;
1345 DWORD* pdwIssuerChainIndex;
1346 DWORD* pdwIssuerElementIndex;
1347 } CERT_CHAIN_FIND_BY_ISSUER_PARA, *PCERT_CHAIN_FIND_BY_ISSUER_PARA;
1348 /* #endif */
1349
1350 typedef struct _CERT_POLICY_ID {
1351 DWORD cCertPolicyElementId;
1352 LPSTR *rgbszCertPolicyElementId;
1353 } CERT_POLICY_ID, *PCERT_POLICY_ID;
1354
1355 typedef struct _PUBLICKEYSTRUC {
1356 BYTE bType;
1357 BYTE bVersion;
1358 WORD reserved;
1359 ALG_ID aiKeyAlg;
1360 } BLOBHEADER, PUBLICKEYSTRUC;
1361
1362 typedef struct _CERT_KEY_USAGE_RESTRICTION_INFO {
1363 DWORD cCertPolicyId;
1364 PCERT_POLICY_ID rgCertPolicyId;
1365 CRYPT_BIT_BLOB RestrictedKeyUsage;
1366 } CERT_KEY_USAGE_RESTRICTION_INFO, *PCERT_KEY_USAGE_RESTRICTION_INFO;
1367
1368 typedef struct _CERT_OTHER_NAME {
1369 LPSTR pszObjId;
1370 CRYPT_OBJID_BLOB Value;
1371 } CERT_OTHER_NAME, *PCERT_OTHER_NAME;
1372
1373 typedef struct _CERT_ALT_NAME_ENTRY {
1374 DWORD dwAltNameChoice;
1375 union {
1376 PCERT_OTHER_NAME pOtherName;
1377 LPWSTR pwszRfc822Name;
1378 LPWSTR pwszDNSName;
1379 CERT_NAME_BLOB DirectoryName;
1380 LPWSTR pwszURL;
1381 CRYPT_DATA_BLOB IPAddress;
1382 LPSTR pszRegisteredID;
1383 } DUMMYUNIONNAME;
1384 } CERT_ALT_NAME_ENTRY, *PCERT_ALT_NAME_ENTRY;
1385
1386 #define CERT_ALT_NAME_OTHER_NAME 1
1387 #define CERT_ALT_NAME_RFC822_NAME 2
1388 #define CERT_ALT_NAME_DNS_NAME 3
1389 #define CERT_ALT_NAME_X400_ADDRESS 4
1390 #define CERT_ALT_NAME_DIRECTORY_NAME 5
1391 #define CERT_ALT_NAME_EDI_PARTY_NAME 6
1392 #define CERT_ALT_NAME_URL 7
1393 #define CERT_ALT_NAME_IP_ADDRESS 8
1394 #define CERT_ALT_NAME_REGISTERED_ID 9
1395
1396 typedef struct _CERT_ALT_NAME_INFO {
1397 DWORD cAltEntry;
1398 PCERT_ALT_NAME_ENTRY rgAltEntry;
1399 } CERT_ALT_NAME_INFO, *PCERT_ALT_NAME_INFO;
1400
1401 /* Encode/decode object */
1402 typedef LPVOID (WINAPI *PFN_CRYPT_ALLOC)(size_t cbsize);
1403 typedef VOID (WINAPI *PFN_CRYPT_FREE)(LPVOID pv);
1404
1405 typedef struct _CRYPT_ENCRYPT_MESSAGE_PARA {
1406 DWORD cbSize;
1407 DWORD dwMsgEncodingType;
1408 HCRYPTPROV hCryptProv;
1409 CRYPT_ALGORITHM_IDENTIFIER ContentEncryptionAlgorithm;
1410 void* pvEncryptionAuxInfo;
1411 DWORD dwFlags;
1412 DWORD dwInnerContentType;
1413 } CRYPT_ENCRYPT_MESSAGE_PARA, *PCRYPT_ENCRYPT_MESSAGE_PARA;
1414 typedef struct _CRYPT_DECODE_PARA {
1415 DWORD cbSize;
1416 PFN_CRYPT_ALLOC pfnAlloc;
1417 PFN_CRYPT_FREE pfnFree;
1418 } CRYPT_DECODE_PARA, *PCRYPT_DECODE_PARA;
1419 typedef struct _CRYPT_SEQUENCE_OF_ANY {
1420 DWORD cValue;
1421 PCRYPT_DER_BLOB rgValue;
1422 } CRYPT_SEQUENCE_OF_ANY, *PCRYPT_SEQUENCE_OF_ANY;
1423 typedef struct _CERT_TRUST_STATUS {
1424 DWORD dwErrorStatus;
1425 DWORD dwInfoStatus;
1426 } CERT_TRUST_STATUS, *PCERT_TRUST_STATUS;
1427 typedef struct _CRL_ENTRY {
1428 CRYPT_INTEGER_BLOB SerialNumber;
1429 FILETIME RevocationDate;
1430 DWORD cExtension;
1431 PCERT_EXTENSION rgExtension;
1432 } CRL_ENTRY, *PCRL_ENTRY;
1433 typedef struct _CRL_INFO {
1434 DWORD dwVersion;
1435 CRYPT_ALGORITHM_IDENTIFIER SignatureAlgorithm;
1436 CERT_NAME_BLOB Issuer;
1437 FILETIME ThisUpdate;
1438 FILETIME NextUpdate;
1439 DWORD cCRLEntry;
1440 PCRL_ENTRY rgCRLEntry;
1441 DWORD cExtension;
1442 PCERT_EXTENSION rgExtension;
1443 } CRL_INFO, *PCRL_INFO;
1444 typedef struct _CRL_CONTEXT {
1445 DWORD dwCertEncodingType;
1446 BYTE* pbCrlEncoded;
1447 DWORD cbCrlEncoded;
1448 PCRL_INFO pCrlInfo;
1449 HCERTSTORE hCertStore;
1450 } CRL_CONTEXT, *PCRL_CONTEXT;
1451 typedef const CRL_CONTEXT *PCCRL_CONTEXT;
1452 typedef struct _CERT_REVOCATION_CRL_INFO {
1453 DWORD cbSize;
1454 PCCRL_CONTEXT pBaseCRLContext;
1455 PCCRL_CONTEXT pDeltaCRLContext;
1456 PCRL_ENTRY pCrlEntry;
1457 BOOL fDeltaCrlEntry;
1458 } CERT_REVOCATION_CRL_INFO, *PCERT_REVOCATION_CRL_INFO;
1459 typedef struct _CERT_REVOCATION_INFO {
1460 DWORD cbSize;
1461 DWORD dwRevocationResult;
1462 LPCSTR pszRevocationOid;
1463 LPVOID pvOidSpecificInfo;
1464 BOOL fHasFreshnessTime;
1465 DWORD dwFreshnessTime;
1466 PCERT_REVOCATION_CRL_INFO pCrlInfo;
1467 } CERT_REVOCATION_INFO, *PCERT_REVOCATION_INFO;
1468 /* #if (_WIN32_WINNT>=0x500) */
1469 typedef struct _CERT_CHAIN_ELEMENT {
1470 DWORD cbSize;
1471 PCCERT_CONTEXT pCertContext;
1472 CERT_TRUST_STATUS TrustStatus;
1473 PCERT_REVOCATION_INFO pRevocationInfo;
1474 PCERT_ENHKEY_USAGE pIssuanceUsage;
1475 PCERT_ENHKEY_USAGE pApplicationUsage;
1476 } CERT_CHAIN_ELEMENT, *PCERT_CHAIN_ELEMENT;
1477 /* #endif */
1478 typedef struct _CRYPT_ATTRIBUTE {
1479 LPSTR pszObjId;
1480 DWORD cValue;
1481 PCRYPT_ATTR_BLOB rgValue;
1482 } CRYPT_ATTRIBUTE, *PCRYPT_ATTRIBUTE;
1483 typedef struct _CTL_ENTRY {
1484 CRYPT_DATA_BLOB SubjectIdentifier;
1485 DWORD cAttribute;
1486 PCRYPT_ATTRIBUTE rgAttribute;
1487 } CTL_ENTRY, *PCTL_ENTRY;
1488 typedef struct _CTL_INFO {
1489 DWORD dwVersion;
1490 CTL_USAGE SubjectUsage;
1491 CRYPT_DATA_BLOB ListIdentifier;
1492 CRYPT_INTEGER_BLOB SequenceNumber;
1493 FILETIME ThisUpdate;
1494 FILETIME NextUpdate;
1495 CRYPT_ALGORITHM_IDENTIFIER SubjectAlgorithm;
1496 DWORD cCTLEntry;
1497 PCTL_ENTRY rgCTLEntry;
1498 DWORD cExtension;
1499 PCERT_EXTENSION rgExtension;
1500 } CTL_INFO, *PCTL_INFO;
1501 typedef struct _CTL_CONTEXT {
1502 DWORD dwMsgAndCertEncodingType;
1503 BYTE* pbCtlEncoded;
1504 DWORD cbCtlEncoded;
1505 PCTL_INFO pCtlInfo;
1506 HCERTSTORE hCertStore;
1507 HCRYPTMSG hCryptMsg;
1508 BYTE* pbCtlContent;
1509 DWORD cbCtlContent;
1510 } CTL_CONTEXT, *PCTL_CONTEXT;
1511 typedef const CTL_CONTEXT *PCCTL_CONTEXT;
1512 typedef struct _CERT_TRUST_LIST_INFO {
1513 DWORD cbSize;
1514 PCTL_ENTRY pCtlEntry;
1515 PCCTL_CONTEXT pCtlContext;
1516 } CERT_TRUST_LIST_INFO, *PCERT_TRUST_LIST_INFO;
1517 typedef struct _CERT_SIMPLE_CHAIN {
1518 DWORD cbSize;
1519 CERT_TRUST_STATUS TrustStatus;
1520 DWORD cElement;
1521 PCERT_CHAIN_ELEMENT* rgpElement;
1522 PCERT_TRUST_LIST_INFO pTrustListInfo;
1523 BOOL fHasRevocationFreshnessTime;
1524 DWORD dwRevocationFreshnessTime;
1525 } CERT_SIMPLE_CHAIN, *PCERT_SIMPLE_CHAIN;
1526 /* #if (_WIN32_WINNT>=0x500) */
1527 typedef const struct _CERT_CHAIN_CONTEXT* PCCERT_CHAIN_CONTEXT;
1528 typedef struct _CERT_CHAIN_CONTEXT {
1529 DWORD cbSize;
1530 CERT_TRUST_STATUS TrustStatus;
1531 DWORD cChain;
1532 PCERT_SIMPLE_CHAIN* rgpChain;
1533 DWORD cLowerQualityChainContext;
1534 PCCERT_CHAIN_CONTEXT* rgpLowerQualityChainContext;
1535 BOOL fHasRevocationFreshnessTime;
1536 DWORD dwRevocationFreshnessTime;
1537 } CERT_CHAIN_CONTEXT, *PCERT_CHAIN_CONTEXT;
1538 /* #endif */
1539 typedef struct _PROV_ENUMALGS {
1540 ALG_ID aiAlgid;
1541 DWORD dwBitLen;
1542 DWORD dwNameLen;
1543 CHAR szName[20];
1544 } PROV_ENUMALGS;
1545 typedef struct _RSAPUBKEY {
1546 DWORD magic;
1547 DWORD bitlen;
1548 DWORD pubexp;
1549 } RSAPUBKEY;
1550 typedef struct _CRYPTPROTECT_PROMPTSTRUCT{
1551 DWORD cbSize;
1552 DWORD dwPromptFlags;
1553 HWND hwndApp;
1554 LPCWSTR szPrompt;
1555 } CRYPTPROTECT_PROMPTSTRUCT, *PCRYPTPROTECT_PROMPTSTRUCT;
1556
1557 typedef struct _CERT_SIGNED_CONTENT_INFO {
1558 CRYPT_DER_BLOB ToBeSigned;
1559 CRYPT_ALGORITHM_IDENTIFIER SignatureAlgorithm;
1560 CRYPT_BIT_BLOB Signature;
1561 } CERT_SIGNED_CONTENT_INFO, *PCERT_SIGNED_CONTENT_INFO;
1562
1563 typedef struct _CERT_EXTENSIONS {
1564 DWORD cExtension;
1565 PCERT_EXTENSION rgExtension;
1566 } CERT_EXTENSIONS, *PCERT_EXTENSIONS;
1567
1568 typedef struct _CERT_RDN_ATTR {
1569 LPSTR pszObjId;
1570 DWORD dwValueType;
1571 CERT_RDN_VALUE_BLOB Value;
1572 } CERT_RDN_ATTR, *PCERT_RDN_ATTR;
1573
1574 typedef struct _CERT_NAME_VALUE {
1575 DWORD dwValueType;
1576 CERT_RDN_VALUE_BLOB Value;
1577 } CERT_NAME_VALUE, *PCERT_NAME_VALUE;
1578
1579 typedef struct _CERT_RDN {
1580 DWORD cRDNAttr;
1581 PCERT_RDN_ATTR rgRDNAttr;
1582 } CERT_RDN, *PCERT_RDN;
1583
1584 typedef struct _CERT_NAME_INFO {
1585 DWORD cRDN;
1586 PCERT_RDN rgRDN;
1587 } CERT_NAME_INFO, *PCERT_NAME_INFO;
1588
1589 typedef struct _CRYPT_ENCODE_PARA {
1590 DWORD cbSize;
1591 PFN_CRYPT_ALLOC pfnAlloc;
1592 PFN_CRYPT_FREE pfnFree;
1593 } CRYPT_ENCODE_PARA, *PCRYPT_ENCODE_PARA;
1594
1595 typedef struct _CERT_SYSTEM_STORE_INFO {
1596 DWORD cbSize;
1597 } CERT_SYSTEM_STORE_INFO, *PCERT_SYSTEM_STORE_INFO;
1598
1599 typedef struct _CERT_PHYSICAL_STORE_INFO {
1600 DWORD cbSize;
1601 LPSTR pszOpenStoreProvider;
1602 DWORD dwOpenEncodingType;
1603 DWORD dwOpenFlags;
1604 CRYPT_DATA_BLOB OpenParameters;
1605 DWORD dwFlags;
1606 DWORD dwPriority;
1607 } CERT_PHYSICAL_STORE_INFO, *PCERT_PHYSICAL_STORE_INFO;
1608
1609 typedef struct _CERT_STORE_PROV_INFO {
1610 DWORD cbSize;
1611 DWORD cStoreProvFunc;
1612 void **rgpvStoreProvFunc;
1613 HCERTSTOREPROV hStoreProv;
1614 DWORD dwStoreProvFlags;
1615 HCRYPTOIDFUNCADDR hStoreProvFuncAddr2;
1616 } CERT_STORE_PROV_INFO, *PCERT_STORE_PROV_INFO;
1617
1618 #define CERT_ALT_NAME_ENTRY_ERR_INDEX_MASK 0xff
1619 #define CERT_ALT_NAME_ENTRY_ERR_INDEX_SHIFT 16
1620 #define CERT_ALT_NAME_VALUE_ERR_INDEX_MASK 0x0000ffff
1621 #define CERT_ALT_NAME_VALUE_ERR_INDEX_SHIFT 0
1622 #define GET_CERT_ALT_NAME_ENTRY_ERR_INDEX(x) \
1623 (((x) >> CERT_ALT_NAME_ENTRY_ERR_INDEX_SHIFT) & \
1624 CERT_ALT_NAME_ENTRY_ERR_INDEX_MASK)
1625 #define GET_CERT_ALT_NAME_VALUE_ERR_INDEX(x) \
1626 ((x) & CERT_ALT_NAME_VALUE_ERR_INDEX_MASK)
1627
1628 typedef struct _CERT_BASIC_CONSTRAINTS2_INFO {
1629 BOOL fCA;
1630 BOOL fPathLenConstraint;
1631 DWORD dwPathLenConstraint;
1632 } CERT_BASIC_CONSTRAINTS2_INFO, *PCERT_BASIC_CONSTRAINTS2_INFO;
1633
1634 typedef BOOL (WINAPI *PFN_CERT_ENUM_SYSTEM_STORE_LOCATION)(
1635 LPCWSTR pwszStoreLocation, DWORD dwFlags, void *pvReserved, void *pvArg);
1636
1637 typedef BOOL (WINAPI *PFN_CERT_ENUM_SYSTEM_STORE)(const void *pvSystemStore,
1638 DWORD dwFlags, PCERT_SYSTEM_STORE_INFO pStoreInfo, void *pvReserved,
1639 void *pvArg);
1640
1641 typedef BOOL (WINAPI *PFN_CERT_ENUM_PHYSICAL_STORE)(const void *pvSystemStore,
1642 DWORD dwFlags, LPCWSTR pwszStoreName, PCERT_PHYSICAL_STORE_INFO pStoreInfo,
1643 void *pvReserved, void *pvArg);
1644
1645 /* Encode/decode object */
1646 typedef LPVOID (WINAPI *PFN_CRYPT_ALLOC)(size_t cbsize);
1647 typedef VOID (WINAPI *PFN_CRYPT_FREE)(LPVOID pv);
1648
1649 typedef BOOL (WINAPI *PFN_CERT_DLL_OPEN_STORE_PROV_FUNC)(
1650 LPCSTR lpszStoreProvider, DWORD dwEncodingType, HCRYPTPROV hCryptProv,
1651 DWORD dwFlags, const void *pvPara, HCERTSTORE hCertStore,
1652 PCERT_STORE_PROV_INFO pStoreProvInfo);
1653
1654 typedef void (WINAPI *PFN_CERT_STORE_PROV_CLOSE)(HCERTSTOREPROV hStoreProv,
1655 DWORD dwFlags);
1656
1657 typedef BOOL (WINAPI *PFN_CERT_STORE_PROV_READ_CERT)(HCERTSTOREPROV hStoreProv,
1658 PCCERT_CONTEXT pStoreCertContext, DWORD dwFlags,
1659 PCCERT_CONTEXT *ppProvCertContext);
1660
1661 typedef BOOL (WINAPI *PFN_CERT_STORE_PROV_WRITE_CERT)(HCERTSTOREPROV hStoreProv,
1662 PCCERT_CONTEXT pCertContext, DWORD dwFlags);
1663
1664 typedef BOOL (WINAPI *PFN_CERT_STORE_PROV_DELETE_CERT)(
1665 HCERTSTOREPROV hStoreProv, PCCERT_CONTEXT pCertContext, DWORD dwFlags);
1666
1667 typedef BOOL (WINAPI *PFN_CERT_STORE_PROV_SET_CERT_PROPERTY)(
1668 HCERTSTOREPROV hStoreProv, PCCERT_CONTEXT pCertContext, DWORD dwPropId,
1669 DWORD dwFlags, const void *pvData);
1670
1671 typedef BOOL (WINAPI *PFN_CERT_STORE_PROV_READ_CRL)(HCERTSTOREPROV hStoreProv,
1672 PCCRL_CONTEXT pStoreCrlContext, DWORD dwFlags,
1673 PCCRL_CONTEXT *ppProvCrlContext);
1674
1675 typedef BOOL (WINAPI *PFN_CERT_STORE_PROV_WRITE_CRL)(HCERTSTOREPROV hStoreProv,
1676 PCCRL_CONTEXT pCrlContext, DWORD dwFlags);
1677
1678 typedef BOOL (WINAPI *PFN_CERT_STORE_PROV_DELETE_CRL)(HCERTSTOREPROV hStoreProv,
1679 PCCRL_CONTEXT pCrlContext, DWORD dwFlags);
1680
1681 typedef BOOL (WINAPI *PFN_CERT_STORE_PROV_SET_CRL_PROPERTY)(
1682 HCERTSTOREPROV hStoreProv, PCCRL_CONTEXT pCrlContext, DWORD dwPropId,
1683 DWORD dwFlags, const void *pvData);
1684
1685 typedef BOOL (WINAPI *PFN_CERT_STORE_PROV_READ_CTL)(HCERTSTOREPROV hStoreProv,
1686 PCCTL_CONTEXT pStoreCtlContext, DWORD dwFlags,
1687 PCCTL_CONTEXT *ppProvCtlContext);
1688
1689 typedef BOOL (WINAPI *PFN_CERT_STORE_PROV_WRITE_CTL)(HCERTSTOREPROV hStoreProv,
1690 PCCTL_CONTEXT pCtlContext, DWORD dwFlags);
1691
1692 typedef BOOL (WINAPI *PFN_CERT_STORE_PROV_DELETE_CTL)(
1693 HCERTSTOREPROV hStoreProv, PCCTL_CONTEXT pCtlContext, DWORD dwFlags);
1694
1695 typedef BOOL (WINAPI *PFN_CERT_STORE_PROV_SET_CTL_PROPERTY)(
1696 HCERTSTOREPROV hStoreProv, PCCTL_CONTEXT pCtlContext, DWORD dwPropId,
1697 DWORD dwFlags, const void *pvData);
1698
1699 typedef BOOL (WINAPI *PFN_CERT_STORE_PROV_CONTROL)(HCERTSTOREPROV hStoreProv,
1700 DWORD dwFlags, DWORD dwCtrlType, void const *pvCtrlPara);
1701
1702 /* subject types for CryptVerifyCertificateSignatureEx */
1703 #define CRYPT_VERIFY_CERT_SIGN_SUBJECT_BLOB 1
1704 #define CRYPT_VERIFY_CERT_SIGN_SUBJECT_CERT 2
1705 #define CRYPT_VERIFY_CERT_SIGN_SUBJECT_CRL 3
1706
1707 /* issuer types for CryptVerifyCertificateSignatureEx */
1708 #define CRYPT_VERIFY_CERT_SIGN_ISSUER_PUBKEY 1
1709 #define CRYPT_VERIFY_CERT_SIGN_ISSUER_CERT 2
1710 #define CRYPT_VERIFY_CERT_SIGN_ISSUER_CHAIN 3
1711 #define CRYPT_VERIFY_CERT_SIGN_ISSUER_NULL 4
1712
1713 /* crypt32.dll functions */
1714 LPVOID WINAPI CryptMemAlloc(ULONG cbSize);
1715 LPVOID WINAPI CryptMemRealloc(LPVOID pv, ULONG cbSize);
1716 VOID WINAPI CryptMemFree(LPVOID pv);
1717
1718 PCRYPT_ATTRIBUTE WINAPI CertFindAttribute(LPCSTR pszObjId, DWORD cAttr, CRYPT_ATTRIBUTE rgAttr[]);
1719 PCERT_EXTENSION WINAPI CertFindExtension(LPCSTR pszObjId, DWORD cExtensions, CERT_EXTENSION rgExtensions[]);
1720 PCERT_RDN_ATTR WINAPI CertFindRDNAttr(LPCSTR pszObjId, PCERT_NAME_INFO pName);
1721
1722 BOOL WINAPI CertSerializeCertificateStoreElement(PCCERT_CONTEXT pCertContext, DWORD dwFlags, BYTE *pbElement, DWORD *pcbElement);
1723 BOOL WINAPI CertSerializeCRLStoreElement(PCCRL_CONTEXT pCrlContext, DWORD dwFlags, BYTE *pbElement, DWORD *pcbElement);
1724 BOOL WINAPI CertSerializeCTLStoreElement(PCCTL_CONTEXT pCtlContext, DWORD dwFlags, BYTE *pbElement, DWORD *pcbElement);
1725 BOOL WINAPI CertAddCertificateContextToStore(HCERTSTORE hCertStore, PCCERT_CONTEXT pCertContext, DWORD dwAddDisposition, PCCERT_CONTEXT *ppStoreContext);
1726 BOOL WINAPI CertAddEncodedCertificateToStore(HCERTSTORE hCertStore, DWORD dwCertEncodingType, const BYTE *pbCertEncoded, DWORD cbCertEncoded, DWORD dwAddDisposition, PCCERT_CONTEXT *ppCertContext);
1727 PCCERT_CONTEXT WINAPI CertCreateCertificateContext(DWORD dwCertEncodingType, const BYTE *pbCertEncoded, DWORD cbCertEncoded);
1728 PCCERT_CONTEXT WINAPI CertEnumCertificatesInStore(HCERTSTORE hCertStore, PCCERT_CONTEXT pPrev);
1729 PCCERT_CONTEXT WINAPI CertFindCertificateInStore(HCERTSTORE,DWORD,DWORD,DWORD,const void*,PCCERT_CONTEXT);
1730 PCCTL_CONTEXT WINAPI CertEnumCTLsInStore(HCERTSTORE hCertStore, PCCTL_CONTEXT pPrev);
1731 PCCTL_CONTEXT WINAPI CertCreateCTLContext(DWORD dwMsgAndCertEncodingType, const BYTE *pbCtlEncoded, DWORD cbCtlEncoded);
1732 PCCRL_CONTEXT WINAPI CertCreateCRLContext( DWORD dwCertEncodingType, const BYTE* pbCrlEncoded, DWORD cbCrlEncoded);
1733 PCCRL_CONTEXT WINAPI CertEnumCRLsInStore(HCERTSTORE hCertStore, PCCRL_CONTEXT pPrev);
1734 BOOL WINAPI CryptHashCertificate(HCRYPTPROV hCryptProv, ALG_ID Algid, DWORD dwFlags, const BYTE *pbEncoded, DWORD cbEncoded, BYTE *pbComputedHash, DWORD *pcbComputedHash);
1735 BOOL WINAPI CertFreeCTLContext( PCCTL_CONTEXT pCtlContext );
1736 BOOL WINAPI CertDeleteCTLFromStore(PCCTL_CONTEXT pCtlContext);
1737 BOOL WINAPI CertSetCTLContextProperty(PCCTL_CONTEXT pCTLContext, DWORD dwPropId, DWORD dwFlags, const void *pvData);
1738 BOOL WINAPI CertGetCTLContextProperty(PCCTL_CONTEXT pCTLContext, DWORD dwPropId, void *pvData, DWORD *pcbData);
1739 BOOL WINAPI CertAddCTLContextToStore( HCERTSTORE hCertStore, PCCTL_CONTEXT pCtlContext, DWORD dwAddDisposition, PCCTL_CONTEXT *ppStoreContext );
1740 BOOL WINAPI CertFreeCRLContext( PCCRL_CONTEXT pCrlContext );
1741 BOOL WINAPI CertSetCRLContextProperty(PCCRL_CONTEXT pCRLContext, DWORD dwPropId, DWORD dwFlags, const void *pvData);
1742 BOOL WINAPI CertDeleteCRLFromStore(PCCRL_CONTEXT pCrlContext);
1743 BOOL WINAPI CertAddEncodedCTLToStore(HCERTSTORE hCertStore, DWORD dwMsgAndCertEncodingType, const BYTE *pbCtlEncoded, DWORD cbCtlEncoded, DWORD dwAddDisposition, PCCTL_CONTEXT *ppCtlContext);
1744 BOOL WINAPI CertAddEncodedCRLToStore(HCERTSTORE hCertStore, DWORD dwCertEncodingType, const BYTE *pbCrlEncoded, DWORD cbCrlEncoded, DWORD dwAddDisposition, PCCRL_CONTEXT *ppCrlContext);
1745 BOOL WINAPI CertDeleteCertificateFromStore(PCCERT_CONTEXT pCertContext);
1746 BOOL WINAPI CertSetCertificateContextProperty(PCCERT_CONTEXT pCertContext, DWORD dwPropId, DWORD dwFlags, const void *pvData);
1747 BOOL WINAPI CertAddCRLContextToStore( HCERTSTORE hCertStore, PCCRL_CONTEXT pCrlContext, DWORD dwAddDisposition, PCCRL_CONTEXT *ppStoreContext );
1748 BOOL WINAPI CertGetCRLContextProperty(PCCRL_CONTEXT pCRLContext, DWORD dwPropId, void *pvData, DWORD *pcbData);
1749 BOOL WINAPI CertGetCertificateContextProperty(PCCERT_CONTEXT pCertContext, DWORD dwPropId, void *pvData, DWORD *pcbData);
1750 BOOL WINAPI CertCloseStore(HCERTSTORE,DWORD);
1751 BOOL WINAPI CertGetCertificateChain(HCERTCHAINENGINE,PCCERT_CONTEXT,LPFILETIME,HCERTSTORE,PCERT_CHAIN_PARA,DWORD,LPVOID,PCCERT_CHAIN_CONTEXT*);
1752 BOOL WINAPI CertVerifyCertificateChainPolicy(LPCSTR,PCCERT_CHAIN_CONTEXT,PCERT_CHAIN_POLICY_PARA,PCERT_CHAIN_POLICY_STATUS);
1753 void WINAPI CertFreeCertificateChain(PCCERT_CHAIN_CONTEXT);
1754 DWORD WINAPI CertNameToStrA(DWORD,PCERT_NAME_BLOB,DWORD,LPSTR,DWORD);
1755 DWORD WINAPI CertNameToStrW(DWORD,PCERT_NAME_BLOB,DWORD,LPWSTR,DWORD);
1756 HCERTSTORE WINAPI CertOpenSystemStoreA(HCRYPTPROV,LPCSTR);
1757 HCERTSTORE WINAPI CertOpenSystemStoreW(HCRYPTPROV,LPCWSTR);
1758 DWORD WINAPI CertGetNameStringW(PCCERT_CONTEXT pCertContext, DWORD dwType, DWORD dwFlags, LPVOID pvType, LPWSTR pszName, DWORD dwName);
1759 DWORD WINAPI CertGetNameStringA(PCCERT_CONTEXT pCertContext, DWORD dwType, DWORD dwFlags, LPVOID pvType, LPSTR pszName, DWORD dwName);
1760 HCERTSTORE WINAPI CertOpenStore(LPCSTR lpszStoreProvider, DWORD dwEncodingType, HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara);
1761 BOOL WINAPI CertFreeCertificateContext(PCCERT_CONTEXT);
1762 DWORD WINAPI CertNameToStrA(DWORD dwCertEncoding, PCERT_NAME_BLOB pCertName, DWORD dwType, LPSTR psz, DWORD dwSZ);
1763 DWORD WINAPI CertNameToStrW(DWORD dwCertEncoding, PCERT_NAME_BLOB pCertName, DWORD dwType, LPWSTR psz, DWORD dwSZ);
1764 PCCERT_CONTEXT WINAPI CertGetIssuerCertificateFromStore(HCERTSTORE,PCCERT_CONTEXT,PCCERT_CONTEXT,DWORD*);
1765 PCCERT_CHAIN_CONTEXT WINAPI CertFindChainInStore(HCERTSTORE,DWORD,DWORD,DWORD,const void*,PCCERT_CHAIN_CONTEXT);
1766 BOOL WINAPI CryptAcquireContextA(HCRYPTPROV*,LPCSTR,LPCSTR,DWORD,DWORD);
1767 BOOL WINAPI CryptAcquireContextW(HCRYPTPROV*,LPCWSTR,LPCWSTR,DWORD,DWORD);
1768 BOOL WINAPI CryptContextAddRef(HCRYPTPROV,DWORD*,DWORD);
1769 BOOL WINAPI CryptReleaseContext(HCRYPTPROV,DWORD);
1770 BOOL WINAPI CryptGenKey(HCRYPTPROV,ALG_ID,DWORD,HCRYPTKEY*);
1771 BOOL WINAPI CryptDeriveKey(HCRYPTPROV,ALG_ID,HCRYPTHASH,DWORD,HCRYPTKEY*);
1772 BOOL WINAPI CryptDestroyKey(HCRYPTKEY);
1773 BOOL WINAPI CryptEncryptMessage( PCRYPT_ENCRYPT_MESSAGE_PARA pEncryptMessagePara, DWORD dwCert, PCCERT_CONTEXT pccertCert[], const BYTE* pbEncrypted, DWORD dwEncrypted, BYTE* pbBlob, DWORD* dwEncryptedBlob);
1774 #if (WINVER >= 0x0500)
1775 BOOL WINAPI CryptDuplicateHash(HCRYPTHASH,DWORD*,DWORD,HCRYPTHASH*);
1776 BOOL WINAPI CryptDuplicateKey(HCRYPTKEY,DWORD*,DWORD,HCRYPTKEY*);
1777 #endif
1778 BOOL WINAPI CertAddStoreToCollection(HCERTSTORE hCollectionStore, HCERTSTORE hSiblingStore, DWORD dwUpdateFlags, DWORD dwPriority);
1779 BOOL WINAPI CryptExportKey (HCRYPTKEY hKey, HCRYPTKEY hExpKey, DWORD dwBlobType, DWORD dwFlags, BYTE *pbData, DWORD *pdwDataLen);
1780 LPCSTR WINAPI CertAlgIdToOID(DWORD dwAlgId);
1781 DWORD WINAPI CertOIDToAlgId(LPCSTR pszObjId);
1782 BOOL WINAPI CryptExportPublicKeyInfo(HCRYPTPROV hCryptProv, DWORD dwKeySpec, DWORD dwCertEncodingType, PCERT_PUBLIC_KEY_INFO pInfo, DWORD *pcbInfo);
1783 BOOL WINAPI CryptExportPublicKeyInfoEx(HCRYPTPROV hCryptProv, DWORD dwKeySpec, DWORD dwCertEncodingType, LPSTR pszPublicKeyObjId, DWORD dwFlags, void *pvAuxInfo, PCERT_PUBLIC_KEY_INFO pInfo, DWORD *pcbInfo);
1784 BOOL WINAPI CryptImportPublicKeyInfo(HCRYPTPROV hCryptProv, DWORD dwCertEncodingType, PCERT_PUBLIC_KEY_INFO pInfo, HCRYPTKEY *phKey);
1785 BOOL WINAPI CryptImportPublicKeyInfoEx(HCRYPTPROV hCryptProv, DWORD dwCertEncodingType, PCERT_PUBLIC_KEY_INFO pInfo, ALG_ID aiKeyAlg, DWORD dwFlags, void *pvAuxInfo, HCRYPTKEY *phKey);
1786 BOOL WINAPI CryptProtectData( DATA_BLOB* pDataIn, LPCWSTR szDataDescr, DATA_BLOB* pOptionalEntropy, PVOID pvReserved, CRYPTPROTECT_PROMPTSTRUCT* pPromptStruct, DWORD dwFlags, DATA_BLOB* pDataOut );
1787 BOOL WINAPI CryptUnprotectData( DATA_BLOB* pDataIn, LPWSTR* ppszDataDescr, DATA_BLOB* pOptionalEntropy, PVOID pvReserved, CRYPTPROTECT_PROMPTSTRUCT* pPromptStruct, DWORD dwFlags, DATA_BLOB* pDataOut );
1788 BOOL WINAPI CryptVerifyCertificateSignature(HCRYPTPROV hCryptProv, DWORD dwCertEncodingType, const BYTE *pbEncoded, DWORD cbEncoded, PCERT_PUBLIC_KEY_INFO pPublicKey);
1789 BOOL WINAPI CryptVerifyCertificateSignatureEx(HCRYPTPROV hCryptProv, DWORD dwCertEncodingType, DWORD dwSubjectType, void *pvSubject, DWORD dwIssuerType, void *pvIssuer, DWORD dwFlags, void *pvReserved);
1790 BOOL WINAPI CryptSetKeyParam(HCRYPTKEY,DWORD,PBYTE,DWORD);
1791 BOOL WINAPI CryptGetKeyParam(HCRYPTKEY,DWORD,PBYTE,PDWORD,DWORD);
1792 BOOL WINAPI CryptDecodeObject(DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo);
1793 BOOL WINAPI CryptDecodeObjectEx(DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo);
1794 BOOL WINAPI CryptSetHashParam(HCRYPTHASH,DWORD,PBYTE,DWORD);
1795 BOOL WINAPI CryptGetHashParam(HCRYPTHASH,DWORD,PBYTE,PDWORD,DWORD);
1796 BOOL WINAPI CryptSetProvParam(HCRYPTPROV,DWORD,PBYTE,DWORD);
1797 BOOL WINAPI CryptGetProvParam(HCRYPTPROV,DWORD,PBYTE,PDWORD,DWORD);
1798 BOOL WINAPI CryptGenRandom(HCRYPTPROV,DWORD,PBYTE);
1799 BOOL WINAPI CryptGetUserKey(HCRYPTPROV,DWORD,HCRYPTKEY*);
1800 BOOL WINAPI CryptExportKey(HCRYPTKEY,HCRYPTKEY,DWORD,DWORD,PBYTE,PDWORD);
1801 BOOL WINAPI CryptImportKey(HCRYPTPROV,PBYTE,DWORD,HCRYPTKEY,DWORD,HCRYPTKEY*);
1802 BOOL WINAPI CryptEncrypt(HCRYPTKEY,HCRYPTHASH,BOOL,DWORD,PBYTE,PDWORD,DWORD);
1803 BOOL WINAPI CryptDecrypt(HCRYPTKEY,HCRYPTHASH,BOOL,DWORD,PBYTE,PDWORD);
1804 BOOL WINAPI CryptCreateHash(HCRYPTPROV,ALG_ID,HCRYPTKEY,DWORD,HCRYPTHASH*);
1805 BOOL WINAPI CryptHashData (HCRYPTHASH hHash, const BYTE *pbData, DWORD dwDataLen, DWORD dwFlags);
1806 BOOL WINAPI CryptHashSessionKey(HCRYPTHASH,HCRYPTKEY,DWORD);
1807 BOOL WINAPI CryptGetHashValue(HCRYPTHASH,DWORD,PBYTE,PDWORD);
1808 BOOL WINAPI CryptDestroyHash(HCRYPTHASH);
1809 BOOL WINAPI CryptSignHashA(HCRYPTHASH,DWORD,LPCSTR,DWORD,PBYTE,PDWORD);
1810 BOOL WINAPI CryptSignHashW(HCRYPTHASH,DWORD,LPCWSTR,DWORD,PBYTE,PDWORD);
1811 BOOL WINAPI CryptVerifySignatureA(HCRYPTHASH,PBYTE,DWORD,HCRYPTKEY,LPCSTR,DWORD);
1812 BOOL WINAPI CryptVerifySignatureW(HCRYPTHASH,PBYTE,DWORD,HCRYPTKEY,LPCWSTR,DWORD);
1813 BOOL WINAPI CryptSetProviderA(LPCSTR,DWORD);
1814 BOOL WINAPI CryptSetProviderW(LPCWSTR,DWORD);
1815 BOOL WINAPI CryptSetProviderExA(LPCSTR,DWORD,DWORD*,DWORD);
1816 BOOL WINAPI CryptSetProviderExW(LPCWSTR,DWORD,DWORD*,DWORD);
1817 BOOL WINAPI CryptEncodeObject(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, BYTE *pbEncoded, DWORD *pcbEncoded);
1818 BOOL WINAPI CryptEncodeObjectEx(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, void *pvEncoded, DWORD *pcbEncoded);
1819
1820 #ifdef UNICODE
1821 #define CertNameToStr CertNameToStrW
1822 #define CryptAcquireContext CryptAcquireContextW
1823 #define CryptSignHash CryptSignHashW
1824 #define CryptVerifySignature CryptVerifySignatureW
1825 #define CryptSetProvider CryptSetProviderW
1826 #define CertOpenSystemStore CertOpenSystemStoreW
1827 #define CERT_FIND_SUBJECT_STR CERT_FIND_SUBJECT_STR_W
1828 #define CERT_FIND_ISSUER_STR CERT_FIND_ISSUER_STR_W
1829 #define MS_DEF_PROV MS_DEF_PROV_W
1830 #define MS_ENHANCED_PROV MS_ENHANCED_PROV_W
1831 #define MS_STRONG_PROV MS_STRONG_PROV_W
1832 #define MS_DEF_RSA_SIG_PROV MS_DEF_RSA_SIG_PROV_W
1833 #define MS_DEF_RSA_SCHANNEL_PROV MS_DEF_RSA_SCHANNEL_PROV_W
1834 #define MS_DEF_DSS_PROV MS_DEF_DSS_PROV_W
1835 #define MS_DEF_DSS_DH_PROV MS_DEF_DSS_DH_PROV_W
1836 #define MS_ENH_DSS_DH_PROV MS_ENH_DSS_DH_PROV_W
1837 #define MS_DEF_DH_SCHANNEL_PROV MS_DEF_DH_SCHANNEL_PROV_W
1838 #define MS_SCARD_PROV MS_SCARD_PROV_W
1839 #else
1840 #define CertNameToStr CertNameToStrA
1841 #define CryptAcquireContext CryptAcquireContextA
1842 #define CryptSignHash CryptSignHashA
1843 #define CryptVerifySignature CryptVerifySignatureA
1844 #define CryptSetProvider CryptSetProviderA
1845 #define CertOpenSystemStore CertOpenSystemStoreA
1846 #define CERT_FIND_SUBJECT_STR CERT_FIND_SUBJECT_STR_A
1847 #define CERT_FIND_ISSUER_STR CERT_FIND_ISSUER_STR_A
1848 #define MS_DEF_PROV MS_DEF_PROV_A
1849 #define MS_ENHANCED_PROV MS_ENHANCED_PROV_A
1850 #define MS_STRONG_PROV MS_STRONG_PROV_A
1851 #define MS_DEF_RSA_SIG_PROV MS_DEF_RSA_SIG_PROV_A
1852 #define MS_DEF_RSA_SCHANNEL_PROV MS_DEF_RSA_SCHANNEL_PROV_A
1853 #define MS_DEF_DSS_PROV MS_DEF_DSS_PROV_A
1854 #define MS_DEF_DSS_DH_PROV MS_DEF_DSS_DH_PROV_A
1855 #define MS_ENH_DSS_DH_PROV MS_ENH_DSS_DH_PROV_A
1856 #define MS_DEF_DH_SCHANNEL_PROV MS_DEF_DH_SCHANNEL_PROV_A
1857 #define MS_SCARD_PROV MS_SCARD_PROV_A
1858 #endif
1859 #ifdef __cplusplus
1860 }
1861 #endif
1862 #endif /* _WINCRYPT_H */