49522d0ea5cdd24c83ddeac4361ff4ece9bbb97f
[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 #define CALG_MD2 (ALG_CLASS_HASH|ALG_TYPE_ANY|ALG_SID_MD2)
84 #define CALG_MD4 (ALG_CLASS_HASH|ALG_TYPE_ANY|ALG_SID_MD4)
85 #define CALG_MD5 (ALG_CLASS_HASH|ALG_TYPE_ANY|ALG_SID_MD5)
86 #define CALG_SHA (ALG_CLASS_HASH|ALG_TYPE_ANY|ALG_SID_SHA)
87 #define CALG_MAC (ALG_CLASS_HASH|ALG_TYPE_ANY|ALG_SID_MAC)
88 #define CALG_3DES (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|3)
89 #define CALG_CYLINK_MEK (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|12)
90 #define CALG_SKIPJACK (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|10)
91 #define CALG_KEA_KEYX (ALG_CLASS_KEY_EXCHANGE|ALG_TYPE_STREAM|ALG_TYPE_DSS|4)
92 #define CALG_RSA_SIGN (ALG_CLASS_SIGNATURE|ALG_TYPE_RSA|ALG_SID_RSA_ANY)
93 #define CALG_DSS_SIGN (ALG_CLASS_SIGNATURE|ALG_TYPE_DSS|ALG_SID_DSS_ANY)
94 #define CALG_RSA_KEYX (ALG_CLASS_KEY_EXCHANGE|ALG_TYPE_RSA|ALG_SID_RSA_ANY)
95 #define CALG_DES (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_DES)
96 #define CALG_RC2 (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_RC2)
97 #define CALG_RC4 (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_STREAM|ALG_SID_RC4)
98 #define CALG_SEAL (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_STREAM|ALG_SID_SEAL)
99 #define CALG_DH_EPHEM (ALG_CLASS_KEY_EXCHANGE|ALG_TYPE_STREAM|ALG_TYPE_DSS|ALG_SID_DSS_DMS)
100 #define CALG_DESX (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_DESX)
101 #define CALG_TLS1PRF (ALG_CLASS_DHASH|ALG_TYPE_ANY|ALG_SID_TLS1PRF)
102
103 #define CRYPT_VERIFYCONTEXT 0xF0000000
104 #define CRYPT_NEWKEYSET 8
105 #define CRYPT_DELETEKEYSET 16
106 #define CRYPT_MACHINE_KEYSET 32
107 #define CRYPT_SILENT 64
108 #define CRYPT_EXPORTABLE 1
109 #define CRYPT_USER_PROTECTED 2
110 #define CRYPT_CREATE_SALT 4
111 #define CRYPT_UPDATE_KEY 8
112 #define SIMPLEBLOB 1
113 #define PUBLICKEYBLOB 6
114 #define PRIVATEKEYBLOB 7
115 #define PLAINTEXTKEYBLOB 8
116 #define OPAQUEKEYBLOB 9
117 #define PUBLICKEYBLOBEX 10
118 #define SYMMETRICWRAPKEYBLOB 11
119 #define AT_KEYEXCHANGE 1
120 #define AT_SIGNATURE 2
121 #define CRYPT_USERDATA 1
122 #define PKCS5_PADDING 1
123 #define CRYPT_MODE_CBC 1
124 #define CRYPT_MODE_ECB 2
125 #define CRYPT_MODE_OFB 3
126 #define CRYPT_MODE_CFB 4
127 #define CRYPT_MODE_CTS 5
128 #define CRYPT_MODE_CBCI 6
129 #define CRYPT_MODE_CFBP 7
130 #define CRYPT_MODE_OFBP 8
131 #define CRYPT_MODE_CBCOFM 9
132 #define CRYPT_MODE_CBCOFMI 10
133 #define CRYPT_ENCRYPT 1
134 #define CRYPT_DECRYPT 2
135 #define CRYPT_EXPORT 4
136 #define CRYPT_READ 8
137 #define CRYPT_WRITE 16
138 #define CRYPT_MAC 32
139 /* Crypt{Get|Set}Provider */
140 #define CRYPT_MACHINE_DEFAULT 0x00000001
141 #define CRYPT_USER_DEFAULT 0x00000002
142 #define CRYPT_DELETE_DEFAULT 0x00000004
143
144 /* Algorithm IDs */
145
146 #define GET_ALG_CLASS(x) (x & (7 << 13))
147 #define GET_ALG_TYPE(x) (x & (15 << 9))
148 #define GET_ALG_SID(x) (x & (511))
149
150 /* Algorithm Classes */
151 #define ALG_CLASS_ANY (0)
152 #define ALG_CLASS_SIGNATURE (1 << 13)
153 #define ALG_CLASS_MSG_ENCRYPT (2 << 13)
154 #define ALG_CLASS_DATA_ENCRYPT (3 << 13)
155 #define ALG_CLASS_HASH (4 << 13)
156 #define ALG_CLASS_KEY_EXCHANGE (5 << 13)
157 /* Algorithm types */
158 #define ALG_TYPE_ANY (0)
159 #define ALG_TYPE_DSS (1 << 9)
160 #define ALG_TYPE_RSA (2 << 9)
161 #define ALG_TYPE_BLOCK (3 << 9)
162 #define ALG_TYPE_STREAM (4 << 9)
163 #define ALG_TYPE_DH (5 << 9)
164 #define ALG_TYPE_SECURECHANNEL (6 << 9)
165
166 /* SIDs */
167 #define ALG_SID_ANY (0)
168 /* RSA SIDs */
169 #define ALG_SID_RSA_ANY 0
170 #define ALG_SID_RSA_PKCS 1
171 #define ALG_SID_RSA_MSATWORK 2
172 #define ALG_SID_RSA_ENTRUST 3
173 #define ALG_SID_RSA_PGP 4
174 /* DSS SIDs */
175 #define ALG_SID_DSS_ANY 0
176 #define ALG_SID_DSS_PKCS 1
177 #define ALG_SID_DSS_DMS 2
178
179 /* DES SIDs */
180 #define ALG_SID_DES 1
181 #define ALG_SID_3DES 3
182 #define ALG_SID_DESX 4
183 #define ALG_SID_IDEA 5
184 #define ALG_SID_CAST 6
185 #define ALG_SID_SAFERSK64 7
186 #define ALG_SID_SAFERSK128 8
187 #define ALG_SID_3DES_112 9
188 /* Diffie-Hellmans SIDs */
189 #define ALG_SID_DH_SANDF 1
190 #define ALG_SID_DH_EPHEM 2
191 #define ALG_SID_AGREED_KEY_ANY 3
192 #define ALG_SID_KEA 4
193 /* RC2 SIDs */
194 #define ALG_SID_RC4 1
195 #define ALG_SID_RC2 2
196 #define ALG_SID_SEAL 2
197 /* Hash SIDs */
198 #define ALG_SID_MD2 1
199 #define ALG_SID_MD4 2
200 #define ALG_SID_MD5 3
201 #define ALG_SID_SHA 4
202 #define ALG_SID_SHA1 CALG_SHA
203 #define ALG_SID_MAC 5
204 #define ALG_SID_RIPEMD 6
205 #define ALG_SID_RIPEMD160 7
206 #define ALG_SID_SSL3SHAMD5 8
207 #define ALG_SID_HMAC 9
208 #define ALG_SID_TLS1PRF 10
209 /* SCHANNEL SIDs */
210 #define ALG_SID_SSL3_MASTER 1
211 #define ALG_SID_SCHANNEL_MASTER_HASH 2
212 #define ALG_SID_SCHANNEL_MAC_KEY 3
213 #define ALG_SID_PCT1_MASTER 4
214 #define ALG_SID_SSL2_MASTER 5
215 #define ALG_SID_TLS1_MASTER 6
216 #define ALG_SID_SCHANNEL_ENC_KEY 7
217 #define ALG_SID_EXAMPLE 80
218
219 /* Algorithm Definitions */
220 #define CALG_MD2 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MD2)
221 #define CALG_MD4 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MD4)
222 #define CALG_MD5 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MD5)
223 #define CALG_SHA (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA)
224 #define CALG_SHA1 CALG_SHA
225 #define CALG_MAC (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MAC)
226 #define CALG_SSL3_SHAMD5 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SSL3SHAMD5)
227 #define CALG_HMAC (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_HMAC)
228 #define CALG_TLS1PRF (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_TLS1PRF)
229 #define CALG_RSA_SIGN (ALG_CLASS_SIGNATURE | ALG_TYPE_RSA | ALG_SID_RSA_ANY)
230 #define CALG_DSS_SIGN (ALG_CLASS_SIGNATURE | ALG_TYPE_DSS | ALG_SID_DSS_ANY)
231 #define CALG_DH_SF (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_DH | ALG_SID_DH_SANDF)
232 #define CALG_DH_EPHEM (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_DH | ALG_SID_DH_EPHEM)
233 #define CALG_RSA_KEYX (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_RSA | ALG_SID_RSA_ANY)
234 #define CALG_DES (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_DES)
235 #define CALG_RC2 (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_RC2)
236 #define CALG_3DES (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_3DES)
237 #define CALG_3DES_112 (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_3DES_112)
238 #define CALG_RC4 (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_STREAM | ALG_SID_RC4)
239 #define CALG_SEAL (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_STREAM | ALG_SID_SEAL)
240 #define CALG_SSL3_MASTER (ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL | ALG_SID_SSL3_MASTER)
241 #define CALG_SCHANNEL_MASTER_HASH (ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL | ALG_SID_SCHANNEL_MASTER_HASH)
242 #define CALG_SCHANNEL_MAC_KEY (ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL | ALG_SID_SCHANNEL_MAC_KEY)
243 #define CALG_SCHANNEL_ENC_KEY (ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL | ALG_SID_SCHANNEL_ENC_KEY)
244 #define CALG_PCT1_MASTER (ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL | ALG_SID_PCT1_MASTER)
245 #define CALG_SSL2_MASTER (ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL | ALG_SID_SSL2_MASTER)
246 #define CALG_TLS1_MASTER (ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL | ALG_SID_TLS1_MASTER)
247
248 /* OIDs */
249 #define szOID_RSA "1.2.840.113549"
250 #define szOID_PKCS "1.2.840.113549.1"
251 #define szOID_RSA_HASH "1.2.840.113549.2"
252 #define szOID_RSA_ENCRYPT "1.2.840.113549.3"
253 #define szOID_PKCS_1 "1.2.840.113549.1.1"
254 #define szOID_PKCS_2 "1.2.840.113549.1.2"
255 #define szOID_PKCS_3 "1.2.840.113549.1.3"
256 #define szOID_PKCS_4 "1.2.840.113549.1.4"
257 #define szOID_PKCS_5 "1.2.840.113549.1.5"
258 #define szOID_PKCS_6 "1.2.840.113549.1.6"
259 #define szOID_PKCS_7 "1.2.840.113549.1.7"
260 #define szOID_PKCS_8 "1.2.840.113549.1.8"
261 #define szOID_PKCS_9 "1.2.840.113549.1.9"
262 #define szOID_PKCS_10 "1.2.840.113549.1.10"
263 #define szOID_PKCS_11 "1.2.840.113549.1.12"
264 #define szOID_RSA_RSA "1.2.840.113549.1.1.1"
265 #define CERT_RSA_PUBLIC_KEY_OBJID szOID_RSA_RSA
266 #define CERT_DEFAULT_OID_PUBLIC_KEY_SIGN szOID_RSA_RSA
267 #define CERT_DEFAULT_OID_PUBLIC_KEY_XCHG szOID_RSA_RSA
268 #define szOID_RSA_MD2RSA "1.2.840.113549.1.1.2"
269 #define szOID_RSA_MD4RSA "1.2.840.113549.1.1.3"
270 #define szOID_RSA_MD5RSA "1.2.840.113549.1.1.4"
271 #define szOID_RSA_SHA1RSA "1.2.840.113549.1.1.5"
272 #define szOID_RSA_SET0AEP_RSA "1.2.840.113549.1.1.6"
273 #define szOID_RSA_DH "1.2.840.113549.1.3.1"
274 #define szOID_RSA_data "1.2.840.113549.1.7.1"
275 #define szOID_RSA_signedData "1.2.840.113549.1.7.2"
276 #define szOID_RSA_envelopedData "1.2.840.113549.1.7.3"
277 #define szOID_RSA_signEnvData "1.2.840.113549.1.7.4"
278 #define szOID_RSA_digestedData "1.2.840.113549.1.7.5"
279 #define szOID_RSA_hashedData "1.2.840.113549.1.7.5"
280 #define szOID_RSA_encryptedData "1.2.840.113549.1.7.6"
281 #define szOID_RSA_emailAddr "1.2.840.113549.1.9.1"
282 #define szOID_RSA_unstructName "1.2.840.113549.1.9.2"
283 #define szOID_RSA_contentType "1.2.840.113549.1.9.3"
284 #define szOID_RSA_messageDigest "1.2.840.113549.1.9.4"
285 #define szOID_RSA_signingTime "1.2.840.113549.1.9.5"
286 #define szOID_RSA_counterSign "1.2.840.113549.1.9.6"
287 #define szOID_RSA_challengePwd "1.2.840.113549.1.9.7"
288 #define szOID_RSA_unstructAddr "1.2.840.113549.1.9.9"
289 #define szOID_RSA_extCertAttrs "1.2.840.113549.1.9.9"
290 #define szOID_RSA_certExtensions "1.2.840.113549.1.9.14"
291 #define szOID_RSA_SMIMECapabilities "1.2.840.113549.1.9.15"
292 #define szOID_RSA_preferSignedData "1.2.840.113549.1.9.15.1"
293 #define szOID_RSA_SMIMEalg "1.2.840.113549.1.9.16.3"
294 #define szOID_RSA_SMIMEalgESDH "1.2.840.113549.1.9.16.3.5"
295 #define szOID_RSA_SMIMEalgCMS3DESwrap "1.2.840.113549.1.9.16.3.6"
296 #define szOID_RSA_SMIMEalgCMSRC2wrap "1.2.840.113549.1.9.16.3.7"
297 #define szOID_RSA_MD2 "1.2.840.113549.2.2"
298 #define szOID_RSA_MD4 "1.2.840.113549.2.4"
299 #define szOID_RSA_MD5 "1.2.840.113549.2.5"
300 #define szOID_RSA_RC2CBC "1.2.840.113549.3.2"
301 #define szOID_RSA_RC4 "1.2.840.113549.3.4"
302 #define szOID_RSA_DES_EDE3_CBC "1.2.840.113549.3.7"
303 #define szOID_RSA_RC5_CBCPad "1.2.840.113549.3.9"
304 #define szOID_ANSI_X942 "1.2.840.10046"
305 #define szOID_ANSI_X942_DH "1.2.840.10046.2.1"
306 #define szOID_X957 "1.2.840.10040"
307 #define szOID_X957_DSA "1.2.840.10040.4.1"
308 #define szOID_X957_SHA1DSA "1.2.840.10040.4.3"
309 #define szOID_DS "2.5"
310 #define szOID_DSALG "2.5.8"
311 #define szOID_DSALG_CRPT "2.5.8.1"
312 #define szOID_DSALG_HASH "2.5.8.2"
313 #define szOID_DSALG_SIGN "2.5.8.3"
314 #define szOID_DSALG_RSA "2.5.8.1.1"
315 #define szOID_OIW "1.3.14"
316 #define szOID_OIWSEC "1.3.14.3.2"
317 #define szOID_OIWSEC_md4RSA "1.3.14.3.2.2"
318 #define szOID_OIWSEC_md5RSA "1.3.14.3.2.3"
319 #define szOID_OIWSEC_md4RSA2 "1.3.14.3.2.4"
320 #define szOID_OIWSEC_desECB "1.3.14.3.2.6"
321 #define szOID_OIWSEC_desCBC "1.3.14.3.2.7"
322 #define szOID_OIWSEC_desOFB "1.3.14.3.2.8"
323 #define szOID_OIWSEC_desCFB "1.3.14.3.2.9"
324 #define szOID_OIWSEC_desMAC "1.3.14.3.2.10"
325 #define szOID_OIWSEC_rsaSign "1.3.14.3.2.11"
326 #define szOID_OIWSEC_dsa "1.3.14.3.2.12"
327 #define szOID_OIWSEC_shaDSA "1.3.14.3.2.13"
328 #define szOID_OIWSEC_mdc2RSA "1.3.14.3.2.14"
329 #define szOID_OIWSEC_shaRSA "1.3.14.3.2.15"
330 #define szOID_OIWSEC_dhCommMod "1.3.14.3.2.16"
331 #define szOID_OIWSEC_desEDE "1.3.14.3.2.17"
332 #define szOID_OIWSEC_sha "1.3.14.3.2.18"
333 #define szOID_OIWSEC_mdc2 "1.3.14.3.2.19"
334 #define szOID_OIWSEC_dsaComm "1.3.14.3.2.20"
335 #define szOID_OIWSEC_dsaCommSHA "1.3.14.3.2.21"
336 #define szOID_OIWSEC_rsaXchg "1.3.14.3.2.22"
337 #define szOID_OIWSEC_keyHashSeal "1.3.14.3.2.23"
338 #define szOID_OIWSEC_md2RSASign "1.3.14.3.2.24"
339 #define szOID_OIWSEC_md5RSASign "1.3.14.3.2.25"
340 #define szOID_OIWSEC_sha1 "1.3.14.3.2.26"
341 #define szOID_OIWSEC_dsaSHA1 "1.3.14.3.2.27"
342 #define szOID_OIWSEC_dsaCommSHA1 "1.3.14.3.2.28"
343 #define szOID_OIWSEC_sha1RSASign "1.3.14.3.2.29"
344 #define szOID_OIWDIR "1.3.14.7.2"
345 #define szOID_OIWDIR_CRPT "1.3.14.7.2.1"
346 #define szOID_OIWDIR_HASH "1.3.14.7.2.2"
347 #define szOID_OIWDIR_SIGN "1.3.14.7.2.3"
348 #define szOID_OIWDIR_md2 "1.3.14.7.2.2.1"
349 #define szOID_OIWDIR_md2RSA "1.3.14.7.2.3.1"
350 #define szOID_INFOSEC "2.16.840.1.101.2.1"
351 #define szOID_INFOSEC_sdnsSignature "2.16.840.1.101.2.1.1.1"
352 #define szOID_INFOSEC_mosaicSignature "2.16.840.1.101.2.1.1.2"
353 #define szOID_INFOSEC_sdnsConfidentiality "2.16.840.1.101.2.1.1.3"
354 #define szOID_INFOSEC_mosaicConfidentiality "2.16.840.1.101.2.1.1.4"
355 #define szOID_INFOSEC_sdnsIntegrity "2.16.840.1.101.2.1.1.5"
356 #define szOID_INFOSEC_mosaicIntegrity "2.16.840.1.101.2.1.1.6"
357 #define szOID_INFOSEC_sdnsTokenProtection "2.16.840.1.101.2.1.1.7"
358 #define szOID_INFOSEC_mosaicTokenProtection "2.16.840.1.101.2.1.1.8"
359 #define szOID_INFOSEC_sdnsKeyManagement "2.16.840.1.101.2.1.1.9"
360 #define szOID_INFOSEC_mosaicKeyManagement "2.16.840.1.101.2.1.1.10"
361 #define szOID_INFOSEC_sdnsKMandSig "2.16.840.1.101.2.1.1.11"
362 #define szOID_INFOSEC_mosaicKMandSig "2.16.840.1.101.2.1.1.12"
363 #define szOID_INFOSEC_SuiteASignature "2.16.840.1.101.2.1.1.13"
364 #define szOID_INFOSEC_SuiteAConfidentiality "2.16.840.1.101.2.1.1.14"
365 #define szOID_INFOSEC_SuiteAIntegrity "2.16.840.1.101.2.1.1.15"
366 #define szOID_INFOSEC_SuiteATokenProtection "2.16.840.1.101.2.1.1.16"
367 #define szOID_INFOSEC_SuiteAKeyManagement "2.16.840.1.101.2.1.1.17"
368 #define szOID_INFOSEC_SuiteAKMandSig "2.16.840.1.101.2.1.1.18"
369 #define szOID_INFOSEC_mosaicUpdatedSig "2.16.840.1.101.2.1.1.19"
370 #define szOID_INFOSEC_mosaicKMandUpdSig "2.16.840.1.101.2.1.1.20"
371 #define szOID_INFOSEC_mosaicUpdateInteg "2.16.840.1.101.2.1.1.21"
372 #define szOID_COMMON_NAME "2.5.4.3"
373 #define szOID_SUR_NAME "2.5.4.4"
374 #define szOID_DEVICE_SERIAL_NUMBER "2.5.4.5"
375 #define szOID_COUNTRY_NAME "2.5.4.6"
376 #define szOID_LOCALITY_NAME "2.5.4.7"
377 #define szOID_STATE_OR_PROVINCE_NAME "2.5.4.8"
378 #define szOID_STREET_ADDRESS "2.5.4.9"
379 #define szOID_ORGANIZATION_NAME "2.5.4.10"
380 #define szOID_ORGANIZATIONAL_UNIT_NAME "2.5.4.11"
381 #define szOID_TITLE "2.5.4.12"
382 #define szOID_DESCRIPTION "2.5.4.13"
383 #define szOID_SEARCH_GUIDE "2.5.4.14"
384 #define szOID_BUSINESS_CATEGORY "2.5.4.15"
385 #define szOID_POSTAL_ADDRESS "2.5.4.16"
386 #define szOID_POSTAL_CODE "2.5.4.17"
387 #define szOID_POST_OFFICE_BOX "2.5.4.18"
388 #define szOID_PHYSICAL_DELIVERY_OFFICE_NAME "2.5.4.19"
389 #define szOID_TELEPHONE_NUMBER "2.5.4.20"
390 #define szOID_TELEX_NUMBER "2.5.4.21"
391 #define szOID_TELETEXT_TERMINAL_IDENTIFIER "2.5.4.22"
392 #define szOID_FACSIMILE_TELEPHONE_NUMBER "2.5.4.23"
393 #define szOID_X21_ADDRESS "2.5.4.24"
394 #define szOID_INTERNATIONAL_ISDN_NUMBER "2.5.4.25"
395 #define szOID_REGISTERED_ADDRESS "2.5.4.26"
396 #define szOID_DESTINATION_INDICATOR "2.5.4.27"
397 #define szOID_PREFERRED_DELIVERY_METHOD "2.5.4.28"
398 #define szOID_PRESENTATION_ADDRESS "2.5.4.29"
399 #define szOID_SUPPORTED_APPLICATION_CONTEXT "2.5.4.30"
400 #define szOID_MEMBER "2.5.4.31"
401 #define szOID_OWNER "2.5.4.32"
402 #define szOID_ROLE_OCCUPANT "2.5.4.33"
403 #define szOID_SEE_ALSO "2.5.4.34"
404 #define szOID_USER_PASSWORD "2.5.4.35"
405 #define szOID_USER_CERTIFICATE "2.5.4.36"
406 #define szOID_CA_CERTIFICATE "2.5.4.37"
407 #define szOID_AUTHORITY_REVOCATION_LIST "2.5.4.38"
408 #define szOID_CERTIFICATE_REVOCATION_LIST "2.5.4.39"
409 #define szOID_CROSS_CERTIFICATE_PAIR "2.5.4.40"
410 #define szOID_GIVEN_NAME "2.5.4.42"
411 #define szOID_INITIALS "2.5.4.43"
412 #define szOID_DN_QUALIFIER "2.5.4.46"
413 #define szOID_AUTHORITY_KEY_IDENTIFIER "2.5.29.1"
414 #define szOID_KEY_ATTRIBUTES "2.5.29.2"
415 #define szOID_CERT_POLICIES_95 "2.5.29.3"
416 #define szOID_KEY_USAGE_RESTRICTION "2.5.29.4"
417 #define szOID_LEGACY_POLICY_MAPPINGS "2.5.29.5"
418 #define szOID_SUBJECT_ALT_NAME "2.5.29.7"
419 #define szOID_ISSUER_ALT_NAME "2.5.29.8"
420 #define szOID_SUBJECT_DIR_ATTRS "2.5.29.9"
421 #define szOID_BASIC_CONSTRAINTS "2.5.29.10"
422 #define szOID_SUBJECT_KEY_IDENTIFIER "2.5.29.14"
423 #define szOID_KEY_USAGE "2.5.29.15"
424 #define szOID_PRIVATEKEY_USAGE_PERIOD "2.5.29.16"
425 #define szOID_SUBJECT_ALT_NAME2 "2.5.29.17"
426 #define szOID_ISSUER_ALT_NAME2 "2.5.29.18"
427 #define szOID_BASIC_CONSTRAINTS2 "2.5.29.19"
428 #define szOID_CRL_NUMBER "2.5.29.20"
429 #define szOID_CRL_REASON_CODE "2.5.29.21"
430 #define szOID_REASON_CODE_HOLD "2.5.29.23"
431 #define szOID_DELTA_CRL_INDICATOR "2.5.29.27"
432 #define szOID_ISSUING_DIST_POINT "2.5.29.28"
433 #define szOID_NAME_CONSTRAINTS "2.5.29.30"
434 #define szOID_CRL_DIST_POINTS "2.5.29.31"
435 #define szOID_CERT_POLICIES "2.5.29.32"
436 #define szOID_ANY_CERT_POLICY "2.5.29.32.0"
437 #define szOID_POLICY_MAPPINGS "2.5.29.33"
438 #define szOID_AUTHORITY_KEY_IDENTIFIER2 "2.5.29.35"
439 #define szOID_POLICY_CONSTRAINTS "2.5.29.36"
440 #define szOID_ENHANCED_KEY_USAGE "2.5.29.37"
441 #define szOID_FRESHEST_CRL "2.5.29.46"
442 #define szOID_DOMAIN_COMPONENT "0.9.2342.19200300.100.1.25"
443 #define szOID_PKCS_12_FRIENDLY_NAME_ATTR "1.2.840.113549.1.9.20"
444 #define szOID_PKCS_12_LOCAL_KEY_ID "1.2.840.113549.1.9.21"
445 #define szOID_CERT_EXTENSIONS "1.3.6.1.4.1.311.2.1.14"
446 #define szOID_NEXT_UPDATE_LOCATION "1.3.6.1.4.1.311.10.2"
447 #define szOID_REMOVE_CERTIFICATE "1.3.6.1.4.1.311.10.8.1"
448 #define szOID_CROSS_CERT_DIST_POINTS "1.3.6.1.4.1.311.10.9.1"
449 #define szOID_CTL "1.3.6.1.4.1.311.10.10.1"
450 #define szOID_SORTED_CTL "1.3.6.1.4.1.311.10.10.1.1"
451 #define szOID_ANY_APPLICATION_POLICY "1.3.6.1.4.1.311.10.12.1"
452 #define szOID_RENEWAL_CERTIFICATE "1.3.6.1.4.1.311.13.1"
453 #define szOID_ENROLLMENT_NAME_VALUE_PAIR "1.3.6.1.4.1.311.13.2.1"
454 #define szOID_ENROLLMENT_CSP_PROVIDER "1.3.6.1.4.1.311.13.2.2"
455 #define szOID_OS_VERSION "1.3.6.1.4.1.311.13.2.3"
456 #define szOID_PKCS_12_KEY_PROVIDER_NAME_ATTR "1.3.6.1.4.1.311.17.1"
457 #define szOID_LOCAL_MACHINE_KEYSET "1.3.6.1.4.1.311.17.2"
458 #define szOID_AUTO_ENROLL_CTL_USAGE "1.3.6.1.4.1.311.20.1"
459 #define szOID_ENROLL_CERTTYPE_EXTENSION "1.3.6.1.4.1.311.20.2"
460 #define szOID_ENROLLMENT_AGENT "1.3.6.1.4.1.311.20.2.1"
461 #define szOID_CERT_MANIFOLD "1.3.6.1.4.1.311.20.3"
462 #define szOID_CERTSRV_PREVIOUS_CERT_HASH "1.3.6.1.4.1.311.21.2"
463 #define szOID_CRL_VIRTUAL_BASE "1.3.6.1.4.1.311.21.3"
464 #define szOID_CRL_NEXT_PUBLISH "1.3.6.1.4.1.311.21.4"
465 #define szOID_KP_CA_EXCHANGE "1.3.6.1.4.1.311.21.5"
466 #define szOID_KP_KEY_RECOVERY_AGENT "1.3.6.1.4.1.311.21.6"
467 #define szOID_CERTIFICATE_TEMPLATE "1.3.6.1.4.1.311.21.7"
468 #define szOID_ENTERPRISE_OID_ROOT "1.3.6.1.4.1.311.21.8"
469 #define szOID_RDN_DUMMY_SIGNER "1.3.6.1.4.1.311.21.9"
470 #define szOID_APPLICATION_CERT_POLICIES "1.3.6.1.4.1.311.21.10"
471 #define szOID_APPLICATION_POLICY_MAPPINGS "1.3.6.1.4.1.311.21.11"
472 #define szOID_APPLICATION_POLICY_CONSTRAINTS "1.3.6.1.4.1.311.21.12"
473 #define szOID_ARCHIVED_KEY_ATTR "1.3.6.1.4.1.311.21.13"
474 #define szOID_CRL_SELF_CDP "1.3.6.1.4.1.311.21.14"
475 #define szOID_REQUIRE_CERT_CHAIN_POLICY "1.3.6.1.4.1.311.21.15"
476 #define szOID_ARCHIVED_KEY_CERT_HASH "1.3.6.1.4.1.311.21.16"
477 #define szOID_ISSUED_CERT_HASH "1.3.6.1.4.1.311.21.17"
478 #define szOID_DS_EMAIL_REPLICATION "1.3.6.1.4.1.311.21.19"
479 #define szOID_REQUEST_CLIENT_INFO "1.3.6.1.4.1.311.21.20"
480 #define szOID_ENCRYPTED_KEY_HASH "1.3.6.1.4.1.311.21.21"
481 #define szOID_CERTSRV_CROSSCA_VERSION "1.3.6.1.4.1.311.21.22"
482 #define szOID_KEYID_RDN "1.3.6.1.4.1.311.10.7.1"
483 #define szOID_PKIX "1.3.6.1.5.5.7"
484 #define szOID_PKIX_PE "1.3.6.1.5.5.7.1"
485 #define szOID_AUTHORITY_INFO_ACCESS "1.3.6.1.5.5.7.1.1"
486 #define szOID_PKIX_POLICY_QUALIFIER_CPS "1.3.6.1.5.5.7.2.1"
487 #define szOID_PKIX_POLICY_QUALIFIER_USERNOTICE "1.3.6.1.5.5.7.2.2"
488 #define szOID_PKIX_KP "1.3.6.1.5.5.7.3"
489 #define szOID_PKIX_KP_SERVER_AUTH "1.3.6.1.5.5.7.3.1"
490 #define szOID_PKIX_KP_CLIENT_AUTH "1.3.6.1.5.5.7.3.2"
491 #define szOID_PKIX_KP_CODE_SIGNING "1.3.6.1.5.5.7.3.3"
492 #define szOID_PKIX_KP_EMAIL_PROTECTION "1.3.6.1.5.5.7.3.4"
493 #define szOID_PKIX_KP_IPSEC_END_SYSTEM "1.3.6.1.5.5.7.3.5"
494 #define szOID_PKIX_KP_IPSEC_TUNNEL "1.3.6.1.5.5.7.3.6"
495 #define szOID_PKIX_KP_IPSEC_USER "1.3.6.1.5.5.7.3.7"
496 #define szOID_PKIX_KP_TIMESTAMP_SIGNING "1.3.6.1.5.5.7.3.8"
497 #define szOID_IPSEC_KP_IKE_INTERMEDIATE "1.3.6.1.5.5.8.2.2"
498
499 #ifndef szOID_SERIALIZED
500 #define szOID_SERIALIZED "1.3.6.1.4.1.311.10.3.3.1"
501 #endif
502
503 #ifndef szOID_NT_PRINCIPAL_NAME
504 #define szOID_NT_PRINCIPAL_NAME "1.3.6.1.4.1.311.20.2.3"
505 #endif
506
507 #ifndef szOID_CERTSRV_CA_VERSION
508 #define szOID_CERTSRV_CA_VERSION "1.3.6.1.4.1.311.21.1"
509 #endif
510
511 #ifndef szOID_PRODUCT_UPDATE
512 #define szOID_PRODUCT_UPDATE "1.3.6.1.4.1.311.31.1"
513 #endif
514
515 #define CRYPT_ENCODE_DECODE_NONE 0
516 #define X509_CERT ((LPCSTR)1)
517 #define X509_CERT_TO_BE_SIGNED ((LPCSTR)2)
518 #define X509_CERT_CRL_TO_BE_SIGNED ((LPCSTR)3)
519 #define X509_CERT_REQUEST_TO_BE_SIGNED ((LPCSTR)4)
520 #define X509_EXTENSIONS ((LPCSTR)5)
521 #define X509_NAME_VALUE ((LPCSTR)6)
522 #define X509_ANY_STRING X509_NAME_VALUE
523 #define X509_NAME ((LPCSTR)7)
524 #define X509_PUBLIC_KEY_INFO ((LPCSTR)8)
525 #define X509_AUTHORITY_KEY_ID ((LPCSTR)9)
526 #define X509_KEY_ATTRIBUTES ((LPCSTR)10)
527 #define X509_KEY_USAGE_RESTRICTION ((LPCSTR)11)
528 #define X509_ALTERNATE_NAME ((LPCSTR)12)
529 #define X509_BASIC_CONSTRAINTS ((LPCSTR)13)
530 #define X509_KEY_USAGE ((LPCSTR)14)
531 #define X509_BASIC_CONSTRAINTS2 ((LPCSTR)15)
532 #define X509_CERT_POLICIES ((LPCSTR)16)
533 #define PKCS_UTC_TIME ((LPCSTR)17)
534 #define PKCS_TIME_REQUEST ((LPCSTR)18)
535 #define RSA_CSP_PUBLICKEYBLOB ((LPCSTR)19)
536 #define X509_UNICODE_NAME ((LPCSTR)20)
537 #define X509_KEYGEN_REQUEST_TO_BE_SIGNED ((LPCSTR)21)
538 #define PKCS_ATTRIBUTE ((LPCSTR)22)
539 #define PKCS_CONTENT_INFO_SEQUENCE_OF_ANY ((LPCSTR)23)
540 #define X509_UNICODE_NAME_VALUE ((LPCSTR)24)
541 #define X509_UNICODE_ANY_STRING X509_UNICODE_NAME_VALUE
542 #define X509_OCTET_STRING ((LPCSTR)25)
543 #define X509_BITS ((LPCSTR)26)
544 #define X509_INTEGER ((LPCSTR)27)
545 #define X509_MULTI_BYTE_INTEGER ((LPCSTR)28)
546 #define X509_ENUMERATED ((LPCSTR)29)
547 #define X509_CRL_REASON_CODE X509_ENUMERATED
548 #define X509_CHOICE_OF_TIME ((LPCSTR)30)
549 #define X509_AUTHORITY_KEY_ID2 ((LPCSTR)31)
550 #define X509_AUTHORITY_INFO_ACCESS ((LPCSTR)32)
551 #define PKCS_CONTENT_INFO ((LPCSTR)33)
552 #define X509_SEQUENCE_OF_ANY ((LPCSTR)34)
553 #define X509_CRL_DIST_POINTS ((LPCSTR)35)
554 #define X509_ENHANCED_KEY_USAGE ((LPCSTR)36)
555 #define PKCS_CTL ((LPCSTR)37)
556 #define X509_MULTI_BYTE_UINT ((LPCSTR)38)
557 #define X509_DSS_PUBLICKEY X509_MULTI_BYTE_UINT
558 #define X509_DSS_PARAMETERS ((LPCSTR)39)
559 #define X509_DSS_SIGNATURE ((LPCSTR)40)
560 #define PKCS_RC2_CBC_PARAMETERS ((LPCSTR)41)
561 #define PKCS_SMIME_CAPABILITIES ((LPCSTR)42)
562 #define PKCS_RSA_PRIVATE_KEY ((LPCSTR)43)
563 #define PKCS_PRIVATE_KEY_INFO ((LPCSTR)44)
564 #define PKCS_ENCRYPTED_PRIVATE_KEY_INFO ((LPCSTR)45)
565 #define X509_PKIX_POLICY_QUALIFIER_USERNOTICE ((LPCSTR)46)
566 #define X509_DH_PUBLICKEY X509_MULTI_BYTE_UINT
567 #define X509_DH_PARAMETERS ((LPCSTR)47)
568 #define PKCS_ATTRIBUTES ((LPCSTR)48)
569 #define PKCS_SORTED_CTL ((LPCSTR)49)
570 #define X942_DH_PARAMETERS ((LPCSTR)50)
571 #define X509_BITS_WITHOUT_TRAILING_ZEROES ((LPCSTR)51)
572 #define X942_OTHER_INFO ((LPCSTR)52)
573 #define X509_CERT_PAIR ((LPCSTR)53)
574 #define X509_ISSUING_DIST_POINT ((LPCSTR)54)
575 #define X509_NAME_CONSTRAINTS ((LPCSTR)55)
576 #define X509_POLICY_MAPPINGS ((LPCSTR)56)
577 #define X509_POLICY_CONSTRAINTS ((LPCSTR)57)
578 #define X509_CROSS_CERT_DIST_POINTS ((LPCSTR)58)
579 #define CMC_DATA ((LPCSTR)59)
580 #define CMC_RESPONSE ((LPCSTR)60)
581 #define CMC_STATUS ((LPCSTR)61)
582 #define CMC_ADD_EXTENSIONS ((LPCSTR)62)
583 #define CMC_ADD_ATTRIBUTES ((LPCSTR)63)
584 #define X509_CERTIFICATE_TEMPLATE ((LPCSTR)64)
585 #define PKCS7_SIGNER_INFO ((LPCSTR)500)
586 #define CMS_SIGNER_INFO ((LPCSTR)501)
587
588 /* encode/decode flags */
589 #define CRYPT_ENCODE_NO_SIGNATURE_BYTE_REVERSAL_FLAG 0x00008
590 #define CRYPT_ENCODE_ALLOC_FLAG 0x08000
591 #define CRYPT_SORTED_CTL_ENCODE_HASHED_SUBJECT_IDENTIFIER_FLAG 0x10000
592 #define CRYPT_UNICODE_NAME_ENCODE_ENABLE_T61_UNICODE_FLAG \
593 CERT_RDN_ENABLE_T61_UNICODE_FLAG
594 #define CRYPT_UNICODE_NAME_ENCODE_ENABLE_UTF8_UNICODE_FLAG \
595 CERT_RDN_ENABLE_UTF8_UNICODE_FLAG
596 #define CRYPT_UNICODE_NAME_ENCODE_DISABLE_CHECK_TYPE_FLAG \
597 CERT_RDN_DISABLE_CHECK_TYPE_FLAG
598
599 #define CRYPT_DECODE_NOCOPY_FLAG 0x00001
600 #define CRYPT_DECODE_TO_BE_SIGNED_FLAG 0x00002
601 #define CRYPT_DECODE_SHARE_OID_STRING_FLAG 0x00004
602 #define CRYPT_DECODE_NO_SIGNATURE_BYTE_REVERSAL_FLAG 0x00008
603 #define CRYPT_DECODE_ALLOC_FLAG 0x08000
604 #define CRYPT_UNICODE_NAME_DECODE_DISABLE_IE4_UTF8_FLAG \
605 CERT_RDN_DISABLE_IE4_UTF8_FLAG
606
607 /* types for CertOpenStore dwEncodingType */
608 #define CERT_ENCODING_TYPE_MASK 0x0000ffff
609 #define CMSG_ENCODING_TYPE_MASK 0xffff0000
610 #define GET_CERT_ENCODING_TYPE(x) ((x) & CERT_ENCODING_TYPE_MASK)
611 #define GET_CMSG_ENCODING_TYPE(x) ((x) & CMSG_ENCODING_TYPE_MASK)
612
613 #define CRYPT_ASN_ENCODING 0x00000001
614 #define CRYPT_NDR_ENCODING 0x00000002
615 #define X509_ASN_ENCODING 0x00000001
616 #define X509_NDR_ENCODING 0x00000002
617 #define PKCS_7_ASN_ENCODING 0x00010000
618 #define PKCS_7_NDR_ENCODING 0x00020000
619
620 /* Installable OID function defs */
621 #define CRYPT_OID_OPEN_STORE_PROV_FUNC "CertDllOpenStoreProv"
622 #define CRYPT_OID_ENCODE_OBJECT_FUNC "CryptDllEncodeObject"
623 #define CRYPT_OID_DECODE_OBJECT_FUNC "CryptDllDecodeObject"
624 #define CRYPT_OID_ENCODE_OBJECT_EX_FUNC "CryptDllEncodeObjectEx"
625 #define CRYPT_OID_DECODE_OBJECT_EX_FUNC "CryptDllDecodeObjectEx"
626 #define CRYPT_OID_CREATE_COM_OBJECT_FUNC "CryptDllCreateComObject"
627 #define CRYPT_OID_VERIFY_REVOCATION_FUNC "CertDllVerifyRevocation"
628 #define CRYPT_OID_VERIFY_CTL_USAGE_FUNC "CertDllVerifyCTLUsage"
629 #define CRYPT_OID_FORMAT_OBJECT_FUNC "CryptDllFormatObject"
630 #define CRYPT_OID_FIND_OID_INFO_FUNC "CryptDllFindOIDInfo"
631 #define CRYPT_OID_FIND_LOCALIZED_NAME_FUNC "CryptDllFindLocalizedName"
632 #define CRYPT_OID_EXPORT_PUBLIC_KEY_INFO_FUNC "CryptDllExportPublicKeyInfoEx"
633 #define CRYPT_OID_IMPORT_PUBLIC_KEY_INFO_FUNC "CryptDllImportPublicKeyInfoEx"
634 #define CRYPT_OID_EXPORT_PRIVATE_KEY_INFO_FUNC "CryptDllExportPrivateKeyInfoEx"
635 #define CRYPT_OID_IMPORT_PRIVATE_KEY_INFO_FUNC "CryptDllImportPrivateKeyInfoEx"
636 #define CRYPT_OID_VERIFY_CERTIFICATE_CHAIN_POLICY_FUNC \
637 "CertDllVerifyCertificateChainPolicy"
638 #define URL_OID_GET_OBJECT_URL_FUNC "UrlDllGetObjectUrl"
639 #define TIME_VALID_OID_GET_OBJECT_FUNC "TimeValidDllGetObject"
640
641 #define HP_ALGID 1
642 #define HP_HASHVAL 2
643 #define HP_HASHSIZE 4
644 #define CRYPT_FAILED FALSE
645 #define CRYPT_SUCCEED TRUE
646 #define RCRYPT_SUCCEEDED(r) ((r)==CRYPT_SUCCEED)
647 #define RCRYPT_FAILED(r) ((r)==CRYPT_FAILED)
648 #define PP_CLIENT_HWND 1
649 #define PP_ENUMALGS 1
650 #define PP_ENUMCONTAINERS 2
651 #define PP_IMPTYPE 3
652 #define PP_NAME 4
653 #define PP_VERSION 5
654 #define PP_CONTAINER 6
655 #define PP_CHANGE_PASSWORD 7
656 #define PP_KEYSET_SEC_DESCR 8
657 #define PP_CERTCHAIN 9
658 #define PP_KEY_TYPE_SUBTYPE 10
659 #define PP_PROVTYPE 16
660 #define PP_KEYSTORAGE 17
661 #define PP_APPLI_CERT 18
662 #define PP_SYM_KEYSIZE 19
663 #define PP_SESSION_KEYSIZE 20
664 #define PP_UI_PROMPT 21
665 #define PP_ENUMALGS_EX 22
666 #define PP_ENUMMANDROOTS 25
667 #define PP_ENUMELECTROOTS 26
668 #define PP_KEYSET_TYPE 27
669 #define PP_ADMIN_PIN 31
670 #define PP_KEYEXCHANGE_PIN 32
671 #define PP_SIGNATURE_PIN 33
672 #define PP_SIG_KEYSIZE_INC 34
673 #define PP_KEYX_KEYSIZE_INC 35
674 #define PP_UNIQUE_CONTAINER 36
675 #define PP_SGC_INFO 37
676 #define PP_USE_HARDWARE_RNG 38
677 #define PP_KEYSPEC 39
678 #define PP_ENUMEX_SIGNING_PROT 40
679 #define CRYPT_FIRST 1
680 #define CRYPT_NEXT 2
681 #define CRYPT_IMPL_HARDWARE 1
682 #define CRYPT_IMPL_SOFTWARE 2
683 #define CRYPT_IMPL_MIXED 3
684 #define CRYPT_IMPL_UNKNOWN 4
685 #define PROV_RSA_FULL 1
686 #define PROV_RSA_SIG 2
687 #define PROV_DSS 3
688 #define PROV_FORTEZZA 4
689 #define PROV_MS_MAIL 5
690 #define PROV_SSL 6
691 #define PROV_STT_MER 7
692 #define PROV_STT_ACQ 8
693 #define PROV_STT_BRND 9
694 #define PROV_STT_ROOT 10
695 #define PROV_STT_ISS 11
696 #define PROV_RSA_SCHANNEL 12
697 #define PROV_DSS_DH 13
698 #define PROV_EC_ECDSA_SIG 14
699 #define PROV_EC_ECNRA_SIG 15
700 #define PROV_EC_ECDSA_FULL 16
701 #define PROV_EC_ECNRA_FULL 17
702 #define PROV_DH_SCHANNEL 18
703 #define PROV_SPYRUS_LYNKS 20
704 #define PROV_RNG 21
705 #define PROV_INTEL_SEC 22
706 #define MAXUIDLEN 64
707 #define CUR_BLOB_VERSION 2
708 #define X509_ASN_ENCODING 1
709 #define PKCS_7_ASN_ENCODING 65536
710 #define CERT_V1 0
711 #define CERT_V2 1
712 #define CERT_V3 2
713 #define CERT_E_CHAINING (-2146762486)
714 #define CERT_E_CN_NO_MATCH (-2146762481)
715 #define CERT_E_EXPIRED (-2146762495)
716 #define CERT_E_PURPOSE (-2146762490)
717 #define CERT_E_REVOCATION_FAILURE (-2146762482)
718 #define CERT_E_REVOKED (-2146762484)
719 #define CERT_E_ROLE (-2146762493)
720 #define CERT_E_UNTRUSTEDROOT (-2146762487)
721 #define CERT_E_UNTRUSTEDTESTROOT (-2146762483)
722 #define CERT_E_VALIDITYPERIODNESTING (-2146762494)
723 #define CERT_E_WRONG_USAGE (-2146762480)
724 #define CERT_E_PATHLENCONST (-2146762492)
725 #define CERT_E_CRITICAL (-2146762491)
726 #define CERT_E_ISSUERCHAINING (-2146762489)
727 #define CERT_E_MALFORMED (-2146762488)
728 #define CRYPT_E_REVOCATION_OFFLINE (-2146885613)
729 #define CRYPT_E_REVOKED (-2146885616)
730 #define TRUST_E_BASIC_CONSTRAINTS (-2146869223)
731 #define TRUST_E_CERT_SIGNATURE (-2146869244)
732 #define TRUST_E_FAIL (-2146762485)
733 #define CERT_TRUST_NO_ERROR 0
734 #define CERT_TRUST_IS_NOT_TIME_VALID 1
735 #define CERT_TRUST_IS_NOT_TIME_NESTED 2
736 #define CERT_TRUST_IS_REVOKED 4
737 #define CERT_TRUST_IS_NOT_SIGNATURE_VALID 8
738 #define CERT_TRUST_IS_NOT_VALID_FOR_USAGE 16
739 #define CERT_TRUST_IS_UNTRUSTED_ROOT 32
740 #define CERT_TRUST_REVOCATION_STATUS_UNKNOWN 64
741 #define CERT_TRUST_IS_CYCLIC 128
742 #define CERT_TRUST_IS_PARTIAL_CHAIN 65536
743 #define CERT_TRUST_CTL_IS_NOT_TIME_VALID 131072
744 #define CERT_TRUST_CTL_IS_NOT_SIGNATURE_VALID 262144
745 #define CERT_TRUST_CTL_IS_NOT_VALID_FOR_USAGE 524288
746 #define CERT_TRUST_HAS_EXACT_MATCH_ISSUER 1
747 #define CERT_TRUST_HAS_KEY_MATCH_ISSUER 2
748 #define CERT_TRUST_HAS_NAME_MATCH_ISSUER 4
749 #define CERT_TRUST_IS_SELF_SIGNED 8
750 #define CERT_TRUST_IS_COMPLEX_CHAIN 65536
751 #define CERT_CHAIN_POLICY_BASE ((LPCSTR) 1)
752 #define CERT_CHAIN_POLICY_AUTHENTICODE ((LPCSTR) 2)
753 #define CERT_CHAIN_POLICY_AUTHENTICODE_TS ((LPCSTR) 3)
754 #define CERT_CHAIN_POLICY_SSL ((LPCSTR) 4)
755 #define CERT_CHAIN_POLICY_BASIC_CONSTRAINTS ((LPCSTR) 5)
756 #define CERT_CHAIN_POLICY_NT_AUTH ((LPCSTR) 6)
757 #define USAGE_MATCH_TYPE_AND 0
758 #define USAGE_MATCH_TYPE_OR 1
759 #define CERT_SIMPLE_NAME_STR 1
760 #define CERT_OID_NAME_STR 2
761 #define CERT_X500_NAME_STR 3
762 #define CERT_NAME_STR_SEMICOLON_FLAG 1073741824
763 #define CERT_NAME_STR_CRLF_FLAG 134217728
764 #define CERT_NAME_STR_NO_PLUS_FLAG 536870912
765 #define CERT_NAME_STR_NO_QUOTING_FLAG 268435456
766 #define CERT_NAME_STR_REVERSE_FLAG 33554432
767 #define CERT_NAME_STR_ENABLE_T61_UNICODE_FLAG 131072
768 #define CERT_FIND_ANY 0
769 #define CERT_FIND_CERT_ID 1048576
770 #define CERT_FIND_CTL_USAGE 655360
771 #define CERT_FIND_ENHKEY_USAGE 655360
772 #define CERT_FIND_EXISTING 851968
773 #define CERT_FIND_HASH 65536
774 #define CERT_FIND_ISSUER_ATTR 196612
775 #define CERT_FIND_ISSUER_NAME 131076
776 #define CERT_FIND_ISSUER_OF 786432
777 #define CERT_FIND_KEY_IDENTIFIER 983040
778 #define CERT_FIND_KEY_SPEC 589824
779 #define CERT_FIND_MD5_HASH 262144
780 #define CERT_FIND_PROPERTY 327680
781 #define CERT_FIND_PUBLIC_KEY 393216
782 #define CERT_FIND_SHA1_HASH 65536
783 #define CERT_FIND_SIGNATURE_HASH 917504
784 #define CERT_FIND_SUBJECT_ATTR 196615
785 #define CERT_FIND_SUBJECT_CERT 720896
786 #define CERT_FIND_SUBJECT_NAME 131079
787 #define CERT_FIND_SUBJECT_STR_A 458759
788 #define CERT_FIND_SUBJECT_STR_W 524295
789 #define CERT_FIND_ISSUER_STR_A 458756
790 #define CERT_FIND_ISSUER_STR_W 524292
791 #define CERT_FIND_OR_ENHKEY_USAGE_FLAG 16
792 #define CERT_FIND_OPTIONAL_ENHKEY_USAGE_FLAG 1
793 #define CERT_FIND_NO_ENHKEY_USAGE_FLAG 8
794 #define CERT_FIND_VALID_ENHKEY_USAGE_FLAG 32
795 #define CERT_FIND_EXT_ONLY_ENHKEY_USAGE_FLAG 2
796 #define CERT_CASE_INSENSITIVE_IS_RDN_ATTRS_FLAG 2
797 #define CERT_UNICODE_IS_RDN_ATTRS_FLAG 1
798 #define CERT_CHAIN_FIND_BY_ISSUER 1
799 #define CERT_CHAIN_FIND_BY_ISSUER_COMPARE_KEY_FLAG 1
800 #define CERT_CHAIN_FIND_BY_ISSUER_COMPLEX_CHAIN_FLAG 2
801 #define CERT_CHAIN_FIND_BY_ISSUER_CACHE_ONLY_FLAG 32768
802 #define CERT_CHAIN_FIND_BY_ISSUER_CACHE_ONLY_URL_FLAG 4
803 #define CERT_CHAIN_FIND_BY_ISSUER_LOCAL_MACHINE_FLAG 8
804 #define CERT_CHAIN_FIND_BY_ISSUER_NO_KEY_FLAG 16384
805 #define CERT_STORE_PROV_SYSTEM 10
806 #define CERT_SYSTEM_STORE_LOCAL_MACHINE 131072
807 #define szOID_PKIX_KP_SERVER_AUTH "4235600"
808 #define szOID_SERVER_GATED_CRYPTO "4235658"
809 #define szOID_SGC_NETSCAPE "2.16.840.1.113730.4.1"
810 #define szOID_PKIX_KP_CLIENT_AUTH "1.3.6.1.5.5.7.3.2"
811 #define CRYPT_NOHASHOID 0x00000001
812 #define CRYPT_NO_SALT 0x10
813 #define CRYPT_PREGEN 0x40
814 #define CRYPT_RECIPIENT 0x10
815 #define CRYPT_INITIATOR 0x40
816 #define CRYPT_ONLINE 0x80
817 #define CRYPT_SF 0x100
818 #define CRYPT_CREATE_IV 0x200
819 #define CRYPT_KEK 0x400
820 #define CRYPT_DATA_KEY 0x800
821 #define CRYPT_VOLATILE 0x1000
822 #define CRYPT_SGCKEY 0x2000
823 #define KP_IV 0x00000001
824 #define KP_SALT 0x00000002
825 #define KP_PADDING 0x00000003
826 #define KP_MODE 0x00000004
827 #define KP_MODE_BITS 0x00000005
828 #define KP_PERMISSIONS 0x00000006
829 #define KP_ALGID 0x00000007
830 #define KP_BLOCKLEN 0x00000008
831 #define KP_KEYLEN 0x00000009
832 #define KP_SALT_EX 0x0000000a
833 #define KP_P 0x0000000b
834 #define KP_G 0x0000000c
835 #define KP_Q 0x0000000d
836 #define KP_X 0x0000000e
837 #define KP_Y 0x0000000f
838 #define KP_RA 0x00000010
839 #define KP_RB 0x00000011
840 #define KP_INFO 0x00000012
841 #define KP_EFFECTIVE_KEYLEN 0x00000013
842 #define KP_SCHANNEL_ALG 0x00000014
843 #define KP_PUB_PARAMS 0x00000027
844 #define CRYPT_FLAG_PCT1 0x0001
845 #define CRYPT_FLAG_SSL2 0x0002
846 #define CRYPT_FLAG_SSL3 0x0004
847 #define CRYPT_FLAG_TLS1 0x0008
848 #define CRYPT_FLAG_IPSEC 0x0010
849 #define CRYPT_FLAG_SIGNING 0x0020
850 #define SCHANNEL_MAC_KEY 0x00000000
851 #define SCHANNEL_ENC_KEY 0x00000001
852 #define INTERNATIONAL_USAGE 0x00000001
853
854 typedef UINT ALG_ID;
855 typedef struct _VTableProvStruc {
856 DWORD Version;
857 FARPROC pFuncVerifyImage;
858 FARPROC pFuncReturnhWnd;
859 DWORD dwProvType;
860 BYTE *pbContextInfo;
861 DWORD cbContextInfo;
862 LPSTR pszProvName;
863 } VTableProvStruc, *PVTableProvStruc;
864 typedef ULONG HCRYPTPROV;
865 typedef ULONG HCRYPTKEY;
866 typedef ULONG HCRYPTHASH;
867 typedef PVOID HCERTSTORE;
868 typedef PVOID HCRYPTMSG;
869 typedef PVOID HCERTCHAINENGINE;
870 typedef struct _CRYPTOAPI_BLOB {
871 DWORD cbData;
872 BYTE* pbData;
873 } CRYPT_INTEGER_BLOB, *PCRYPT_INTEGER_BLOB,
874 CRYPT_UINT_BLOB, *PCRYPT_UINT_BLOB,
875 CRYPT_OBJID_BLOB, *PCRYPT_OBJID_BLOB,
876 CERT_NAME_BLOB, *PCERT_NAME_BLOB,
877 CERT_RDN_VALUE_BLOB,*PCERT_RDN_VALUE_BLOB,
878 CERT_BLOB, *PCERT_BLOB,
879 CRL_BLOB, *PCRL_BLOB,
880 DATA_BLOB, *PDATA_BLOB,
881 CRYPT_DATA_BLOB, *PCRYPT_DATA_BLOB,
882 CRYPT_HASH_BLOB, *PCRYPT_HASH_BLOB,
883 CRYPT_DIGEST_BLOB, *PCRYPT_DIGEST_BLOB,
884 CRYPT_DER_BLOB, *PCRYPT_DER_BLOB,
885 CRYPT_ATTR_BLOB, *PCRYPT_ATTR_BLOB;
886 /* not described in SDK; has the same layout as HTTPSPolicyCallbackData */
887 typedef struct _SSL_EXTRA_CERT_CHAIN_POLICY_PARA {
888 DWORD cbStruct;
889 DWORD dwAuthType;
890 DWORD fdwChecks;
891 LPWSTR pwszServerName;
892 } SSL_EXTRA_CERT_CHAIN_POLICY_PARA, *PSSL_EXTRA_CERT_CHAIN_POLICY_PARA,
893 HTTPSPolicyCallbackData, *PHTTPSPolicyCallbackData;
894 /* #if (_WIN32_WINNT>=0x500) */
895 typedef struct _CERT_CHAIN_POLICY_PARA {
896 DWORD cbSize;
897 DWORD dwFlags;
898 void* pvExtraPolicyPara;
899 } CERT_CHAIN_POLICY_PARA, *PCERT_CHAIN_POLICY_PARA;
900 typedef struct _CERT_CHAIN_POLICY_STATUS {
901 DWORD cbSize;
902 DWORD dwError;
903 LONG lChainIndex;
904 LONG lElementIndex;
905 void* pvExtraPolicyStatus;
906 } CERT_CHAIN_POLICY_STATUS, *PCERT_CHAIN_POLICY_STATUS;
907 /* #endif */
908 typedef struct _CRYPT_ALGORITHM_IDENTIFIER {
909 LPSTR pszObjId;
910 CRYPT_OBJID_BLOB Parameters;
911 } CRYPT_ALGORITHM_IDENTIFIER, *PCRYPT_ALGORITHM_IDENTIFIER;
912 typedef struct _CRYPT_BIT_BLOB {
913 DWORD cbData;
914 BYTE* pbData;
915 DWORD cUnusedBits;
916 } CRYPT_BIT_BLOB, *PCRYPT_BIT_BLOB;
917 typedef struct _CERT_PUBLIC_KEY_INFO {
918 CRYPT_ALGORITHM_IDENTIFIER Algorithm;
919 CRYPT_BIT_BLOB PublicKey;
920 } CERT_PUBLIC_KEY_INFO, *PCERT_PUBLIC_KEY_INFO;
921 typedef struct _CERT_EXTENSION {
922 LPSTR pszObjId;
923 BOOL fCritical;
924 CRYPT_OBJID_BLOB Value;
925 } CERT_EXTENSION, *PCERT_EXTENSION;
926 typedef struct _CERT_INFO {
927 DWORD dwVersion;
928 CRYPT_INTEGER_BLOB SerialNumber;
929 CRYPT_ALGORITHM_IDENTIFIER SignatureAlgorithm;
930 CERT_NAME_BLOB Issuer;
931 FILETIME NotBefore;
932 FILETIME NotAfter;
933 CERT_NAME_BLOB Subject;
934 CERT_PUBLIC_KEY_INFO SubjectPublicKeyInfo;
935 CRYPT_BIT_BLOB IssuerUniqueId;
936 CRYPT_BIT_BLOB SubjectUniqueId;
937 DWORD cExtension;
938 PCERT_EXTENSION rgExtension;
939 } CERT_INFO, *PCERT_INFO;
940 typedef struct _CERT_CONTEXT {
941 DWORD dwCertEncodingType;
942 BYTE* pbCertEncoded;
943 DWORD cbCertEncoded;
944 PCERT_INFO pCertInfo;
945 HCERTSTORE hCertStore;
946 } CERT_CONTEXT, *PCERT_CONTEXT;
947 typedef const CERT_CONTEXT *PCCERT_CONTEXT;
948 typedef struct _CTL_USAGE {
949 DWORD cUsageIdentifier;
950 LPSTR *rgpszUsageIdentifier;
951 } CTL_USAGE, *PCTRL_USAGE,
952 CERT_ENHKEY_USAGE, *PCERT_ENHKEY_USAGE;
953 typedef struct _CERT_USAGE_MATCH {
954 DWORD dwType;
955 CERT_ENHKEY_USAGE Usage;
956 } CERT_USAGE_MATCH, *PCERT_USAGE_MATCH;
957 typedef struct _CRYPT_ATTRIBUTE_TYPE_VALUE {
958 LPSTR pszObjId;
959 CRYPT_OBJID_BLOB Value;
960 } CRYPT_ATTRIBUTE_TYPE_VALUE, *PCRYPT_ATTRIBUTE_TYPE_VALUE;
961 /* #if (_WIN32_WINNT>=0x500) */
962 typedef struct _CERT_CHAIN_PARA {
963 DWORD cbSize;
964 CERT_USAGE_MATCH RequestedUsage;
965 #if CERT_CHAIN_PARA_HAS_EXTRA_FIELDS
966 CERT_USAGE_MATCH RequestedIssuancePolicy;
967 DWORD dwUrlRetrievalTimeout;
968 BOOL fCheckRevocationFreshnessTime;
969 DWORD dwRevocationFreshnessTime;
970 #endif
971 } CERT_CHAIN_PARA, *PCERT_CHAIN_PARA;
972 typedef BOOL (WINAPI *PFN_CERT_CHAIN_FIND_BY_ISSUER_CALLBACK)(PCCERT_CONTEXT,void*);
973 typedef struct _CERT_CHAIN_FIND_BY_ISSUER_PARA {
974 DWORD cbSize;
975 LPCSTR pszUsageIdentifier;
976 DWORD dwKeySpec;
977 DWORD dwAcquirePrivateKeyFlags;
978 DWORD cIssuer;
979 CERT_NAME_BLOB* rgIssuer;
980 PFN_CERT_CHAIN_FIND_BY_ISSUER_CALLBACK pfnFIndCallback;
981 void* pvFindArg;
982 DWORD* pdwIssuerChainIndex;
983 DWORD* pdwIssuerElementIndex;
984 } CERT_CHAIN_FIND_BY_ISSUER_PARA, *PCERT_CHAIN_FIND_BY_ISSUER_PARA;
985 /* #endif */
986
987 typedef struct _CERT_POLICY_ID {
988 DWORD cCertPolicyElementId;
989 LPSTR *rgbszCertPolicyElementId;
990 } CERT_POLICY_ID, *PCERT_POLICY_ID;
991
992 typedef struct _PUBLICKEYSTRUC {
993 BYTE bType;
994 BYTE bVersion;
995 WORD reserved;
996 ALG_ID aiKeyAlg;
997 } BLOBHEADER, PUBLICKEYSTRUC;
998
999 typedef struct _CERT_KEY_USAGE_RESTRICTION_INFO {
1000 DWORD cCertPolicyId;
1001 PCERT_POLICY_ID rgCertPolicyId;
1002 CRYPT_BIT_BLOB RestrictedKeyUsage;
1003 } CERT_KEY_USAGE_RESTRICTION_INFO, *PCERT_KEY_USAGE_RESTRICTION_INFO;
1004
1005 typedef struct _CERT_OTHER_NAME {
1006 LPSTR pszObjId;
1007 CRYPT_OBJID_BLOB Value;
1008 } CERT_OTHER_NAME, *PCERT_OTHER_NAME;
1009
1010 typedef struct _CERT_ALT_NAME_ENTRY {
1011 DWORD dwAltNameChoice;
1012 union {
1013 PCERT_OTHER_NAME pOtherName;
1014 LPWSTR pwszRfc822Name;
1015 LPWSTR pwszDNSName;
1016 CERT_NAME_BLOB DirectoryName;
1017 LPWSTR pwszURL;
1018 CRYPT_DATA_BLOB IPAddress;
1019 LPSTR pszRegisteredID;
1020 } DUMMYUNIONNAME;
1021 } CERT_ALT_NAME_ENTRY, *PCERT_ALT_NAME_ENTRY;
1022
1023 #define CERT_ALT_NAME_OTHER_NAME 1
1024 #define CERT_ALT_NAME_RFC822_NAME 2
1025 #define CERT_ALT_NAME_DNS_NAME 3
1026 #define CERT_ALT_NAME_X400_ADDRESS 4
1027 #define CERT_ALT_NAME_DIRECTORY_NAME 5
1028 #define CERT_ALT_NAME_EDI_PARTY_NAME 6
1029 #define CERT_ALT_NAME_URL 7
1030 #define CERT_ALT_NAME_IP_ADDRESS 8
1031 #define CERT_ALT_NAME_REGISTERED_ID 9
1032
1033 typedef struct _CERT_ALT_NAME_INFO {
1034 DWORD cAltEntry;
1035 PCERT_ALT_NAME_ENTRY rgAltEntry;
1036 } CERT_ALT_NAME_INFO, *PCERT_ALT_NAME_INFO;
1037
1038 /* Encode/decode object */
1039 typedef LPVOID (WINAPI *PFN_CRYPT_ALLOC)(size_t cbsize);
1040 typedef VOID (WINAPI *PFN_CRYPT_FREE)(LPVOID pv);
1041
1042 typedef struct _CRYPT_DECODE_PARA {
1043 DWORD cbSize;
1044 PFN_CRYPT_ALLOC pfnAlloc;
1045 PFN_CRYPT_FREE pfnFree;
1046 } CRYPT_DECODE_PARA, *PCRYPT_DECODE_PARA;
1047 typedef struct _CRYPT_SEQUENCE_OF_ANY {
1048 DWORD cValue;
1049 PCRYPT_DER_BLOB rgValue;
1050 } CRYPT_SEQUENCE_OF_ANY, *PCRYPT_SEQUENCE_OF_ANY;
1051 typedef struct _CERT_TRUST_STATUS {
1052 DWORD dwErrorStatus;
1053 DWORD dwInfoStatus;
1054 } CERT_TRUST_STATUS, *PCERT_TRUST_STATUS;
1055 typedef struct _CRL_ENTRY {
1056 CRYPT_INTEGER_BLOB SerialNumber;
1057 FILETIME RevocationDate;
1058 DWORD cExtension;
1059 PCERT_EXTENSION rgExtension;
1060 } CRL_ENTRY, *PCRL_ENTRY;
1061 typedef struct _CRL_INFO {
1062 DWORD dwVersion;
1063 CRYPT_ALGORITHM_IDENTIFIER SignatureAlgorithm;
1064 CERT_NAME_BLOB Issuer;
1065 FILETIME ThisUpdate;
1066 FILETIME NextUpdate;
1067 DWORD cCRLEntry;
1068 PCRL_ENTRY rgCRLEntry;
1069 DWORD cExtension;
1070 PCERT_EXTENSION rgExtension;
1071 } CRL_INFO, *PCRL_INFO;
1072 typedef struct _CRL_CONTEXT {
1073 DWORD dwCertEncodingType;
1074 BYTE* pbCrlEncoded;
1075 DWORD cbCrlEncoded;
1076 PCRL_INFO pCrlInfo;
1077 HCERTSTORE hCertStore;
1078 } CRL_CONTEXT, *PCRL_CONTEXT;
1079 typedef const CRL_CONTEXT *PCCRL_CONTEXT;
1080 typedef struct _CERT_REVOCATION_CRL_INFO {
1081 DWORD cbSize;
1082 PCCRL_CONTEXT pBaseCRLContext;
1083 PCCRL_CONTEXT pDeltaCRLContext;
1084 PCRL_ENTRY pCrlEntry;
1085 BOOL fDeltaCrlEntry;
1086 } CERT_REVOCATION_CRL_INFO, *PCERT_REVOCATION_CRL_INFO;
1087 typedef struct _CERT_REVOCATION_INFO {
1088 DWORD cbSize;
1089 DWORD dwRevocationResult;
1090 LPCSTR pszRevocationOid;
1091 LPVOID pvOidSpecificInfo;
1092 BOOL fHasFreshnessTime;
1093 DWORD dwFreshnessTime;
1094 PCERT_REVOCATION_CRL_INFO pCrlInfo;
1095 } CERT_REVOCATION_INFO, *PCERT_REVOCATION_INFO;
1096 /* #if (_WIN32_WINNT>=0x500) */
1097 typedef struct _CERT_CHAIN_ELEMENT {
1098 DWORD cbSize;
1099 PCCERT_CONTEXT pCertContext;
1100 CERT_TRUST_STATUS TrustStatus;
1101 PCERT_REVOCATION_INFO pRevocationInfo;
1102 PCERT_ENHKEY_USAGE pIssuanceUsage;
1103 PCERT_ENHKEY_USAGE pApplicationUsage;
1104 } CERT_CHAIN_ELEMENT, *PCERT_CHAIN_ELEMENT;
1105 /* #endif */
1106 typedef struct _CRYPT_ATTRIBUTE {
1107 LPSTR pszObjId;
1108 DWORD cValue;
1109 PCRYPT_ATTR_BLOB rgValue;
1110 } CRYPT_ATTRIBUTE, *PCRYPT_ATTRIBUTE;
1111 typedef struct _CTL_ENTRY {
1112 CRYPT_DATA_BLOB SubjectIdentifier;
1113 DWORD cAttribute;
1114 PCRYPT_ATTRIBUTE rgAttribute;
1115 } CTL_ENTRY, *PCTL_ENTRY;
1116 typedef struct _CTL_INFO {
1117 DWORD dwVersion;
1118 CTL_USAGE SubjectUsage;
1119 CRYPT_DATA_BLOB ListIdentifier;
1120 CRYPT_INTEGER_BLOB SequenceNumber;
1121 FILETIME ThisUpdate;
1122 FILETIME NextUpdate;
1123 CRYPT_ALGORITHM_IDENTIFIER SubjectAlgorithm;
1124 DWORD cCTLEntry;
1125 PCTL_ENTRY rgCTLEntry;
1126 DWORD cExtension;
1127 PCERT_EXTENSION rgExtension;
1128 } CTL_INFO, *PCTL_INFO;
1129 typedef struct _CTL_CONTEXT {
1130 DWORD dwMsgAndCertEncodingType;
1131 BYTE* pbCtlEncoded;
1132 DWORD cbCtlEncoded;
1133 PCTL_INFO pCtlInfo;
1134 HCERTSTORE hCertStore;
1135 HCRYPTMSG hCryptMsg;
1136 BYTE* pbCtlContent;
1137 DWORD cbCtlContent;
1138 } CTL_CONTEXT, *PCTL_CONTEXT;
1139 typedef const CTL_CONTEXT *PCCTL_CONTEXT;
1140 typedef struct _CERT_TRUST_LIST_INFO {
1141 DWORD cbSize;
1142 PCTL_ENTRY pCtlEntry;
1143 PCCTL_CONTEXT pCtlContext;
1144 } CERT_TRUST_LIST_INFO, *PCERT_TRUST_LIST_INFO;
1145 typedef struct _CERT_SIMPLE_CHAIN {
1146 DWORD cbSize;
1147 CERT_TRUST_STATUS TrustStatus;
1148 DWORD cElement;
1149 PCERT_CHAIN_ELEMENT* rgpElement;
1150 PCERT_TRUST_LIST_INFO pTrustListInfo;
1151 BOOL fHasRevocationFreshnessTime;
1152 DWORD dwRevocationFreshnessTime;
1153 } CERT_SIMPLE_CHAIN, *PCERT_SIMPLE_CHAIN;
1154 /* #if (_WIN32_WINNT>=0x500) */
1155 typedef const struct _CERT_CHAIN_CONTEXT* PCCERT_CHAIN_CONTEXT;
1156 typedef struct _CERT_CHAIN_CONTEXT {
1157 DWORD cbSize;
1158 CERT_TRUST_STATUS TrustStatus;
1159 DWORD cChain;
1160 PCERT_SIMPLE_CHAIN* rgpChain;
1161 DWORD cLowerQualityChainContext;
1162 PCCERT_CHAIN_CONTEXT* rgpLowerQualityChainContext;
1163 BOOL fHasRevocationFreshnessTime;
1164 DWORD dwRevocationFreshnessTime;
1165 } CERT_CHAIN_CONTEXT, *PCERT_CHAIN_CONTEXT;
1166 /* #endif */
1167 typedef struct _PROV_ENUMALGS {
1168 ALG_ID aiAlgid;
1169 DWORD dwBitLen;
1170 DWORD dwNameLen;
1171 CHAR szName[20];
1172 } PROV_ENUMALGS;
1173 typedef struct _RSAPUBKEY {
1174 DWORD magic;
1175 DWORD bitlen;
1176 DWORD pubexp;
1177 } RSAPUBKEY;
1178 typedef struct _CRYPTPROTECT_PROMPTSTRUCT{
1179 DWORD cbSize;
1180 DWORD dwPromptFlags;
1181 HWND hwndApp;
1182 LPCWSTR szPrompt;
1183 } CRYPTPROTECT_PROMPTSTRUCT, *PCRYPTPROTECT_PROMPTSTRUCT;
1184
1185
1186 /* crypt32.dll functions */
1187 LPVOID WINAPI CryptMemAlloc(ULONG cbSize);
1188 LPVOID WINAPI CryptMemRealloc(LPVOID pv, ULONG cbSize);
1189 VOID WINAPI CryptMemFree(LPVOID pv);
1190
1191
1192 BOOL WINAPI CertCloseStore(HCERTSTORE,DWORD);
1193 BOOL WINAPI CertGetCertificateChain(HCERTCHAINENGINE,PCCERT_CONTEXT,LPFILETIME,HCERTSTORE,PCERT_CHAIN_PARA,DWORD,LPVOID,PCCERT_CHAIN_CONTEXT*);
1194 BOOL WINAPI CertVerifyCertificateChainPolicy(LPCSTR,PCCERT_CHAIN_CONTEXT,PCERT_CHAIN_POLICY_PARA,PCERT_CHAIN_POLICY_STATUS);
1195 void WINAPI CertFreeCertificateChain(PCCERT_CHAIN_CONTEXT);
1196 DWORD WINAPI CertNameToStrA(DWORD,PCERT_NAME_BLOB,DWORD,LPSTR,DWORD);
1197 DWORD WINAPI CertNameToStrW(DWORD,PCERT_NAME_BLOB,DWORD,LPWSTR,DWORD);
1198 HCERTSTORE WINAPI CertOpenSystemStoreA(HCRYPTPROV,LPCSTR);
1199 HCERTSTORE WINAPI CertOpenSystemStoreW(HCRYPTPROV,LPCWSTR);
1200 HCERTSTORE WINAPI CertOpenStore(LPCSTR,DWORD,HCRYPTPROV,DWORD,const void*);
1201 PCCERT_CONTEXT WINAPI CertFindCertificateInStore(HCERTSTORE,DWORD,DWORD,DWORD,const void*,PCCERT_CONTEXT);
1202 BOOL WINAPI CertFreeCertificateContext(PCCERT_CONTEXT);
1203 PCCERT_CONTEXT WINAPI CertGetIssuerCertificateFromStore(HCERTSTORE,PCCERT_CONTEXT,PCCERT_CONTEXT,DWORD*);
1204 PCCERT_CHAIN_CONTEXT WINAPI CertFindChainInStore(HCERTSTORE,DWORD,DWORD,DWORD,const void*,PCCERT_CHAIN_CONTEXT);
1205 BOOL WINAPI CryptAcquireContextA(HCRYPTPROV*,LPCSTR,LPCSTR,DWORD,DWORD);
1206 BOOL WINAPI CryptAcquireContextW(HCRYPTPROV*,LPCWSTR,LPCWSTR,DWORD,DWORD);
1207 BOOL WINAPI CryptContextAddRef(HCRYPTPROV,DWORD*,DWORD);
1208 BOOL WINAPI CryptReleaseContext(HCRYPTPROV,DWORD);
1209 BOOL WINAPI CryptGenKey(HCRYPTPROV,ALG_ID,DWORD,HCRYPTKEY*);
1210 BOOL WINAPI CryptDeriveKey(HCRYPTPROV,ALG_ID,HCRYPTHASH,DWORD,HCRYPTKEY*);
1211 BOOL WINAPI CryptDestroyKey(HCRYPTKEY);
1212 #if (WINVER >= 0x0500)
1213 BOOL WINAPI CryptDuplicateHash(HCRYPTHASH,DWORD*,DWORD,HCRYPTHASH*);
1214 BOOL WINAPI CryptDuplicateKey(HCRYPTKEY,DWORD*,DWORD,HCRYPTKEY*);
1215 #endif
1216
1217 BOOL WINAPI CryptExportKey (HCRYPTKEY hKey, HCRYPTKEY hExpKey, DWORD dwBlobType, DWORD dwFlags, BYTE *pbData, DWORD *pdwDataLen);
1218
1219 BOOL WINAPI CryptExportPublicKeyInfo(HCRYPTPROV hCryptProv, DWORD dwKeySpec, DWORD dwCertEncodingType, PCERT_PUBLIC_KEY_INFO pInfo, DWORD *pcbInfo);
1220 BOOL WINAPI CryptExportPublicKeyInfoEx(HCRYPTPROV hCryptProv, DWORD dwKeySpec, DWORD dwCertEncodingType, LPSTR pszPublicKeyObjId, DWORD dwFlags, void *pvAuxInfo, PCERT_PUBLIC_KEY_INFO pInfo, DWORD *pcbInfo);
1221 BOOL WINAPI CryptImportPublicKeyInfo(HCRYPTPROV hCryptProv, DWORD dwCertEncodingType, PCERT_PUBLIC_KEY_INFO pInfo, HCRYPTKEY *phKey);
1222 BOOL WINAPI CryptImportPublicKeyInfoEx(HCRYPTPROV hCryptProv, DWORD dwCertEncodingType, PCERT_PUBLIC_KEY_INFO pInfo, ALG_ID aiKeyAlg, DWORD dwFlags, void *pvAuxInfo, HCRYPTKEY *phKey);
1223
1224 BOOL WINAPI CryptProtectData( DATA_BLOB* pDataIn, LPCWSTR szDataDescr, DATA_BLOB* pOptionalEntropy, PVOID pvReserved, CRYPTPROTECT_PROMPTSTRUCT* pPromptStruct, DWORD dwFlags, DATA_BLOB* pDataOut );
1225 BOOL WINAPI CryptUnprotectData( DATA_BLOB* pDataIn, LPWSTR* ppszDataDescr, DATA_BLOB* pOptionalEntropy, PVOID pvReserved, CRYPTPROTECT_PROMPTSTRUCT* pPromptStruct, DWORD dwFlags, DATA_BLOB* pDataOut );
1226
1227 BOOL WINAPI CryptSetKeyParam(HCRYPTKEY,DWORD,PBYTE,DWORD);
1228 BOOL WINAPI CryptGetKeyParam(HCRYPTKEY,DWORD,PBYTE,PDWORD,DWORD);
1229 BOOL WINAPI CryptSetHashParam(HCRYPTHASH,DWORD,PBYTE,DWORD);
1230 BOOL WINAPI CryptGetHashParam(HCRYPTHASH,DWORD,PBYTE,PDWORD,DWORD);
1231 BOOL WINAPI CryptSetProvParam(HCRYPTPROV,DWORD,PBYTE,DWORD);
1232 BOOL WINAPI CryptGetProvParam(HCRYPTPROV,DWORD,PBYTE,PDWORD,DWORD);
1233 BOOL WINAPI CryptGenRandom(HCRYPTPROV,DWORD,PBYTE);
1234 BOOL WINAPI CryptGetUserKey(HCRYPTPROV,DWORD,HCRYPTKEY*);
1235 BOOL WINAPI CryptExportKey(HCRYPTKEY,HCRYPTKEY,DWORD,DWORD,PBYTE,PDWORD);
1236 BOOL WINAPI CryptImportKey(HCRYPTPROV,PBYTE,DWORD,HCRYPTKEY,DWORD,HCRYPTKEY*);
1237 BOOL WINAPI CryptEncrypt(HCRYPTKEY,HCRYPTHASH,BOOL,DWORD,PBYTE,PDWORD,DWORD);
1238 BOOL WINAPI CryptDecrypt(HCRYPTKEY,HCRYPTHASH,BOOL,DWORD,PBYTE,PDWORD);
1239 BOOL WINAPI CryptCreateHash(HCRYPTPROV,ALG_ID,HCRYPTKEY,DWORD,HCRYPTHASH*);
1240 BOOL WINAPI CryptHashData (HCRYPTHASH hHash, const BYTE *pbData, DWORD dwDataLen, DWORD dwFlags);
1241 BOOL WINAPI CryptHashSessionKey(HCRYPTHASH,HCRYPTKEY,DWORD);
1242 BOOL WINAPI CryptGetHashValue(HCRYPTHASH,DWORD,PBYTE,PDWORD);
1243 BOOL WINAPI CryptDestroyHash(HCRYPTHASH);
1244 BOOL WINAPI CryptSignHashA(HCRYPTHASH,DWORD,LPCSTR,DWORD,PBYTE,PDWORD);
1245 BOOL WINAPI CryptSignHashW(HCRYPTHASH,DWORD,LPCWSTR,DWORD,PBYTE,PDWORD);
1246 BOOL WINAPI CryptVerifySignatureA(HCRYPTHASH,PBYTE,DWORD,HCRYPTKEY,LPCSTR,DWORD);
1247 BOOL WINAPI CryptVerifySignatureW(HCRYPTHASH,PBYTE,DWORD,HCRYPTKEY,LPCWSTR,DWORD);
1248 BOOL WINAPI CryptSetProviderA(LPCSTR,DWORD);
1249 BOOL WINAPI CryptSetProviderW(LPCWSTR,DWORD);
1250 BOOL WINAPI CryptSetProviderExA(LPCSTR,DWORD,DWORD*,DWORD);
1251 BOOL WINAPI CryptSetProviderExW(LPCWSTR,DWORD,DWORD*,DWORD);
1252 #ifdef UNICODE
1253 #define CertNameToStr CertNameToStrW
1254 #define CryptAcquireContext CryptAcquireContextW
1255 #define CryptSignHash CryptSignHashW
1256 #define CryptVerifySignature CryptVerifySignatureW
1257 #define CryptSetProvider CryptSetProviderW
1258 #define CertOpenSystemStore CertOpenSystemStoreW
1259 #define CERT_FIND_SUBJECT_STR CERT_FIND_SUBJECT_STR_W
1260 #define CERT_FIND_ISSUER_STR CERT_FIND_ISSUER_STR_W
1261 #define MS_DEF_PROV MS_DEF_PROV_W
1262 #define MS_ENHANCED_PROV MS_ENHANCED_PROV_W
1263 #define MS_STRONG_PROV MS_STRONG_PROV_W
1264 #define MS_DEF_RSA_SIG_PROV MS_DEF_RSA_SIG_PROV_W
1265 #define MS_DEF_RSA_SCHANNEL_PROV MS_DEF_RSA_SCHANNEL_PROV_W
1266 #define MS_DEF_DSS_PROV MS_DEF_DSS_PROV_W
1267 #define MS_DEF_DSS_DH_PROV MS_DEF_DSS_DH_PROV_W
1268 #define MS_ENH_DSS_DH_PROV MS_ENH_DSS_DH_PROV_W
1269 #define MS_DEF_DH_SCHANNEL_PROV MS_DEF_DH_SCHANNEL_PROV_W
1270 #define MS_SCARD_PROV MS_SCARD_PROV_W
1271 #else
1272 #define CertNameToStr CertNameToStrA
1273 #define CryptAcquireContext CryptAcquireContextA
1274 #define CryptSignHash CryptSignHashA
1275 #define CryptVerifySignature CryptVerifySignatureA
1276 #define CryptSetProvider CryptSetProviderA
1277 #define CertOpenSystemStore CertOpenSystemStoreA
1278 #define CERT_FIND_SUBJECT_STR CERT_FIND_SUBJECT_STR_A
1279 #define CERT_FIND_ISSUER_STR CERT_FIND_ISSUER_STR_A
1280 #define MS_DEF_PROV MS_DEF_PROV_A
1281 #define MS_ENHANCED_PROV MS_ENHANCED_PROV_A
1282 #define MS_STRONG_PROV MS_STRONG_PROV_A
1283 #define MS_DEF_RSA_SIG_PROV MS_DEF_RSA_SIG_PROV_A
1284 #define MS_DEF_RSA_SCHANNEL_PROV MS_DEF_RSA_SCHANNEL_PROV_A
1285 #define MS_DEF_DSS_PROV MS_DEF_DSS_PROV_A
1286 #define MS_DEF_DSS_DH_PROV MS_DEF_DSS_DH_PROV_A
1287 #define MS_ENH_DSS_DH_PROV MS_ENH_DSS_DH_PROV_A
1288 #define MS_DEF_DH_SCHANNEL_PROV MS_DEF_DH_SCHANNEL_PROV_A
1289 #define MS_SCARD_PROV MS_SCARD_PROV_A
1290 #endif
1291 #ifdef __cplusplus
1292 }
1293 #endif
1294 #endif /* _WINCRYPT_H */