source: Daodan/MinGW/include/wincrypt.h@ 1054

Last change on this file since 1054 was 1046, checked in by alloc, 8 years ago

Daodan: Added Windows MinGW and build batch file

File size: 57.6 KB
Line 
1/*
2 * wincrypt.h
3 *
4 * Cryptographic services API manifest constants and function prototypes.
5 *
6 * $Id: wincrypt.h,v 34e5e7606781 2016/05/23 18:31:09 keithmarshall $
7 *
8 * Written by Anders Norlander <anorland@hem2.passagen.se>
9 * Copyright (C) 1998-2000, 2002-2004, 2006-2008, 2010, 2015,
10 * MinGW.org Project
11 *
12 *
13 * Permission is hereby granted, free of charge, to any person obtaining a
14 * copy of this software and associated documentation files (the "Software"),
15 * to deal in the Software without restriction, including without limitation
16 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
17 * and/or sell copies of the Software, and to permit persons to whom the
18 * Software is furnished to do so, subject to the following conditions:
19 *
20 * The above copyright notice and this permission notice (including the next
21 * paragraph) shall be included in all copies or substantial portions of the
22 * Software.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30 * DEALINGS IN THE SOFTWARE.
31 *
32 */
33#ifndef _WINCRYPT_H
34#define _WINCRYPT_H
35#pragma GCC system_header
36
37#ifndef WINADVAPI
38#define WINADVAPI
39#endif
40
41_BEGIN_C_DECLS
42
43#define MS_DEF_PROV __AW_EXTENDED__( MS_DEF_PROV )
44#define MS_DEF_PROV_W __AW_STRING_W__( MS_DEF_PROV_A )
45#define MS_DEF_PROV_A "Microsoft Base Cryptographic Provider v1.0"
46
47#define MS_ENHANCED_PROV __AW_EXTENDED__( MS_ENHANCED_PROV )
48#define MS_ENHANCED_PROV_W __AW_STRING_W__( MS_ENHANCED_PROV_A )
49#define MS_ENHANCED_PROV_A "Microsoft Enhanced Cryptographic Provider v1.0"
50
51#define MS_STRONG_PROV __AW_EXTENDED__( MS_STRONG_PROV )
52#define MS_STRONG_PROV_W __AW_STRING_W__( MS_STRONG_PROV_A )
53#define MS_STRONG_PROV_A "Microsoft Strong Cryptographic Provider"
54
55#define MS_DEF_RSA_SIG_PROV __AW_EXTENDED__( MS_DEF_RSA_SIG_PROV )
56#define MS_DEF_RSA_SIG_PROV_W __AW_STRING_W__( MS_DEF_RSA_SIG_PROV_A )
57#define MS_DEF_RSA_SIG_PROV_A "Microsoft RSA Signature Cryptographic Provider"
58
59#define MS_DEF_RSA_SCHANNEL_PROV __AW_EXTENDED__( MS_DEF_RSA_SCHANNEL_PROV )
60#define MS_DEF_RSA_SCHANNEL_PROV_W __AW_STRING_W__( MS_DEF_RSA_SCHANNEL_PROV_A )
61#define MS_DEF_RSA_SCHANNEL_PROV_A "Microsoft RSA SChannel Cryptographic Provider"
62
63#define MS_DEF_DSS_PROV __AW_EXTENDED__( MS_DEF_DSS_PROV )
64#define MS_DEF_DSS_PROV_W __AW_STRING_W__( MS_DEF_DSS_PROV_A )
65#define MS_DEF_DSS_PROV_A "Microsoft Base DSS Cryptographic Provider"
66
67#define MS_DEF_DSS_DH_PROV __AW_EXTENDED__( MS_DEF_DSS_DH_PROV )
68#define MS_DEF_DSS_DH_PROV_W __AW_STRING_W__( MS_DEF_DSS_DH_PROV_A )
69#define MS_DEF_DSS_DH_PROV_A "Microsoft Base DSS and Diffie-Hellman Cryptographic Provider"
70
71#define MS_ENH_DSS_DH_PROV __AW_EXTENDED__( MS_ENH_DSS_DH_PROV )
72#define MS_ENH_DSS_DH_PROV_W __AW_STRING_W__( MS_ENH_DSS_DH_PROV_A )
73#define MS_ENH_DSS_DH_PROV_A "Microsoft Enhanced DSS and Diffie-Hellman Cryptographic Provider"
74
75#define MS_DEF_DH_SCHANNEL_PROV __AW_EXTENDED__( MS_DEF_DH_SCHANNEL_PROV )
76#define MS_DEF_DH_SCHANNEL_PROV_W __AW_STRING_W__( MS_DEF_DH_SCHANNEL_PROV_A )
77#define MS_DEF_DH_SCHANNEL_PROV_A "Microsoft DH SChannel Cryptographic Provider"
78
79#define MS_SCARD_PROV __AW_EXTENDED__( MS_SCARD_PROV )
80#define MS_SCARD_PROV_W __AW_STRING_W__( MS_SCARD_PROV_A )
81#define MS_SCARD_PROV_A "Microsoft Base Smart Card Crypto Provider"
82
83#if _WIN32_WINNT >= _WIN32_WINNT_WINXP
84# define MS_ENH_RSA_AES_PROV __AW_EXTENDED__( MS_ENH_RSA_AES_PROV )
85# define MS_ENH_RSA_AES_PROV_W __AW_STRING_W__( MS_ENH_RSA_AES_PROV_A )
86
87# if _WIN32_WINNT == _WIN32_WINNT_WINXP
88# define MS_ENH_RSA_AES_PROV_A "Microsoft Enhanced RSA and AES Cryptographic Provider (Prototype)"
89
90#else /* _WIN32_WINNT > _WIN32_WINNT_WINXP */
91# define MS_ENH_RSA_AES_PROV_A "Microsoft Enhanced RSA and AES Cryptographic Provider"
92# endif
93#endif
94
95#define GET_ALG_CLASS(x) ((x) & ALG_CLASS_ALL)
96#define GET_ALG_TYPE(x) ((x) & 0x1E00) /* x & 7680 */
97#define GET_ALG_SID(x) ((x) & 0x01FF) /* x & 511 */
98
99#define ALG_CLASS_ANY 0
100#define ALG_CLASS_SIGNATURE 0x2000 /* 8192 */
101#define ALG_CLASS_MSG_ENCRYPT 0x4000 /* 16384 */
102#define ALG_CLASS_DATA_ENCRYPT 0x6000 /* 24576 */
103#define ALG_CLASS_HASH 0x8000 /* 32768 */
104#define ALG_CLASS_KEY_EXCHANGE 0xA000 /* 40960 */
105#define ALG_CLASS_ALL 0xE000 /* (0x0007 << 13) */
106
107#define ALG_TYPE_ANY 0
108#define ALG_TYPE_DSS 0x0200 /* 512 */
109#define ALG_TYPE_RSA 0x0400 /* 1024 */
110#define ALG_TYPE_BLOCK 0x0600 /* 1536 */
111#define ALG_TYPE_STREAM 0x0800 /* 2048 */
112#define ALG_TYPE_DH 0x0A00 /* (0x0005 << 9) */
113#define ALG_TYPE_SECURECHANNEL 0x0C00 /* (6 << 9) */
114
115#define ALG_SID_ANY 0
116
117#define ALG_SID_RSA_ANY 0
118#define ALG_SID_RSA_PKCS 1
119#define ALG_SID_RSA_MSATWORK 2
120#define ALG_SID_RSA_ENTRUST 3
121#define ALG_SID_RSA_PGP 4
122
123#define ALG_SID_DSS_ANY 0
124#define ALG_SID_DSS_PKCS 1
125#define ALG_SID_DSS_DMS 2
126
127#define ALG_SID_DES 1
128#define ALG_SID_3DES 3
129#define ALG_SID_DESX 4
130#define ALG_SID_IDEA 5
131#define ALG_SID_CAST 6
132#define ALG_SID_SAFERSK64 7
133#define ALG_SID_SAFERSK128 8
134#define ALG_SID_3DES_112 9
135#define ALG_SID_SKIPJACK 10
136#define ALG_SID_TEK 11
137#define ALG_SID_CYLINK_MEK 12
138#define ALG_SID_RC5 13
139
140#define ALG_SID_RC4 1
141#define ALG_SID_RC2 2
142
143#define ALG_SID_SEAL 2
144
145#define ALG_SID_MD2 1
146#define ALG_SID_MD4 2
147#define ALG_SID_MD5 3
148#define ALG_SID_SHA 4
149#define ALG_SID_MAC 5
150#define ALG_SID_RIPEMD 6
151#define ALG_SID_RIPEMD160 7
152#define ALG_SID_SSL3SHAMD5 8
153#define ALG_SID_HMAC 9
154#define ALG_SID_TLS1PRF 10
155#define ALG_SID_AES_128 14
156#define ALG_SID_AES_192 15
157#define ALG_SID_AES_256 16
158#define ALG_SID_AES 17
159#define ALG_SID_EXAMPLE 80
160
161#define CALG_MD2 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MD2)
162#define CALG_MD4 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MD4)
163#define CALG_MD5 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MD5)
164#define CALG_SHA (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA)
165#define CALG_SHA1 CALG_SHA
166#define CALG_MAC (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MAC)
167#define CALG_3DES (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | 3)
168#define CALG_CYLINK_MEK (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | 12)
169#define CALG_SKIPJACK (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | 10)
170#define CALG_KEA_KEYX (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_STREAM | ALG_TYPE_DSS | 4)
171#define CALG_RSA_SIGN (ALG_CLASS_SIGNATURE | ALG_TYPE_RSA | ALG_SID_RSA_ANY)
172#define CALG_DSS_SIGN (ALG_CLASS_SIGNATURE | ALG_TYPE_DSS | ALG_SID_DSS_ANY)
173#define CALG_RSA_KEYX (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_RSA | ALG_SID_RSA_ANY)
174#define CALG_DES (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_DES)
175#define CALG_RC2 (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_RC2)
176#define CALG_RC4 (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_STREAM | ALG_SID_RC4)
177#define CALG_SEAL (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_STREAM | ALG_SID_SEAL)
178#define CALG_DH_EPHEM (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_STREAM | ALG_TYPE_DSS | ALG_SID_DSS_DMS)
179#define CALG_DESX (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_DESX)
180#define CALG_TLS1PRF (ALG_CLASS_DHASH | ALG_TYPE_ANY | ALG_SID_TLS1PRF)
181#define CALG_AES_128 (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_AES_128)
182#define CALG_AES_192 (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_AES_192)
183#define CALG_AES_256 (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_AES_256)
184#define CALG_AES (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_AES)
185
186/* dwFlags definitions for CryptAcquireContext
187 */
188#define CRYPT_VERIFYCONTEXT 0xF0000000
189#define CRYPT_NEWKEYSET 0x00000008
190#define CRYPT_DELETEKEYSET 0x00000010 /* 16 */
191#define CRYPT_MACHINE_KEYSET 0x00000020 /* 32 */
192#define CRYPT_SILENT 0x00000040 /* 64 */
193
194#define SIMPLEBLOB 1
195#define PUBLICKEYBLOB 6
196#define PRIVATEKEYBLOB 7
197#define PLAINTEXTKEYBLOB 8
198#define OPAQUEKEYBLOB 9
199#define PUBLICKEYBLOBEX 10
200#define SYMMETRICWRAPKEYBLOB 11
201
202#define AT_KEYEXCHANGE 1
203#define AT_SIGNATURE 2
204
205#define CRYPT_USERDATA 1
206
207#define PKCS5_PADDING 1
208
209#define CRYPT_MODE_CBC 1
210#define CRYPT_MODE_ECB 2
211#define CRYPT_MODE_OFB 3
212#define CRYPT_MODE_CFB 4
213#define CRYPT_MODE_CTS 5
214#define CRYPT_MODE_CBCI 6
215#define CRYPT_MODE_CFBP 7
216#define CRYPT_MODE_OFBP 8
217#define CRYPT_MODE_CBCOFM 9
218#define CRYPT_MODE_CBCOFMI 10
219
220#define CRYPT_ENCRYPT 0x0001
221#define CRYPT_DECRYPT 0x0002
222#define CRYPT_EXPORT 0x0004
223#define CRYPT_READ 0x0008
224#define CRYPT_WRITE 0x0010 /* 16 */
225#define CRYPT_MAC 0x0020 /* 32 */
226
227#define HP_ALGID 1
228#define HP_HASHVAL 2
229#define HP_HASHSIZE 4
230#define HP_HMAC_INFO 5
231
232#define CRYPT_FAILED FALSE
233#define CRYPT_SUCCEED TRUE
234#define RCRYPT_SUCCEEDED(r) ((r) == CRYPT_SUCCEED)
235#define RCRYPT_FAILED(r) ((r) == CRYPT_FAILED)
236
237#define PP_ENUMALGS 1
238#define PP_ENUMCONTAINERS 2
239#define PP_IMPTYPE 3
240#define PP_NAME 4
241#define PP_VERSION 5
242#define PP_CONTAINER 6
243#define PP_CHANGE_PASSWORD 7
244#define PP_KEYSET_SEC_DESCR 8
245#define PP_CERTCHAIN 9
246#define PP_KEY_TYPE_SUBTYPE 10
247#define PP_PROVTYPE 16
248#define PP_KEYSTORAGE 17
249#define PP_APPLI_CERT 18
250#define PP_SYM_KEYSIZE 19
251#define PP_SESSION_KEYSIZE 20
252#define PP_UI_PROMPT 21
253#define PP_ENUMALGS_EX 22
254#define PP_ENUMMANDROOTS 25
255#define PP_ENUMELECTROOTS 26
256#define PP_KEYSET_TYPE 27
257#define PP_ADMIN_PIN 31
258#define PP_KEYEXCHANGE_PIN 32
259#define PP_SIGNATURE_PIN 33
260#define PP_SIG_KEYSIZE_INC 34
261#define PP_KEYX_KEYSIZE_INC 35
262#define PP_UNIQUE_CONTAINER 36
263#define PP_SGC_INFO 37
264#define PP_USE_HARDWARE_RNG 38
265#define PP_KEYSPEC 39
266#define PP_ENUMEX_SIGNING_PROT 40
267
268#define CRYPT_FIRST 1
269#define CRYPT_NEXT 2
270
271#define CRYPT_IMPL_HARDWARE 1
272#define CRYPT_IMPL_SOFTWARE 2
273#define CRYPT_IMPL_MIXED 3
274#define CRYPT_IMPL_UNKNOWN 4
275
276#define PROV_RSA_FULL 1
277#define PROV_RSA_SIG 2
278#define PROV_DSS 3
279#define PROV_FORTEZZA 4
280#define PROV_MS_EXCHANGE 5
281#define PROV_MS_MAIL 5
282#define PROV_SSL 6
283#define PROV_STT_MER 7
284#define PROV_STT_ACQ 8
285#define PROV_STT_BRND 9
286#define PROV_STT_ROOT 10
287#define PROV_STT_ISS 11
288#define PROV_RSA_SCHANNEL 12
289#define PROV_DSS_DH 13
290#define PROV_EC_ECDSA_SIG 14
291#define PROV_EC_ECNRA_SIG 15
292#define PROV_EC_ECDSA_FULL 16
293#define PROV_EC_ECNRA_FULL 17
294#define PROV_DH_SCHANNEL 18
295#define PROV_SPYRUS_LYNKS 20
296#define PROV_RNG 21
297#define PROV_INTEL_SEC 22
298#define PROV_RSA_AES 24
299
300#define MAXUIDLEN 64
301
302#define CUR_BLOB_VERSION 2
303
304#define X509_ASN_ENCODING 1
305#define PKCS_7_ASN_ENCODING 65536
306
307#define CERT_V1 0
308#define CERT_V2 1
309#define CERT_V3 2
310
311#define CERT_E_CHAINING (-2146762486)
312#define CERT_E_CN_NO_MATCH (-2146762481)
313#define CERT_E_EXPIRED (-2146762495)
314#define CERT_E_PURPOSE (-2146762490)
315#define CERT_E_REVOCATION_FAILURE (-2146762482)
316#define CERT_E_REVOKED (-2146762484)
317#define CERT_E_ROLE (-2146762493)
318#define CERT_E_UNTRUSTEDROOT (-2146762487)
319#define CERT_E_UNTRUSTEDTESTROOT (-2146762483)
320#define CERT_E_VALIDITYPERIODNESTING (-2146762494)
321#define CERT_E_WRONG_USAGE (-2146762480)
322#define CERT_E_PATHLENCONST (-2146762492)
323#define CERT_E_CRITICAL (-2146762491)
324#define CERT_E_ISSUERCHAINING (-2146762489)
325#define CERT_E_MALFORMED (-2146762488)
326#define CRYPT_E_REVOCATION_OFFLINE (-2146885613)
327#define CRYPT_E_REVOKED (-2146885616)
328#define TRUST_E_BASIC_CONSTRAINTS (-2146869223)
329#define TRUST_E_CERT_SIGNATURE (-2146869244)
330#define TRUST_E_FAIL (-2146762485)
331
332#define CERT_TRUST_NO_ERROR 0
333#define CERT_TRUST_IS_NOT_TIME_VALID 0x00000001
334#define CERT_TRUST_IS_NOT_TIME_NESTED 0x00000002
335#define CERT_TRUST_IS_REVOKED 0x00000004
336#define CERT_TRUST_IS_NOT_SIGNATURE_VALID 0x00000008
337#define CERT_TRUST_IS_NOT_VALID_FOR_USAGE 0x00000010 /* 16 */
338#define CERT_TRUST_IS_UNTRUSTED_ROOT 0x00000020 /* 32 */
339#define CERT_TRUST_REVOCATION_STATUS_UNKNOWN 0x00000040 /* 64 */
340#define CERT_TRUST_IS_CYCLIC 0x00000080 /* 128 */
341#define CERT_TRUST_IS_PARTIAL_CHAIN 0x00010000 /* 65336 */
342#define CERT_TRUST_CTL_IS_NOT_TIME_VALID 0x00020000 /* 131072 */
343#define CERT_TRUST_CTL_IS_NOT_SIGNATURE_VALID 0x00040000 /* 262144 */
344#define CERT_TRUST_CTL_IS_NOT_VALID_FOR_USAGE 0x00080000 /* 524288 */
345
346#define CERT_TRUST_HAS_EXACT_MATCH_ISSUER 0x00000001
347#define CERT_TRUST_HAS_KEY_MATCH_ISSUER 0x00000002
348#define CERT_TRUST_HAS_NAME_MATCH_ISSUER 0x00000004
349#define CERT_TRUST_IS_SELF_SIGNED 0x00000008
350#define CERT_TRUST_IS_COMPLEX_CHAIN 0x00010000 /* 65336 */
351
352#define CERT_CHAIN_POLICY_BASE ((LPCSTR)(1))
353#define CERT_CHAIN_POLICY_AUTHENTICODE ((LPCSTR)(2))
354#define CERT_CHAIN_POLICY_AUTHENTICODE_TS ((LPCSTR)(3))
355#define CERT_CHAIN_POLICY_SSL ((LPCSTR)(4))
356#define CERT_CHAIN_POLICY_BASIC_CONSTRAINTS ((LPCSTR)(5))
357#define CERT_CHAIN_POLICY_NT_AUTH ((LPCSTR)(6))
358
359#define USAGE_MATCH_TYPE_AND 0
360#define USAGE_MATCH_TYPE_OR 1
361
362#define CERT_SIMPLE_NAME_STR 1
363#define CERT_OID_NAME_STR 2
364#define CERT_X500_NAME_STR 3
365
366#define CERT_NAME_STR_DISABLE_IE4_UTF8_FLAG 0x00010000
367#define CERT_NAME_STR_ENABLE_T61_UNICODE_FLAG 0x00020000 /* 131072 */
368#define CERT_NAME_STR_ENABLE_UTF8_UNICODE_FLAG 0x00040000
369#define CERT_NAME_STR_REVERSE_FLAG 0x02000000 /* 33554432 */
370#define CERT_NAME_STR_COMMA_FLAG 0x04000000
371#define CERT_NAME_STR_CRLF_FLAG 0x08000000 /* 134217728 */
372#define CERT_NAME_STR_NO_QUOTING_FLAG 0x10000000 /* 268435456 */
373#define CERT_NAME_STR_NO_PLUS_FLAG 0x20000000 /* 536870912 */
374#define CERT_NAME_STR_SEMICOLON_FLAG 0x40000000 /* 1073741824 */
375
376#define CERT_FIND_ANY 0
377#define CERT_FIND_CERT_ID 0x00100000 /* 1048576 */
378#define CERT_FIND_CTL_USAGE 0x000A0000 /* 653360 */
379#define CERT_FIND_ENHKEY_USAGE 0x000A0000 /* 653360 */
380#define CERT_FIND_EXISTING 0x000D0000 /* 851968 */
381#define CERT_FIND_HASH 0x00010000 /* 65336 */
382#define CERT_FIND_ISSUER_ATTR 0x00030004 /* 196612 */
383#define CERT_FIND_ISSUER_NAME 0x00020004 /* 131076 */
384#define CERT_FIND_ISSUER_OF 0x000C0000 /* 786432 */
385#define CERT_FIND_KEY_IDENTIFIER 0x000F0000 /* 983040 */
386#define CERT_FIND_KEY_SPEC 0x00090000 /* 589824 */
387#define CERT_FIND_MD5_HASH 0x00040000 /* 262144 */
388#define CERT_FIND_PROPERTY 0x00050000 /* 327680 */
389#define CERT_FIND_PUBLIC_KEY 0x00060000 /* 393216 */
390#define CERT_FIND_SHA1_HASH 0x00010000 /* 65536 */
391#define CERT_FIND_SIGNATURE_HASH 0x000E0000 /* 917504 */
392#define CERT_FIND_SUBJECT_ATTR 0x00030007 /* 196615 */
393#define CERT_FIND_SUBJECT_CERT 0x000B0000 /* 720896 */
394#define CERT_FIND_SUBJECT_NAME 0x00020007 /* 131079 */
395
396#define CERT_FIND_SUBJECT_STR __AW_EXTENDED__( CERT_FIND_SUBJECT_STR )
397#define CERT_FIND_SUBJECT_STR_A 0x00070007 /* 458759 */
398#define CERT_FIND_SUBJECT_STR_W 0x00080007 /* 524295 */
399
400#define CERT_FIND_ISSUER_STR __AW_EXTENDED__( CERT_FIND_ISSUER_STR )
401#define CERT_FIND_ISSUER_STR_A 0x00070004 /* 458756 */
402#define CERT_FIND_ISSUER_STR_W 0x00080004 /* 524292 */
403
404#define CERT_FIND_OR_ENHKEY_USAGE_FLAG 0x00000010 /* 16 */
405#define CERT_FIND_OPTIONAL_ENHKEY_USAGE_FLAG 0x00000001
406#define CERT_FIND_NO_ENHKEY_USAGE_FLAG 0x00000008
407#define CERT_FIND_VALID_ENHKEY_USAGE_FLAG 0x00000020 /* 32 */
408#define CERT_FIND_EXT_ONLY_ENHKEY_USAGE_FLAG 0x00000002
409
410#define \
411 CERT_CASE_INSENSITIVE_IS_RDN_ATTRS_FLAG 0x00000002
412#define CERT_UNICODE_IS_RDN_ATTRS_FLAG 0x00000001
413
414#define CERT_CHAIN_FIND_BY_ISSUER 0x00000001
415#define \
416 CERT_CHAIN_FIND_BY_ISSUER_COMPARE_KEY_FLAG 0x00000001
417#define \
418 CERT_CHAIN_FIND_BY_ISSUER_COMPLEX_CHAIN_FLAG 0x00000002
419#define \
420 CERT_CHAIN_FIND_BY_ISSUER_CACHE_ONLY_FLAG 0x00008000 /* 32768 */
421#define \
422 CERT_CHAIN_FIND_BY_ISSUER_CACHE_ONLY_URL_FLAG 0x00000004
423#define \
424 CERT_CHAIN_FIND_BY_ISSUER_LOCAL_MACHINE_FLAG 0x00000008
425#define CERT_CHAIN_FIND_BY_ISSUER_NO_KEY_FLAG 0x00004000 /* 16384 */
426
427#define CERT_STORE_PROV_SYSTEM 10
428#define CERT_SYSTEM_STORE_LOCAL_MACHINE 0x00020000 /* 131072 */
429
430#define szOID_PKIX_KP_SERVER_AUTH "4235600"
431#define szOID_SERVER_GATED_CRYPTO "4235658"
432#define szOID_SGC_NETSCAPE "2.16.840.1.113730.4.1"
433#define szOID_PKIX_KP_CLIENT_AUTH "1.3.6.1.5.5.7.3.2"
434
435/* dwFlag definitions for CryptGenKey
436 */
437#define CRYPT_EXPORTABLE 0x00000001
438#define CRYPT_USER_PROTECTED 0x00000002
439#define CRYPT_CREATE_SALT 0x00000004
440#define CRYPT_UPDATE_KEY 0x00000008
441#define CRYPT_NO_SALT 0x00000010
442#define CRYPT_PREGEN 0x00000040
443#define CRYPT_RECIPIENT 0x00000010
444#define CRYPT_INITIATOR 0x00000040
445#define CRYPT_ONLINE 0x00000080
446#define CRYPT_SF 0x00000100
447#define CRYPT_CREATE_IV 0x00000200
448#define CRYPT_KEK 0x00000400
449#define CRYPT_DATA_KEY 0x00000800
450#define CRYPT_VOLATILE 0x00001000
451#define CRYPT_SGCKEY 0x00002000
452#define CRYPT_ARCHIVABLE 0x00004000
453
454#define KP_IV 0x00000001
455#define KP_SALT 0x00000002
456#define KP_PADDING 0x00000003
457#define KP_MODE 0x00000004
458#define KP_MODE_BITS 0x00000005
459#define KP_PERMISSIONS 0x00000006
460#define KP_ALGID 0x00000007
461#define KP_BLOCKLEN 0x00000008
462#define KP_KEYLEN 0x00000009
463#define KP_SALT_EX 0x0000000A
464#define KP_P 0x0000000B
465#define KP_G 0x0000000C
466#define KP_Q 0x0000000D
467#define KP_X 0x0000000E
468#define KP_Y 0x0000000F
469#define KP_RA 0x00000010
470#define KP_RB 0x00000011
471#define KP_INFO 0x00000012
472#define KP_EFFECTIVE_KEYLEN 0x00000013
473#define KP_SCHANNEL_ALG 0x00000014
474#define KP_PUB_PARAMS 0x00000027
475
476#define CRYPT_FLAG_PCT1 0x00000001
477#define CRYPT_FLAG_SSL2 0x00000002
478#define CRYPT_FLAG_SSL3 0x00000004
479#define CRYPT_FLAG_TLS1 0x00000008
480#define CRYPT_FLAG_IPSEC 0x00000010
481#define CRYPT_FLAG_SIGNING 0x00000020
482
483#define SCHANNEL_MAC_KEY 0x00000000
484#define SCHANNEL_ENC_KEY 0x00000001
485
486#define INTERNATIONAL_USAGE 0x00000001
487
488#if WINVER >= _WIN32_WINNT_WINXP
489/* These are available only on Windows XP, Windows Server 2003, and later
490 */
491#define CMC_ADD_ATTRIBUTES ((LPCSTR)(63))
492#define CMC_ADD_EXTENSIONS ((LPCSTR)(62))
493#define X509_CERT_PAIR ((LPCSTR)(53))
494#define X509_CERTIFICATE_TEMPLATE ((LPCSTR)(64))
495#define X509_CROSS_CERT_DIST_POINTS ((LPCSTR)(58))
496#define CMC_DATA ((LPCSTR)(59))
497#define X509_NAME_CONSTRAINTS ((LPCSTR)(55))
498#define X509_POLICY_CONSTRAINTS ((LPCSTR)(57))
499#define X509_POLICY_MAPPINGS ((LPCSTR)(56))
500#define CMC_RESPONSE ((LPCSTR)(60))
501#define CMC_STATUS ((LPCSTR)(61))
502#endif /* WINVER >= _WIN32_WINNT_WINXP */
503
504#define X509_ALGORITHM_IDENTIFIER ((LPCSTR)(74))
505#define X509_ALTERNATE_NAME ((LPCSTR)(12))
506
507/* FIXME: need #define X509_ANY_STRING */
508#ifdef MINGW_TENTATIVE_ASSUMPTIONS
509/* https://msdn.microsoft.com/en-us/library/aa378145.aspx suggests
510 * that this may be an alias for...
511 */
512#define X509_ANY_STRING X509_NAME_VALUE
513#endif
514
515#define PKCS_ATTRIBUTE ((LPCSTR)(22))
516#define X509_AUTHORITY_INFO_ACCESS ((LPCSTR)(32))
517#define X509_AUTHORITY_KEY_ID ((LPCSTR) (9))
518#define X509_AUTHORITY_KEY_ID2 ((LPCSTR)(31))
519
520#define szOID_BASIC_CONSTRAINTS "2.5.29.10"
521#define X509_BASIC_CONSTRAINTS ((LPCSTR) (13))
522#define X509_BASIC_CONSTRAINTS2 ((LPCSTR) (15))
523#define X509_BIOMETRIC_EXT ((LPCSTR) (71))
524#define X509_BITS ((LPCSTR) (26))
525#define X509_CERT ((LPCSTR) (1))
526#define X509_CERT_CRL_TO_BE_SIGNED ((LPCSTR) (3))
527#define X509_CERT_POLICIES ((LPCSTR) (16))
528#define X509_CERT_REQUEST_TO_BE_SIGNED ((LPCSTR) (4))
529#define X509_CERT_TO_BE_SIGNED ((LPCSTR) (2))
530#define X509_CHOICE_OF_TIME ((LPCSTR) (30))
531#define PKCS_CONTENT_INFO ((LPCSTR) (33))
532#define PKCS_CONTENT_INFO_SEQUENCE_OF_ANY ((LPCSTR) (23))
533#define X509_CRL_DIST_POINTS ((LPCSTR) (35))
534
535/* FIXME: need #define X509_CRL_REASON_CODE */
536#ifdef MINGW_TENTATIVE_ASSUMPTIONS
537/* https://msdn.microsoft.com/en-us/library/aa378145.aspx suggests
538 * that this may be an alias for...
539 */
540#define X509_CRL_REASON_CODE X509_ENUMERATED
541#endif
542
543#define RSA_CSP_PUBLICKEYBLOB ((LPCSTR) (19))
544#define PKCS_CTL ((LPCSTR) (37))
545#define X509_DSS_PARAMETERS ((LPCSTR) (39))
546
547/* FIXME: need #define X509_DSS_PUBLICKEY */
548#ifdef MINGW_TENTATIVE_ASSUMPTIONS
549/* https://msdn.microsoft.com/en-us/library/aa378145.aspx suggests
550 * that this may be an alias for...
551 */
552#define X509_DSS_PUBLICKEY X509_MULTI_BYTE_UINT
553#endif
554
555#define X509_DSS_SIGNATURE ((LPCSTR) (40))
556#define X509_ECC_SIGNATURE ((LPCSTR) (47))
557#define X509_ENHANCED_KEY_USAGE ((LPCSTR) (36))
558#define X509_ENUMERATED ((LPCSTR) (29))
559#define X509_EXTENSIONS ((LPCSTR) (5))
560#define X509_INTEGER ((LPCSTR) (27))
561#define X509_ISSUING_DIST_POINT ((LPCSTR) (54))
562#define X509_KEY_ATTRIBUTES ((LPCSTR) (10))
563#define X509_KEY_USAGE ((LPCSTR) (14))
564#define X509_KEY_USAGE_RESTRICTION ((LPCSTR) (11))
565#define X509_KEYGEN_REQUEST_TO_BE_SIGNED ((LPCSTR) (21))
566#define X509_LOGOTYPE_EXT ((LPCSTR) (70))
567#define X509_MULTI_BYTE_INTEGER ((LPCSTR) (28))
568#define X509_MULTI_BYTE_UINT ((LPCSTR) (38))
569#define X509_NAME ((LPCSTR) (7))
570#define X509_NAME_VALUE ((LPCSTR) (6))
571#define X509_OBJECT_IDENTIFIER ((LPCSTR) (73))
572#define X509_OCTET_STRING ((LPCSTR) (25))
573#define X509_PUBLIC_KEY_INFO ((LPCSTR) (8))
574#define PKCS_RC2_CBC_PARAMETERS ((LPCSTR) (41))
575#define CNG_RSA_PUBLIC_KEY_BLOB ((LPCSTR) (72))
576#define PKCS_RSA_SSA_PSS_PARAMETERS ((LPCSTR) (75))
577#define PKCS_RSAES_OAEP_PARAMETERS ((LPCSTR) (76))
578#define ECC_CMS_SHARED_INFO ((LPCSTR) (77))
579#define X509_SEQUENCE_OF_ANY ((LPCSTR) (34))
580#define PKCS7_SIGNER_INFO ((LPCSTR)(500))
581#define CMS_SIGNER_INFO ((LPCSTR)(501))
582#define PKCS_SMIME_CAPABILITIES ((LPCSTR) (42))
583#define PKCS_TIME_REQUEST ((LPCSTR) (18))
584
585/* FIXME: need #define X509_UNICODE_ANY_STRING */
586#ifdef MINGW_TENTATIVE_ASSUMPTIONS
587/* https://msdn.microsoft.com/en-us/library/aa378145.aspx suggests
588 * that this may be an alias for...
589 */
590#define X509_UNICODE_ANY_STRING X509_UNICODE_NAME_VALUE
591#endif
592
593#define X509_UNICODE_NAME ((LPCSTR) (20))
594#define X509_UNICODE_NAME_VALUE ((LPCSTR) (24))
595#define PKCS_UTC_TIME ((LPCSTR) (17))
596#define OCSP_SIGNED_REQUEST ((LPCSTR) (65))
597#define OCSP_REQUEST ((LPCSTR) (66))
598#define OCSP_RESPONSE ((LPCSTR) (67))
599#define OCSP_BASIC_SIGNED_RESPONSE ((LPCSTR) (68))
600#define OCSP_BASIC_RESPONSE ((LPCSTR) (69))
601
602enum
603{ CRL_REASON_UNSPECIFIED=0,
604 CRL_REASON_KEY_COMPROMISE=1,
605 CRL_REASON_CA_COMPROMISE=2,
606 CRL_REASON_AFFILIATION_CHANGED=3,
607 CRL_REASON_SUPERSEDED=4,
608 CRL_REASON_CESSATION_OF_OPERATION=5,
609 CRL_REASON_CERTIFICATE_HOLD=6,
610 CRL_REASON_REMOVE_FROM_CRL=7
611};
612
613/* FIXME: need #define CRYPT_DECODE_NOCOPY_FLAG */
614
615#define CRYPT_ENCODE_ALLOC_FLAG 0x00008000
616#define CRYPT_UNICODE_NAME_ENCODE_DISABLE_CHECK_TYPE_FLAG 0x40000000
617#define CRYPT_UNICODE_NAME_ENCODE_ENABLE_T61_UNICODE_FLAG 0x80000000
618#define CRYPT_UNICODE_NAME_ENCODE_ENABLE_UTF8_UNICODE_FLAG 0x20000000
619#define CRYPT_UNICODE_NAME_ENCODE_FORCE_UTF8_UNICODE_FLAG 0x10000000
620
621/* Object ID codes from https://support.microsoft.com/en-gb/kb/287547
622 * and/or from https://msdn.microsoft.com/en-us/library/aa378145.aspx
623 */
624#define szOID_RSA "1.2.840.113549"
625#define szOID_PKCS "1.2.840.113549.1"
626#define szOID_RSA_HASH "1.2.840.113549.2"
627#define szOID_RSA_ENCRYPT "1.2.840.113549.3"
628#define szOID_PKCS_1 "1.2.840.113549.1.1"
629#define szOID_PKCS_2 "1.2.840.113549.1.2"
630#define szOID_PKCS_3 "1.2.840.113549.1.3"
631#define szOID_PKCS_4 "1.2.840.113549.1.4"
632#define szOID_PKCS_5 "1.2.840.113549.1.5"
633#define szOID_PKCS_6 "1.2.840.113549.1.6"
634#define szOID_PKCS_7 "1.2.840.113549.1.7"
635#define szOID_PKCS_8 "1.2.840.113549.1.8"
636#define szOID_PKCS_9 "1.2.840.113549.1.9"
637#define szOID_PKCS_10 "1.2.840.113549.1.10"
638#define szOID_PKCS_12 "1.2.840.113549.1.12"
639#define szOID_RSA_MD2 "1.2.840.113549.1.1.2"
640#define szOID_RSA_MD4 "1.2.840.113549.1.1.3"
641#define szOID_RSA_MD5 "1.2.840.113549.2.5"
642#define szOID_RSA_RSA "1.2.840.113549.1.1.1"
643#define szOID_RSA_MD2RSA "1.2.840.113549.1.1.2"
644#define szOID_RSA_MD4RSA "1.2.840.113549.1.1.3"
645#define szOID_RSA_MD5RSA "1.2.840.113549.1.1.4"
646#define szOID_RSA_SHA1RSA "1.2.840.113549.1.1.5"
647#define szOID_RSA_SETOAEP_RSA "1.2.840.113549.1.1.5"
648#define szOID_RSA_DH "1.2.840.113549.1.3.1"
649#define szOID_RSA_data "1.2.840.113549.1.7.1"
650#define szOID_RSA_signedData "1.2.840.113549.1.7.2"
651#define szOID_RSA_envelopedData "1.2.840.113549.1.7.3"
652#define szOID_RSA_signEnvData "1.2.840.113549.1.7.4"
653#define szOID_RSA_digestedData "1.2.840.113549.1.7.5"
654#define szOID_RSA_hashedData "1.2.840.113549.1.7.5"
655#define szOID_RSA_encryptedData "1.2.840.113549.1.7.6"
656#define szOID_RSA_emailAddr "1.2.840.113549.1.9.1"
657#define szOID_RSA_unstructName "1.2.840.113549.1.9.2"
658#define szOID_RSA_contentType "1.2.840.113549.1.9.3"
659#define szOID_RSA_messageDigest "1.2.840.113549.1.9.4"
660#define szOID_RSA_signingTime "1.2.840.113549.1.9.5"
661#define szOID_RSA_counterSign "1.2.840.113549.1.9.6"
662#define szOID_RSA_challengePwd "1.2.840.113549.1.9.7"
663#define szOID_RSA_unstructAddr "1.2.840.113549.1.9.8"
664#define szOID_RSA_extCertAttrs "1.2.840.113549.1.9.9"
665#define szOID_RSA_SMIMECapabilities "1.2.840.113549.1.9.15"
666#define szOID_RSA_preferSignedData "1.2.840.113549.1.9.15.1"
667#define szOID_RSA_RC2CBC "1.2.840.113549.3.2"
668#define szOID_RSA_RC4 "1.2.840.113549.3.4"
669#define szOID_RSA_DES_EDE3_CBC "1.2.840.113549.3.7"
670#define szOID_RSA_RC5_CBCPad "1.2.840.113549.3.9"
671#define szOID_ANSI_x942 "1.2.840.10046"
672#define szOID_ANSI_x942_DH "1.2.840.10046.2.1"
673#define szOID_X957 "1.2.840.10040"
674#define szOID_X957_DSA "1.2.840.10040.4.1"
675#define szOID_DATA STRUCTURE "1.2.840.10040.4.3"
676#define szOID_DS "2.5"
677#define szOID_DSALG "2.5.8"
678#define szOID_DSALG_CRPT "2.5.8.1"
679#define szOID_DSALG_HASH "2.5.8.2"
680#define szOID_DSALG_SIGN "2.5.8.3"
681#define szOID_DSALG_RSA "2.5.8.1.1"
682#define szOID_OIW "1.3.14"
683#define szOID_OIWSEC "1.3.14.3.2"
684#define szOID_OIWSEC_md4RSA "1.3.14.3.2.2"
685#define szOID_OIWSEC_md5RSA "1.3.14.3.2.3"
686#define szOID_OIWSEC_md4RSA2 "1.3.14.3.2.4"
687#define szOID_OIWSEC_desECB "1.3.14.3.2.6"
688#define szOID_OIWSEC_desCBC "1.3.14.3.2.7"
689#define szOID_OIWSEC_desOFB "1.3.14.3.2.8"
690#define szOID_OIWSEC_desCFB "1.3.14.3.2.9"
691#define szOID_OIWSEC_desMAC "1.3.14.3.2.10"
692#define szOID_OIWSEC_rsaSign "1.3.14.3.2.11"
693#define szOID_OIWSEC_dsa "1.3.14.3.2.12"
694#define szOID_OIWSEC_shaDSA "1.3.14.3.2.13"
695#define szOID_OIWSEC_mdc2RSA "1.3.14.3.2.14"
696#define szOID_OIWSEC_shaRSA "1.3.14.3.2.15"
697#define szOID_OIWSEC_dhCommMod "1.3.14.3.2.16"
698#define szOID_OIWSEC_desEDE "1.3.14.3.2.17"
699#define szOID_OIWSEC_sha "1.3.14.3.2.18"
700#define szOID_OIWSEC_mdc2 "1.3.14.3.2.19"
701#define szOID_OIWSEC_dsaComm "1.3.14.3.2.20"
702#define szOID_OIWSEC_dsaCommSHA "1.3.14.3.2.21"
703#define szOID_OIWSEC_rsaXchg "1.3.14.3.2.22"
704#define szOID_OIWSEC_keyHashSeal "1.3.14.3.2.23"
705#define szOID_OIWSEC_md2RSASign "1.3.14.3.2.24"
706#define szOID_OIWSEC_md5RSASign "1.3.14.3.2.25"
707#define szOID_OIWSEC_sha1 "1.3.14.3.2.26"
708#define szOID_OIWSEC_dsaSHA1 "1.3.14.3.2.27"
709#define szOID_OIWSEC_dsaCommSHA1 "1.3.14.3.2.28"
710#define szOID_OIWSEC_sha1RSASign "1.3.14.3.2.29"
711#define szOID_OIWDIR "1.3.14.7.2"
712#define szOID_OIWDIR_CRPT "1.3.14.7.2.1"
713#define szOID_OIWDIR_HASH "1.3.14.7.2.2"
714#define szOID_OIWDIR_SIGN "1.3.14.7.2.3"
715#define szOID_OIWDIR_md2 "1.3.14.7.2.2.1"
716#define szOID_OIWDIR_md2RSA "1.3.14.7.2.3.1"
717#define szOID_INFOSEC "2.16.840.1.101.2.1"
718#define szOID_INFOSEC_sdnsSignature "2.16.840.1.101.2.1.1.1"
719#define szOID_INFOSEC_mosaicSignature "2.16.840.1.101.2.1.1.2"
720#define szOID_INFOSEC_sdnsConfidentiality "2.16.840.1.101.2.1.1.3"
721#define szOID_INFOSEC_mosaicConfidentiality "2.16.840.1.101.2.1.1.4"
722#define szOID_INFOSEC_sdnsIntegrity "2.16.840.1.101.2.1.1.5"
723#define szOID_INFOSEC_mosaicIntegrity "2.16.840.1.101.2.1.1.6"
724#define szOID_INFOSEC_sdnsTokenProtection "2.16.840.1.101.2.1.1.7"
725#define szOID_INFOSEC_mosaicTokenProtection "2.16.840.1.101.2.1.1.8"
726#define szOID_INFOSEC_sdnsKeyManagement "2.16.840.1.101.2.1.1.9"
727#define szOID_INFOSEC_mosaicKeyManagement "2.16.840.1.101.2.1.1.10"
728#define szOID_INFOSEC_sdnsKMandSig "2.16.840.1.101.2.1.1.11"
729#define szOID_INFOSEC_mosaicKMandSig "2.16.840.1.101.2.1.1.12"
730#define szOID_INFOSEC_SuiteASignature "2.16.840.1.101.2.1.1.13"
731#define szOID_INFOSEC_SuiteAConfidentiality "2.16.840.1.101.2.1.1.14"
732#define szOID_INFOSEC_SuiteAIntegrity "2.16.840.1.101.2.1.1.15"
733#define szOID_INFOSEC_SuiteATokenProtection "2.16.840.1.101.2.1.1.16"
734#define szOID_INFOSEC_SuiteAKeyManagement "2.16.840.1.101.2.1.1.17"
735#define szOID_INFOSEC_SuiteAKMandSig "2.16.840.1.101.2.1.1.18"
736#define szOID_INFOSEC_mosaicUpdatedSig "2.16.840.1.101.2.1.1.19"
737#define szOID_INFOSEC_mosaicKMandUpdSig "2.16.840.1.101.2.1.1.20"
738#define szOID_INFOSEC_mosaicUpdatedInteg "2.16.840.1.101.2.1.1.21"
739#define szOID_PKIX_NO_SIGNATURE "1.3.6.1.5.5.7.6.2"
740
741#define szOID_COMMON_NAME "2.5.4.3"
742#define szOID_COUNTRY_NAME "2.5.4.6"
743#define szOID_DEVICE_SERIAL_NUMBER "2.5.4.5"
744#define szOID_DOMAIN_COMPONENT "0.9.2342.19200300.100.1.25"
745#define szOID_GIVEN_NAME "2.5.4.42"
746#define szOID_INITIALS "2.5.4.43"
747#define szOID_LOCALITY_NAME "2.5.4.7"
748#define szOID_ORGANIZATION_NAME "2.5.4.10"
749#define szOID_ORGANIZATIONAL_UNIT_NAME "2.5.4.11"
750#define szOID_STATE_OR_PROVINCE_NAME "2.5.4.8"
751#define szOID_STREET_ADDRESS "2.5.4.9"
752#define szOID_SUR_NAME "2.5.4.4"
753#define szOID_TITLE "2.5.4.12"
754#define szOID_BASIC_CONSTRAINTS2 "2.5.29.19"
755#define szOID_APPLICATION_CERT_POLICIES "1.3.6.1.4.1.311.21.10"
756#define szOID_APPLICATION_POLICY_CONSTRAINTS "1.3.6.1.4.1.311.21.12"
757#define szOID_APPLICATION_POLICY_MAPPINGS "1.3.6.1.4.1.311.21.11"
758#define szOID_AUTHORITY_INFO_ACCESS "1.3.6.1.5.5.7.1.1"
759#define szOID_AUTHORITY_KEY_IDENTIFIER "2.5.29.1"
760#define szOID_AUTHORITY_KEY_IDENTIFIER2 "2.5.29.35"
761
762#define szOID_BIOMETRIC_EXT "1.3.6.1.5.5.7.1.2"
763#define szOID_CERT_EXTENSIONS "1.3.6.1.4.1.311.2.1.14"
764#define szOID_CERT_POLICIES "2.5.29.32"
765
766#if WINVER >= _WIN32_WINNT_WINXP
767/* These are available only on Windows XP, Windows Server 2003, and later
768 */
769#define szOID_CERTIFICATE_TEMPLATE "1.3.6.1.4.1.311.21.7"
770#define szOID_CRL_NUMBER "2.5.29.20"
771#define szOID_CROSS_CERT_DIST_POINTS "1.3.6.1.4.1.311.10.9.1"
772#define szOID_DELTA_CRL_INDICATOR "2.5.29.27"
773#define szOID_ENROLLMENT_NAME_VALUE_PAIR "1.3.6.1.4.1.311.13.2.1"
774#define szOID_FRESHEST_CRL "2.5.29.46"
775#define szOID_ISSUING_DIST_POINT "2.5.29.28"
776#define szOID_NAME_CONSTRAINTS "2.5.29.30"
777#endif /* WINVER >= _WIN32_WINNT_WINXP */
778
779#define szOID_CRL_DIST_POINTS "2.5.29.31"
780#define szOID_CRL_REASON_CODE "2.5.29.21"
781#define szOID_CRL_VIRTUAL_BASE "1.3.6.1.4.1.311.21.3"
782#define szOID_ECC_PUBLIC_KEY "1.2.840.10045.2.1"
783#define szOID_ECDSA_SPECIFIED "1.2.840.10045.4.3"
784#define szOID_ENHANCED_KEY_USAGE "2.5.29.37"
785#define szOID_ISSUER_ALT_NAME "2.5.29.8"
786#define szOID_ISSUER_ALT_NAME2 "2.5.29.18"
787#define szOID_KEY_ATTRIBUTES "2.5.29.2"
788#define szOID_KEY_USAGE "2.5.29.4"
789#define szOID_KEY_USAGE_RESTRICTION "2.5.29.4"
790#define szOID_LOGOTYPE_EXT "1.3.6.1.5.5.7.1.12"
791#define szOID_NEXT_UPDATE_LOCATION "1.3.6.1.4.1.311.10.2"
792#define szOID_POLICY_CONSTRAINTS "2.5.29.36"
793#define szOID_POLICY_MAPPINGS "2.5.29.33"
794#define szOID_RSA_SSA_PSS "1.2.840.113549.1.1.10"
795#define szOID_RSAES_OAEP "1.2.840.113549.1.1.7"
796#define szOID_SUBJECT_ALT_NAME "2.5.29.7"
797#define szOID_SUBJECT_ALT_NAME2 "2.5.29.17"
798#define szOID_SUBJECT_KEY_IDENTIFIER "2.5.29.14"
799
800typedef struct _CERT_BASIC_CONSTRAINTS2_INFO
801{ BOOL fCA;
802 BOOL fPathLenConstraint;
803 DWORD dwPathLenConstraint;
804} CERT_BASIC_CONSTRAINTS2_INFO, *PCERT_BASIC_CONSTRAINTS2_INFO;
805
806typedef VOID (WINAPI *PFN_CRYPT_FREE)( LPVOID );
807typedef LPVOID (WINAPI *PFN_CRYPT_ALLOC)( size_t );
808
809typedef struct _CRYPT_ENCODE_PARA
810{ DWORD cbSize;
811 PFN_CRYPT_ALLOC pfnAlloc;
812 PFN_CRYPT_FREE pfnFree;
813} CRYPT_ENCODE_PARA, *PCRYPT_ENCODE_PARA;
814
815/* FIXME: definition missing. */
816typedef struct _CRYPT_DECODE_PARA *PCRYPT_DECODE_PARA;
817
818typedef UINT ALG_ID;
819typedef struct _VTableProvStruc
820{ FARPROC FuncVerifyImage;
821} VTableProvStruc, *PVTableProvStruc;
822
823typedef ULONG HCRYPTPROV;
824typedef ULONG HCRYPTKEY;
825typedef ULONG HCRYPTHASH;
826typedef PVOID HCERTSTORE;
827typedef PVOID HCRYPTMSG;
828typedef PVOID HCERTCHAINENGINE;
829
830typedef struct _CRYPTOAPI_BLOB
831{ DWORD cbData;
832 BYTE *pbData;
833};
834typedef struct _CRYPTOAPI_BLOB CRYPT_INTEGER_BLOB, *PCRYPT_INTEGER_BLOB;
835typedef struct _CRYPTOAPI_BLOB CRYPT_UINT_BLOB, *PCRYPT_UINT_BLOB;
836typedef struct _CRYPTOAPI_BLOB CRYPT_OBJID_BLOB, *PCRYPT_OBJID_BLOB;
837typedef struct _CRYPTOAPI_BLOB CERT_NAME_BLOB, *PCERT_NAME_BLOB;
838typedef struct _CRYPTOAPI_BLOB CERT_RDN_VALUE_BLOB, *PCERT_RDN_VALUE_BLOB;
839typedef struct _CRYPTOAPI_BLOB CERT_BLOB, *PCERT_BLOB;
840typedef struct _CRYPTOAPI_BLOB CRL_BLOB, *PCRL_BLOB;
841typedef struct _CRYPTOAPI_BLOB DATA_BLOB, *PDATA_BLOB;
842typedef struct _CRYPTOAPI_BLOB CRYPT_DATA_BLOB, *PCRYPT_DATA_BLOB;
843typedef struct _CRYPTOAPI_BLOB CRYPT_HASH_BLOB, *PCRYPT_HASH_BLOB;
844typedef struct _CRYPTOAPI_BLOB CRYPT_DIGEST_BLOB, *PCRYPT_DIGEST_BLOB;
845typedef struct _CRYPTOAPI_BLOB CRYPT_DER_BLOB, *PCRYPT_DER_BLOB;
846typedef struct _CRYPTOAPI_BLOB CRYPT_ATTR_BLOB, *PCRYPT_ATTR_BLOB;
847
848typedef struct _SSL_EXTRA_CERT_CHAIN_POLICY_PARA
849{ /* not described in SDK; has the same layout as HTTPSPolicyCallbackData
850 */
851 DWORD cbStruct;
852 DWORD dwAuthType;
853 DWORD fdwChecks;
854 LPWSTR pwszServerName;
855};
856typedef struct _SSL_EXTRA_CERT_CHAIN_POLICY_PARA SSL_EXTRA_CERT_CHAIN_POLICY_PARA;
857typedef struct _SSL_EXTRA_CERT_CHAIN_POLICY_PARA *PSSL_EXTRA_CERT_CHAIN_POLICY_PARA;
858typedef struct _SSL_EXTRA_CERT_CHAIN_POLICY_PARA HTTPSPolicyCallbackData;
859typedef struct _SSL_EXTRA_CERT_CHAIN_POLICY_PARA *PHTTPSPolicyCallbackData;
860
861/* #if _WIN32_WINNT >= _WIN32_WINNT_WIN2K */
862typedef struct _CERT_CHAIN_POLICY_PARA
863{ DWORD cbSize;
864 DWORD dwFlags;
865 void *pvExtraPolicyPara;
866} CERT_CHAIN_POLICY_PARA, *PCERT_CHAIN_POLICY_PARA;
867
868typedef struct _CERT_CHAIN_POLICY_STATUS
869{ DWORD cbSize;
870 DWORD dwError;
871 LONG lChainIndex;
872 LONG lElementIndex;
873 void *pvExtraPolicyStatus;
874} CERT_CHAIN_POLICY_STATUS, *PCERT_CHAIN_POLICY_STATUS;
875/* #endif _WIN32_WINNT >= _WIN32_WINNT_WIN2K */
876
877typedef struct _CRYPT_ALGORITHM_IDENTIFIER
878{ LPSTR pszObjId;
879 CRYPT_OBJID_BLOB Parameters;
880} CRYPT_ALGORITHM_IDENTIFIER, *PCRYPT_ALGORITHM_IDENTIFIER;
881
882typedef struct _CRYPT_BIT_BLOB
883{ DWORD cbData;
884 BYTE *pbData;
885 DWORD cUnusedBits;
886} CRYPT_BIT_BLOB, *PCRYPT_BIT_BLOB;
887
888typedef struct _CERT_PUBLIC_KEY_INFO
889{ CRYPT_ALGORITHM_IDENTIFIER Algorithm;
890 CRYPT_BIT_BLOB PublicKey;
891} CERT_PUBLIC_KEY_INFO, *PCERT_PUBLIC_KEY_INFO;
892
893typedef struct _CERT_EXTENSION
894{ LPSTR pszObjId;
895 BOOL fCritical;
896 CRYPT_OBJID_BLOB Value;
897} CERT_EXTENSION, *PCERT_EXTENSION;
898
899typedef struct _CERT_INFO
900{ DWORD dwVersion;
901 CRYPT_INTEGER_BLOB SerialNumber;
902 CRYPT_ALGORITHM_IDENTIFIER SignatureAlgorithm;
903 CERT_NAME_BLOB Issuer;
904 FILETIME NotBefore;
905 FILETIME NotAfter;
906 CERT_NAME_BLOB Subject;
907 CERT_PUBLIC_KEY_INFO SubjectPublicKeyInfo;
908 CRYPT_BIT_BLOB IssuerUniqueId;
909 CRYPT_BIT_BLOB SubjectUniqueId;
910 DWORD cExtension;
911 PCERT_EXTENSION rgExtension;
912} CERT_INFO, *PCERT_INFO;
913
914typedef struct _CERT_CONTEXT
915{ DWORD dwCertEncodingType;
916 BYTE *pbCertEncoded;
917 DWORD cbCertEncoded;
918 PCERT_INFO pCertInfo;
919 HCERTSTORE hCertStore;
920} CERT_CONTEXT, *PCERT_CONTEXT;
921
922typedef const CERT_CONTEXT *PCCERT_CONTEXT;
923
924typedef struct _CTL_USAGE
925{ DWORD cUsageIdentifier;
926 LPSTR *rgpszUsageIdentifier;
927} CTL_USAGE, *PCTRL_USAGE, CERT_ENHKEY_USAGE, *PCERT_ENHKEY_USAGE;
928
929typedef struct _CERT_USAGE_MATCH
930{ DWORD dwType;
931 CERT_ENHKEY_USAGE Usage;
932} CERT_USAGE_MATCH, *PCERT_USAGE_MATCH;
933
934/* #if _WIN32_WINNT >= _WIN32_WINNT_WIN2K */
935typedef struct _CERT_CHAIN_PARA
936{ DWORD cbSize;
937 CERT_USAGE_MATCH RequestedUsage;
938
939# if CERT_CHAIN_PARA_HAS_EXTRA_FIELDS
940
941 CERT_USAGE_MATCH RequestedIssuancePolicy;
942 DWORD dwUrlRetrievalTimeout;
943 BOOL fCheckRevocationFreshnessTime;
944 DWORD dwRevocationFreshnessTime;
945# endif
946
947} CERT_CHAIN_PARA, *PCERT_CHAIN_PARA;
948
949typedef BOOL (WINAPI *PFN_CERT_CHAIN_FIND_BY_ISSUER_CALLBACK)( PCCERT_CONTEXT, void * );
950
951typedef struct _CERT_CHAIN_FIND_BY_ISSUER_PARA
952{ DWORD cbSize;
953 LPCSTR pszUsageIdentifier;
954 DWORD dwKeySpec;
955 DWORD dwAcquirePrivateKeyFlags;
956 DWORD cIssuer;
957 CERT_NAME_BLOB *rgIssuer;
958 PFN_CERT_CHAIN_FIND_BY_ISSUER_CALLBACK pfnFIndCallback;
959 void *pvFindArg;
960 DWORD *pdwIssuerChainIndex;
961 DWORD *pdwIssuerElementIndex;
962} CERT_CHAIN_FIND_BY_ISSUER_PARA, *PCERT_CHAIN_FIND_BY_ISSUER_PARA;
963/* #endif _WIN32_WINNT >= _WIN32_WINNT_WIN2K */
964
965typedef struct _CERT_TRUST_STATUS
966{ DWORD dwErrorStatus;
967 DWORD dwInfoStatus;
968} CERT_TRUST_STATUS, *PCERT_TRUST_STATUS;
969
970typedef struct _CRL_ENTRY
971{ CRYPT_INTEGER_BLOB SerialNumber;
972 FILETIME RevocationDate;
973 DWORD cExtension;
974 PCERT_EXTENSION rgExtension;
975} CRL_ENTRY, *PCRL_ENTRY;
976
977typedef struct _CRL_INFO
978{ DWORD dwVersion;
979 CRYPT_ALGORITHM_IDENTIFIER SignatureAlgorithm;
980 CERT_NAME_BLOB Issuer;
981 FILETIME ThisUpdate;
982 FILETIME NextUpdate;
983 DWORD cCRLEntry;
984 PCRL_ENTRY rgCRLEntry;
985 DWORD cExtension;
986 PCERT_EXTENSION rgExtension;
987} CRL_INFO, *PCRL_INFO;
988
989typedef struct _CRL_CONTEXT
990{ DWORD dwCertEncodingType;
991 BYTE *pbCrlEncoded;
992 DWORD cbCrlEncoded;
993 PCRL_INFO pCrlInfo;
994 HCERTSTORE hCertStore;
995} CRL_CONTEXT, *PCRL_CONTEXT;
996
997typedef const CRL_CONTEXT *PCCRL_CONTEXT;
998typedef struct _CERT_REVOCATION_CRL_INFO
999{ DWORD cbSize;
1000 PCCRL_CONTEXT pBaseCRLContext;
1001 PCCRL_CONTEXT pDeltaCRLContext;
1002 PCRL_ENTRY pCrlEntry;
1003 BOOL fDeltaCrlEntry;
1004} CERT_REVOCATION_CRL_INFO, *PCERT_REVOCATION_CRL_INFO;
1005
1006typedef struct _CERT_REVOCATION_INFO
1007{ DWORD cbSize;
1008 DWORD dwRevocationResult;
1009 LPCSTR pszRevocationOid;
1010 LPVOID pvOidSpecificInfo;
1011 BOOL fHasFreshnessTime;
1012 DWORD dwFreshnessTime;
1013 PCERT_REVOCATION_CRL_INFO pCrlInfo;
1014} CERT_REVOCATION_INFO, *PCERT_REVOCATION_INFO;
1015
1016/* #if _WIN32_WINNT >= _WIN32_WINNT_WIN2K */
1017typedef struct _CERT_CHAIN_ELEMENT
1018{ DWORD cbSize;
1019 PCCERT_CONTEXT pCertContext;
1020 CERT_TRUST_STATUS TrustStatus;
1021 PCERT_REVOCATION_INFO pRevocationInfo;
1022 PCERT_ENHKEY_USAGE pIssuanceUsage;
1023 PCERT_ENHKEY_USAGE pApplicationUsage;
1024} CERT_CHAIN_ELEMENT, *PCERT_CHAIN_ELEMENT;
1025/* #endif _WIN32_WINNT >= _WIN32_WINNT_WIN2K */
1026
1027typedef struct _CRYPT_ATTRIBUTE
1028{ LPSTR pszObjId;
1029 DWORD cValue;
1030 PCRYPT_ATTR_BLOB rgValue;
1031} CRYPT_ATTRIBUTE, *PCRYPT_ATTRIBUTE;
1032
1033typedef struct _CRYPT_ATTRIBUTE_TYPE_VALUE
1034{ LPSTR pszObjId;
1035 CRYPT_OBJID_BLOB rgValue;
1036} CRYPT_ATTRIBUTE_TYPE_VALUE, *PCRYPT_ATTRIBUTE_TYPE_VALUE;
1037
1038typedef struct _CTL_ENTRY
1039{ CRYPT_DATA_BLOB SubjectIdentifier;
1040 DWORD cAttribute;
1041 PCRYPT_ATTRIBUTE rgAttribute;
1042} CTL_ENTRY, *PCTL_ENTRY;
1043
1044typedef struct _CTL_INFO
1045{ DWORD dwVersion;
1046 CTL_USAGE SubjectUsage;
1047 CRYPT_DATA_BLOB ListIdentifier;
1048 CRYPT_INTEGER_BLOB SequenceNumber;
1049 FILETIME ThisUpdate;
1050 FILETIME NextUpdate;
1051 CRYPT_ALGORITHM_IDENTIFIER SubjectAlgorithm;
1052 DWORD cCTLEntry;
1053 PCTL_ENTRY rgCTLEntry;
1054 DWORD cExtension;
1055 PCERT_EXTENSION rgExtension;
1056} CTL_INFO, *PCTL_INFO;
1057
1058typedef struct _CTL_CONTEXT
1059{ DWORD dwMsgAndCertEncodingType;
1060 BYTE *pbCtlEncoded;
1061 DWORD cbCtlEncoded;
1062 PCTL_INFO pCtlInfo;
1063 HCERTSTORE hCertStore;
1064 HCRYPTMSG hCryptMsg;
1065 BYTE *pbCtlContent;
1066 DWORD cbCtlContent;
1067} CTL_CONTEXT, *PCTL_CONTEXT;
1068
1069typedef const CTL_CONTEXT *PCCTL_CONTEXT;
1070typedef struct _CERT_TRUST_LIST_INFO
1071{ DWORD cbSize;
1072 PCTL_ENTRY pCtlEntry;
1073 PCCTL_CONTEXT pCtlContext;
1074} CERT_TRUST_LIST_INFO, *PCERT_TRUST_LIST_INFO;
1075
1076typedef struct _CERT_SIMPLE_CHAIN
1077{ DWORD cbSize;
1078 CERT_TRUST_STATUS TrustStatus;
1079 DWORD cElement;
1080 PCERT_CHAIN_ELEMENT *rgpElement;
1081 PCERT_TRUST_LIST_INFO pTrustListInfo;
1082 BOOL fHasRevocationFreshnessTime;
1083 DWORD dwRevocationFreshnessTime;
1084} CERT_SIMPLE_CHAIN, *PCERT_SIMPLE_CHAIN;
1085
1086/* #if _WIN32_WINNT >= _WIN32_WINNT_WIN2K */
1087typedef const struct _CERT_CHAIN_CONTEXT* PCCERT_CHAIN_CONTEXT;
1088typedef struct _CERT_CHAIN_CONTEXT
1089{ DWORD cbSize;
1090 CERT_TRUST_STATUS TrustStatus;
1091 DWORD cChain;
1092 PCERT_SIMPLE_CHAIN *rgpChain;
1093 DWORD cLowerQualityChainContext;
1094 PCCERT_CHAIN_CONTEXT *rgpLowerQualityChainContext;
1095 BOOL fHasRevocationFreshnessTime;
1096 DWORD dwRevocationFreshnessTime;
1097} CERT_CHAIN_CONTEXT, *PCERT_CHAIN_CONTEXT;
1098/* #endif _WIN32_WINNT >= _WIN32_WINNT_WIN2K */
1099
1100typedef struct _PROV_ENUMALGS
1101{ ALG_ID aiAlgid;
1102 DWORD dwBitLen;
1103 DWORD dwNameLen;
1104 CHAR szName[20];
1105} PROV_ENUMALGS;
1106
1107typedef struct _PUBLICKEYSTRUC
1108{ BYTE bType;
1109 BYTE bVersion;
1110 WORD reserved;
1111 ALG_ID aiKeyAlg;
1112} BLOBHEADER, PUBLICKEYSTRUC;
1113
1114typedef struct _RSAPUBKEY
1115{ DWORD magic;
1116 DWORD bitlen;
1117 DWORD pubexp;
1118} RSAPUBKEY;
1119
1120typedef struct _HMAC_Info
1121{ ALG_ID HashAlgid;
1122 BYTE *pbInnerString;
1123 DWORD cbInnerString;
1124 BYTE *pbOuterString;
1125 DWORD cbOuterString;
1126} HMAC_INFO, *PHMAC_INFO;
1127
1128#if WINVER >= _WIN32_WINNT_WINXP
1129/* Available only on Windows-XP, Windows Server 2003, and later.
1130 */
1131typedef struct _CMC_ADD_ATTRIBUTES_INFO
1132{ DWORD dwCmcDataReference;
1133 DWORD cCertReference;
1134 DWORD *rgdwCertReference;
1135 DWORD cAttribute;
1136 PCRYPT_ATTRIBUTE rgAttribute;
1137} CMC_ADD_ATTRIBUTES_INFO, *PCMC_ADD_ATTRIBUTES_INFO;
1138
1139typedef struct _CMC_ADD_EXTENSIONS_INFO
1140{ DWORD dwCmcDataReference;
1141 DWORD cCertReference;
1142 DWORD *rgdwCertReference;
1143 DWORD cExtension;
1144 PCERT_EXTENSION rgExtension;
1145} CMC_ADD_EXTENSIONS_INFO, *PCMC_ADD_EXTENSIONS_INFO;
1146
1147#endif /* WINVER >= _WIN32_WINNT_WINXP */
1148
1149#if WINVER >= _WIN32_WINDOWS_98
1150#ifdef MINGW_TENTATIVE_ASSUMPTIONS
1151/* FIXME: CERT_ALT_NAME_ENTRY needs definitions for PCERT_OTHER_NAME and
1152 * (allegedly) CERT_DATA_BLOB (for the the x400Address field, which according to
1153 * https://msdn.microsoft.com/en-us/library/windows/desktop/aa377173%28v=vs.85%29.aspx
1154 * is NOT a member of this structure; similarly, neither is pEdiPartyName)
1155 *
1156 * The CERT_OTHER_NAME structure, (to which a PCERT_OTHER_NAME would point), is
1157 * not documented on MSDN, (or on any other Microsoft reference site). There is,
1158 * however, a tenuous suggestion within the CERT_ALT_NAME_ENTRY documentation, (at
1159 * the aforementioned URL), that it comprises an object identifier (OID), and a
1160 * BLOB specifying the name, (closely resembling a CRYPT_ATTRIBUTE_TYPE_VALUE);
1161 * that this tenuous resemblance may suffice as an actual representation of a
1162 * CERT_OTHER_NAME structure is further hinted at, in the form of a SEE ALSO
1163 * reference to CRYPT_ATTRIBUTE_TYPE_VALUE, which appears to have no other
1164 * relevance in the CERT_ALT_NAME_ENTRY context; hence, we may infer...
1165 */
1166typedef struct _CRYPT_ATTRIBUTE_TYPE_VALUE CERT_OTHER_NAME;
1167typedef struct _CRYPT_ATTRIBUTE_TYPE_VALUE *PCERT_OTHER_NAME;
1168
1169typedef struct _CERT_ALT_NAME_ENTRY
1170{ DWORD dwAltNameChoice;
1171 union
1172 { PCERT_OTHER_NAME pOtherName;
1173 LPWSTR pwszRfc822Name;
1174 LPWSTR pwszDNSName;
1175 /* CERT_DATA_BLOB x400Address; */ /* never implemented? */
1176 CERT_NAME_BLOB DirectoryName;
1177 /* LPWSTR pEdiPartyName; */ /* never implemented? */
1178 LPWSTR pwszURL;
1179 CRYPT_DATA_BLOB IPAddress;
1180 LPSTR pszRegisteredID;
1181 };
1182} CERT_ALT_NAME_ENTRY, *PCERT_ALT_NAME_ENTRY;
1183
1184typedef struct _CERT_ALT_NAME_INFO
1185/* FIXME: this needs CERT_ALT_NAME_ENTRY above, which lacks prereqs */
1186{ DWORD cAltEntry;
1187 PCERT_ALT_NAME_ENTRY rgAltEntry;
1188} CERT_ALT_NAME_INFO, *PCERT_ALT_NAME_INFO;
1189
1190#endif /* MINGW_TENTATIVE_ASSUMPTIONS */
1191
1192typedef struct _CERT_NAME_VALUE
1193{ DWORD dwValueType;
1194 CERT_RDN_VALUE_BLOB Value;
1195} CERT_NAME_VALUE, *PCERT_NAME_VALUE;
1196
1197typedef struct _CERT_POLICY_QUALIFIER_INFO
1198{ LPSTR pszPolicyQualifierId;
1199 CRYPT_OBJID_BLOB Qualifier;
1200} CERT_POLICY_QUALIFIER_INFO, *PCERT_POLICY_QUALIFIER_INFO;
1201
1202typedef struct _CERT_POLICY_CONSTRAINTS_INFO
1203{ BOOL fRequireExplicitPolicy;
1204 DWORD dwRequireExplicitPolicySkipCerts;
1205 BOOL fInhibitPolicyMapping;
1206 DWORD dwInhibitPolicyMappingSkipCerts;
1207} CERT_POLICY_CONSTRAINTS_INFO, *PCERT_POLICY_CONSTRAINTS_INFO;
1208
1209#endif /* WINVER >= _WIN32_WINDOWS_98 */
1210
1211#if WINVER >= _WIN32_WINNT_WINXP
1212/* Available only on Windows-XP, Windows Server 2003, and later.
1213 */
1214typedef struct _CERT_POLICY_MAPPING
1215{ LPSTR pszIssuerDomainPolicy;
1216 LPSTR pszSubjectDomainPolicy;
1217} CERT_POLICY_MAPPING, *PCERT_POLICY_MAPPING;
1218
1219typedef struct _CERT_POLICY_MAPPINGS_INFO
1220{ DWORD cPolicyMapping;
1221 PCERT_POLICY_MAPPING rgPolicyMapping;
1222} CERT_POLICY_MAPPINGS_INFO, *PCERT_POLICY_MAPPINGS_INFO;
1223
1224#endif /* WINVER >= _WIN32_WINNT_WINXP */
1225
1226/* Some Crypto Key Provider Information structures.
1227 */
1228typedef struct _CRYPT_KEY_PROV_PARAM
1229{ /* From http://msdn.microsoft.com/en-us/library/aa922935.aspx
1230 */
1231 DWORD dwParam;
1232 BYTE *pbData;
1233 DWORD cbData;
1234 DWORD dwFlags;
1235} CRYPT_KEY_PROV_PARAM, *PCRYPT_KEY_PROV_PARAM;
1236
1237typedef struct _CRYPT_KEY_PROV_INFO
1238{ /* From http://msdn.microsoft.com/en-us/library/aa381420(VS.85).aspx
1239 */
1240 LPWSTR pwszContainerName;
1241 LPWSTR pwszProvName;
1242 DWORD dwProvType;
1243 DWORD dwFlags;
1244 DWORD cProvParam;
1245 PCRYPT_KEY_PROV_PARAM rgProvParam;
1246 DWORD dwKeySpec;
1247} CRYPT_KEY_PROV_INFO, *PCRYPT_KEY_PROV_INFO;
1248
1249#define CERT_SET_KEY_PROV_HANDLE_PROP_ID 0x00000001
1250#define CERT_SET_KEY_CONTEXT_PROP_ID 0x00000001
1251
1252#define CRYPT_KEYID_DELETE_FLAG 0x00000010
1253#define CRYPT_KEYID_SET_NEW_FLAG 0x00002000
1254
1255/* Certificate crl ctl IDs.
1256 */
1257#define CERT_KEY_PROV_HANDLE_PROP_ID 1
1258#define CERT_KEY_PROV_INFO_PROP_ID 2
1259#define CERT_SHA1_HASH_PROP_ID 3
1260#define CERT_MD5_HASH_PROP_ID 4
1261#define CERT_HASH_PROP_ID CERT_SHA1_HASH_PROP_ID
1262#define CERT_KEY_CONTEXT_PROP_ID 5
1263#define CERT_KEY_SPEC_PROP_ID 6
1264#define CERT_IE30_RESERVED_PROP_ID 7
1265#define CERT_PUBKEY_HASH_RESERVED_PROP_ID 8
1266#define CERT_ENHKEY_USAGE_PROP_ID 9
1267#define CERT_CTL_USAGE_PROP_ID CERT_ENHKEY_USAGE_PROP_ID
1268#define CERT_NEXT_UPDATE_LOCATION_PROP_ID 10
1269#define CERT_FRIENDLY_NAME_PROP_ID 11
1270#define CERT_PVK_FILE_PROP_ID 12
1271#define CERT_DESCRIPTION_PROP_ID 13
1272#define CERT_ACCESS_STATE_PROP_ID 14
1273#define CERT_SIGNATURE_HASH_PROP_ID 15
1274#define CERT_SMART_CARD_DATA_PROP_ID 16
1275#define CERT_EFS_PROP_ID 17
1276#define CERT_FORTEZZA_DATA_PROP_ID 18
1277#define CERT_ARCHIVED_PROP_ID 19
1278#define CERT_KEY_IDENTIFIER_PROP_ID 20
1279#define CERT_AUTO_ENROLL_PROP_ID 21
1280#define CERT_PUBKEY_ALG_PARA_PROP_ID 22
1281#define CERT_CROSS_CERT_DIST_POINTS_PROP_ID 23
1282#define CERT_ISSUER_PUBLIC_KEY_MD5_HASH_PROP_ID 24
1283#define CERT_SUBJECT_PUBLIC_KEY_MD5_HASH_PROP_ID 25
1284#define CERT_ENROLLMENT_PROP_ID 26
1285#define CERT_DATE_STAMP_PROP_ID 27
1286#define CERT_ISSUER_SERIAL_NUMBER_MD5_HASH_PROP_ID 28
1287#define CERT_SUBJECT_NAME_MD5_HASH_PROP_ID 29
1288#define CERT_EXTENDED_ERROR_INFO_PROP_ID 30
1289
1290/* Certificate name type.
1291 */
1292#define CERT_NAME_EMAIL_TYPE 1
1293#define CERT_NAME_RDN_TYPE 2
1294#define CERT_NAME_ATTR_TYPE 3
1295#define CERT_NAME_SIMPLE_DISPLAY_TYPE 4
1296#define CERT_NAME_FRIENDLY_DISPLAY_TYPE 5
1297#define CERT_NAME_DNS_TYPE 6
1298#define CERT_NAME_URL_TYPE 7
1299#define CERT_NAME_UPN_TYPE 8
1300
1301/* Certificate/CRL, encoded, context or element disposition values.
1302 */
1303#define CERT_STORE_ADD_NEW 1
1304#define CERT_STORE_ADD_USE_EXISTING 2
1305#define CERT_STORE_ADD_REPLACE_EXISTING 3
1306#define CERT_STORE_ADD_ALWAYS 4
1307
1308#define CERT_STORE_ADD_REPLACE_EXISTING_INHERIT_PROPERTIES 5
1309
1310#define CERT_STORE_ADD_NEWER 6
1311#define CERT_STORE_ADD_NEWER_INHERIT_PROPERTIES 7
1312
1313#define CRYPT_ACQUIRE_CACHE_FLAG 0x00000001
1314#define CRYPT_ACQUIRE_USE_PROV_INFO_FLAG 0x00000002
1315#define CRYPT_ACQUIRE_COMPARE_KEY_FLAG 0x00000004
1316#define CRYPT_ACQUIRE_SILENT_FLAG 0x00000040
1317
1318#define RSA1024BIT_KEY 0x04000000
1319
1320/* dwFlags definitions for CryptDeriveKey
1321 */
1322#define CRYPT_SERVER 0x00000400
1323
1324#define KEY_LENGTH_MASK 0xFFFF0000
1325
1326/* dwFlag definitions for CryptExportKey
1327 */
1328#define CRYPT_Y_ONLY 0x00000001
1329#define CRYPT_SSL2_FALLBACK 0x00000002
1330#define CRYPT_DESTROYKEY 0x00000004
1331
1332/* Used with RSA encryptions/decryptions, CryptExportKey, CryptImportKey,
1333 * CryptEncrypt, and CryptDecrypt
1334 */
1335#define CRYPT_OAEP 0x00000040
1336
1337#define CRYPT_BLOB_VER3 0x00000080 /* export version 3 of a blob type */
1338#define CRYPT_IPSEC_HMAC_KEY 0x00000100 /* CryptImportKey only */
1339
1340/* dwFlags definitions for CryptDecrypt; see also CRYPT_OAEP, above.
1341 * Note, the following flag is not supported for CryptEncrypt
1342 */
1343#define CRYPT_DECRYPT_RSA_NO_PADDING_CHECK 0x00000020
1344
1345/* dwFlags definitions for CryptCreateHash
1346 */
1347#define CRYPT_SECRETDIGEST 0x00000001
1348
1349/* dwFlags definitions for CryptHashData
1350 */
1351#define CRYPT_OWF_REPL_LM_HASH 0x00000001 /* this is only for the OWF replacement CSP */
1352
1353/* dwFlags definitions for CryptHashSessionKey
1354 */
1355#define CRYPT_LITTLE_ENDIAN 0x00000001
1356
1357/* dwFlags definitions for CryptSignHash and CryptVerifySignature
1358 */
1359#define CRYPT_NOHASHOID 0x00000001
1360#define CRYPT_TYPE2_FORMAT 0x00000002
1361#define CRYPT_X931_FORMAT 0x00000004
1362
1363/* dwFlag definitions for CryptSetProviderEx and CryptGetDefaultProvider
1364 */
1365#define CRYPT_MACHINE_DEFAULT 0x00000001
1366#define CRYPT_USER_DEFAULT 0x00000002
1367#define CRYPT_DELETE_DEFAULT 0x00000004
1368
1369/* algorithm.
1370 */
1371#define CALG_SSL3_SHAMD5 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SSL3SHAMD5)
1372
1373/* End of crypto key provider information structures.
1374 */
1375
1376BOOL WINAPI CertCloseStore( HCERTSTORE, DWORD );
1377BOOL WINAPI CertGetCertificateChain( HCERTCHAINENGINE, PCCERT_CONTEXT, LPFILETIME, HCERTSTORE, PCERT_CHAIN_PARA, DWORD, LPVOID, PCCERT_CHAIN_CONTEXT * );
1378BOOL WINAPI CertVerifyCertificateChainPolicy( LPCSTR, PCCERT_CHAIN_CONTEXT, PCERT_CHAIN_POLICY_PARA, PCERT_CHAIN_POLICY_STATUS );
1379void WINAPI CertFreeCertificateChain( PCCERT_CHAIN_CONTEXT );
1380
1381#define CertNameToStr __AW_SUFFIXED__( CertNameToStr )
1382DWORD WINAPI CertNameToStrA( DWORD, PCERT_NAME_BLOB, DWORD, LPSTR, DWORD );
1383DWORD WINAPI CertNameToStrW( DWORD, PCERT_NAME_BLOB, DWORD, LPWSTR, DWORD );
1384
1385#define CertOpenSystemStore __AW_SUFFIXED__( CertOpenSystemStore )
1386HCERTSTORE WINAPI CertOpenSystemStoreA( HCRYPTPROV, LPCSTR );
1387HCERTSTORE WINAPI CertOpenSystemStoreW( HCRYPTPROV, LPCWSTR );
1388
1389HCERTSTORE WINAPI CertOpenStore( LPCSTR, DWORD, HCRYPTPROV, DWORD, const void * );
1390PCCERT_CONTEXT WINAPI CertFindCertificateInStore( HCERTSTORE, DWORD, DWORD, DWORD, const void *, PCCERT_CONTEXT );
1391BOOL WINAPI CertFreeCertificateContext( PCCERT_CONTEXT );
1392PCCERT_CONTEXT WINAPI CertGetIssuerCertificateFromStore( HCERTSTORE, PCCERT_CONTEXT, PCCERT_CONTEXT, DWORD * );
1393PCCERT_CHAIN_CONTEXT WINAPI CertFindChainInStore( HCERTSTORE, DWORD, DWORD, DWORD, const void *, PCCERT_CHAIN_CONTEXT );
1394
1395HCERTSTORE WINAPI CertDuplicateStore( HCERTSTORE );
1396PCCERT_CONTEXT WINAPI CertEnumCertificatesInStore( HCERTSTORE, PCCERT_CONTEXT );
1397PCCERT_CONTEXT WINAPI CertDuplicateCertificateContext( PCCERT_CONTEXT );
1398
1399#define CertGetNameString __AW_SUFFIXED__( CertGetNameString )
1400DWORD WINAPI CertGetNameStringA( PCCERT_CONTEXT, DWORD, DWORD, void *, LPSTR, DWORD );
1401DWORD WINAPI CertGetNameStringW( PCCERT_CONTEXT, DWORD, DWORD, void *, LPWSTR, DWORD );
1402
1403BOOL WINAPI PFXIsPFXBlob( CRYPT_DATA_BLOB * );
1404PCERT_EXTENSION WINAPI CertFindExtension( LPCSTR, DWORD, CERT_EXTENSION * );
1405BOOL WINAPI CryptDecodeObject( DWORD, LPCSTR, const BYTE *, DWORD, DWORD, void *, DWORD * );
1406BOOL WINAPI CryptDecodeObjectEx( DWORD, LPCSTR, const BYTE *, DWORD, DWORD, PCRYPT_DECODE_PARA, void *, DWORD * );
1407BOOL WINAPI CryptEncodeObject( DWORD, LPCSTR, const void *, BYTE *, DWORD * );
1408BOOL WINAPI CryptEncodeObjectEx( DWORD, LPCSTR, const void *, DWORD, PCRYPT_ENCODE_PARA, void *, DWORD * );
1409BOOL WINAPI CertAddCertificateContextToStore( HCERTSTORE, PCCERT_CONTEXT, DWORD, PCCERT_CONTEXT * );
1410BOOL WINAPI CertCompareCertificate( DWORD, PCERT_INFO, PCERT_INFO );
1411BOOL WINAPI PFXVerifyPassword( CRYPT_DATA_BLOB *, LPCWSTR, DWORD );
1412HCERTSTORE WINAPI PFXImportCertStore( CRYPT_DATA_BLOB *, LPCWSTR, DWORD );
1413BOOL WINAPI CertDeleteCertificateFromStore( PCCERT_CONTEXT );
1414
1415#define CryptAcquireContext __AW_SUFFIXED__( CryptAcquireContext )
1416WINADVAPI BOOL WINAPI CryptAcquireContextA( HCRYPTPROV *, LPCSTR, LPCSTR, DWORD, DWORD );
1417WINADVAPI BOOL WINAPI CryptAcquireContextW( HCRYPTPROV *, LPCWSTR, LPCWSTR, DWORD, DWORD );
1418
1419WINADVAPI BOOL WINAPI CryptContextAddRef( HCRYPTPROV, DWORD *, DWORD );
1420WINADVAPI BOOL WINAPI CryptReleaseContext( HCRYPTPROV, DWORD );
1421WINADVAPI BOOL WINAPI CryptGenKey( HCRYPTPROV, ALG_ID, DWORD, HCRYPTKEY * );
1422WINADVAPI BOOL WINAPI CryptDeriveKey( HCRYPTPROV, ALG_ID, HCRYPTHASH, DWORD, HCRYPTKEY * );
1423WINADVAPI BOOL WINAPI CryptDestroyKey( HCRYPTKEY );
1424
1425#if WINVER >= _WIN32_WINNT_WIN2K
1426WINADVAPI BOOL WINAPI CryptDuplicateHash( HCRYPTHASH, DWORD *, DWORD, HCRYPTHASH * );
1427WINADVAPI BOOL WINAPI CryptDuplicateKey( HCRYPTKEY, DWORD *, DWORD, HCRYPTKEY * );
1428#endif
1429
1430WINADVAPI BOOL WINAPI CryptSetKeyParam( HCRYPTKEY, DWORD, PBYTE, DWORD );
1431WINADVAPI BOOL WINAPI CryptGetKeyParam( HCRYPTKEY, DWORD, PBYTE, PDWORD, DWORD );
1432WINADVAPI BOOL WINAPI CryptSetHashParam( HCRYPTHASH, DWORD, PBYTE, DWORD );
1433WINADVAPI BOOL WINAPI CryptGetHashParam( HCRYPTHASH, DWORD, PBYTE, PDWORD, DWORD );
1434WINADVAPI BOOL WINAPI CryptSetProvParam( HCRYPTPROV, DWORD, PBYTE, DWORD );
1435WINADVAPI BOOL WINAPI CryptGetProvParam( HCRYPTPROV, DWORD, PBYTE, PDWORD, DWORD );
1436WINADVAPI BOOL WINAPI CryptGenRandom( HCRYPTPROV, DWORD, PBYTE );
1437WINADVAPI BOOL WINAPI CryptGetUserKey( HCRYPTPROV, DWORD, HCRYPTKEY * );
1438WINADVAPI BOOL WINAPI CryptExportKey( HCRYPTKEY, HCRYPTKEY, DWORD, DWORD, PBYTE, PDWORD );
1439WINADVAPI BOOL WINAPI CryptImportKey( HCRYPTPROV, PBYTE, DWORD, HCRYPTKEY, DWORD, HCRYPTKEY * );
1440WINADVAPI BOOL WINAPI CryptEncrypt( HCRYPTKEY, HCRYPTHASH, BOOL, DWORD, PBYTE, PDWORD, DWORD );
1441WINADVAPI BOOL WINAPI CryptDecrypt( HCRYPTKEY, HCRYPTHASH, BOOL, DWORD, PBYTE, PDWORD );
1442WINADVAPI BOOL WINAPI CryptCreateHash( HCRYPTPROV, ALG_ID, HCRYPTKEY, DWORD, HCRYPTHASH * );
1443WINADVAPI BOOL WINAPI CryptHashData( HCRYPTHASH, PBYTE, DWORD, DWORD );
1444WINADVAPI BOOL WINAPI CryptHashSessionKey( HCRYPTHASH, HCRYPTKEY, DWORD );
1445WINADVAPI BOOL WINAPI CryptGetHashValue( HCRYPTHASH, DWORD, PBYTE, PDWORD );
1446WINADVAPI BOOL WINAPI CryptDestroyHash( HCRYPTHASH );
1447
1448#define CryptSignHash __AW_SUFFIXED__( CryptSignHash )
1449WINADVAPI BOOL WINAPI CryptSignHashA( HCRYPTHASH, DWORD, LPCSTR, DWORD, PBYTE, PDWORD );
1450WINADVAPI BOOL WINAPI CryptSignHashW( HCRYPTHASH, DWORD, LPCWSTR, DWORD, PBYTE, PDWORD );
1451
1452#define CryptVerifySignature __AW_SUFFIXED__( CryptVerifySignature )
1453WINADVAPI BOOL WINAPI CryptVerifySignatureA( HCRYPTHASH, PBYTE, DWORD, HCRYPTKEY, LPCSTR, DWORD );
1454WINADVAPI BOOL WINAPI CryptVerifySignatureW( HCRYPTHASH, PBYTE, DWORD, HCRYPTKEY, LPCWSTR, DWORD );
1455
1456#define CryptSetProvider __AW_SUFFIXED__( CryptSetProvider )
1457WINADVAPI BOOL WINAPI CryptSetProviderA( LPCSTR, DWORD );
1458WINADVAPI BOOL WINAPI CryptSetProviderW( LPCWSTR, DWORD );
1459
1460#define CryptEnumProviders __AW_SUFFIXED__( CryptEnumProviders )
1461WINADVAPI BOOL WINAPI CryptEnumProvidersA( DWORD, DWORD *, DWORD, DWORD *, LPSTR, DWORD * );
1462WINADVAPI BOOL WINAPI CryptEnumProvidersW( DWORD, DWORD *, DWORD, DWORD *, LPWSTR, DWORD * );
1463
1464typedef struct _CRYPTPROTECT_PROMPTSTRUCT
1465{ /* From http://msdn2.microsoft.com/en-us/library/Aa380263.aspx:
1466 */
1467 DWORD cbSize;
1468 DWORD dwPromptFlags;
1469 HWND hwndApp;
1470 LPCWSTR szPrompt;
1471} CRYPTPROTECT_PROMPTSTRUCT, *PCRYPTPROTECT_PROMPTSTRUCT;
1472
1473
1474/* From http://msdn2.microsoft.com/en-us/library/aa380261.aspx
1475 */
1476BOOL WINAPI CryptProtectData( DATA_BLOB *, LPCWSTR, DATA_BLOB *, PVOID, CRYPTPROTECT_PROMPTSTRUCT *, DWORD, DATA_BLOB * );
1477
1478/* From http://msdn2.microsoft.com/en-us/library/aa380882.aspx
1479 */
1480BOOL WINAPI CryptUnprotectData( DATA_BLOB *, LPWSTR *, DATA_BLOB *, PVOID, CRYPTPROTECT_PROMPTSTRUCT *, DWORD, DATA_BLOB * );
1481
1482/* From http://msdn2.microsoft.com/en-us/library/aa302402.aspx:
1483 */
1484#define CRYPTPROTECT_UI_FORBIDDEN 0x1
1485#define CRYPTPROTECT_LOCAL_MACHINE 0x4
1486
1487typedef BOOL (WINAPI *PFN_CRYPT_ENUM_KEYID_PROP)( const CRYPT_HASH_BLOB *, DWORD, void *, void *, DWORD, DWORD, void **, DWORD );
1488
1489BOOL WINAPI CertGetCertificateContextProperty( PCCERT_CONTEXT, DWORD, void *, DWORD * );
1490BOOL WINAPI CryptEnumKeyIdentifierProperties( const CRYPT_HASH_BLOB *, DWORD, DWORD, LPCWSTR, void *, void *, PFN_CRYPT_ENUM_KEYID_PROP );
1491BOOL WINAPI CryptAcquireCertificatePrivateKey( PCCERT_CONTEXT, DWORD, void *, HCRYPTPROV *, DWORD *, BOOL * );
1492PCCERT_CONTEXT WINAPI CertCreateCertificateContext( DWORD, const BYTE *, DWORD );
1493BOOL WINAPI CryptGetKeyIdentifierProperty( const CRYPT_HASH_BLOB *, DWORD, DWORD, LPCWSTR, void *, void *, DWORD * );
1494BOOL WINAPI CertSetCertificateContextProperty( PCCERT_CONTEXT, DWORD, DWORD, void * );
1495BOOL WINAPI CertCompareCertificateName( DWORD, PCERT_NAME_BLOB, PCERT_NAME_BLOB );
1496BOOL WINAPI CryptSetKeyIdentifierProperty( const CRYPT_HASH_BLOB *, DWORD, DWORD, LPCWSTR, void *, void * );
1497DWORD WINAPI CertOIDToAlgId( LPCSTR );
1498
1499#define CryptGetDefaultProvider __AW_SUFFIXED__( CryptGetDefaultProvider )
1500BOOL WINAPI CryptGetDefaultProviderA( DWORD, DWORD, DWORD, LPSTR, DWORD );
1501BOOL WINAPI CryptGetDefaultProviderW( DWORD, DWORD, DWORD, LPWSTR, DWORD );
1502
1503_END_C_DECLS
1504
1505#endif /* ! _WINCRYPT_H: $RCSfile: wincrypt.h,v $: end of file */
Note: See TracBrowser for help on using the repository browser.