Make sure sed uses the right locale.
[wine.git] / include / wincrypt.h
blob710ed165b0b2a9d784d5f4b09eda11045f2a8fcc
1 /*
2 * Copyright (C) 2002 Travis Michielsen
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #ifndef __WINE_WINCRYPT_H
20 #define __WINE_WINCRYPT_H
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
26 /* some typedefs for function parameters */
27 typedef unsigned int ALG_ID;
28 typedef unsigned long HCRYPTPROV;
29 typedef unsigned long HCRYPTKEY;
30 typedef unsigned long HCRYPTHASH;
31 typedef void *HCERTSTORE;
33 /* CSP Structs */
35 typedef struct _CRYPTOAPI_BLOB {
36 DWORD cbData;
37 BYTE* pbData;
38 } CRYPT_INTEGER_BLOB, *PCRYPT_INTEGER_BLOB,
39 CRYPT_UINT_BLOB, *PCRYPT_UINT_BLOB,
40 CRYPT_OBJID_BLOB, *PCRYPT_OBJID_BLOB,
41 CERT_NAME_BLOB, *PCERT_NAME_BLOB,
42 CERT_RDN_VALUE_BLOB, *PCERT_RDN_VALUE_BLOB,
43 CERT_BLOB, *PCERT_BLOB,
44 CRL_BLOB, *PCRL_BLOB,
45 DATA_BLOB, *PDATA_BLOB,
46 CRYPT_DATA_BLOB, *PCRYPT_DATA_BLOB,
47 CRYPT_HASH_BLOB, *PCRYPT_HASH_BLOB,
48 CRYPT_DIGEST_BLOB, *PCRYPT_DIGEST_BLOB,
49 CRYPT_DER_BLOB, *PCRYPT_DER_BLOB,
50 CRYPT_ATTR_BLOB, *PCRYPT_ATTR_BLOB;
52 typedef struct _CRYPTPROTECT_PROMPTSTRUCT{
53 DWORD cbSize;
54 DWORD dwPromptFlags;
55 HWND hwndApp;
56 LPCWSTR szPrompt;
57 } CRYPTPROTECT_PROMPTSTRUCT, *PCRYPTPROTECT_PROMPTSTRUCT;
59 typedef struct _CRYPT_ALGORITHM_IDENTIFIER {
60 LPSTR pszObjId;
61 CRYPT_OBJID_BLOB Parameters;
62 } CRYPT_ALGORITHM_IDENTIFIER, *PCRYPT_ALGORITHM_IDENTIFIER;
64 typedef struct _CRYPT_ATTRIBUTE_TYPE_VALUE {
65 LPSTR pszObjId;
66 CRYPT_OBJID_BLOB Value;
67 } CRYPT_ATTRIBUTE_TYPE_VALUE, *PCRYPT_ATTRIBUTE_TYPE_VALUE;
69 typedef struct _PUBLICKEYSTRUC {
70 BYTE bType;
71 BYTE bVersion;
72 WORD reserved;
73 ALG_ID aiKeyAlg;
74 } BLOBHEADER, PUBLICKEYSTRUC;
76 typedef struct _CRYPT_BIT_BLOB {
77 DWORD cbData;
78 BYTE *pbData;
79 DWORD cUnusedBits;
80 } CRYPT_BIT_BLOB, *PCRYPT_BIT_BLOB;
82 typedef struct _CERT_PUBLIC_KEY_INFO {
83 CRYPT_ALGORITHM_IDENTIFIER Algorithm;
84 CRYPT_BIT_BLOB PublicKey;
85 } CERT_PUBLIC_KEY_INFO, *PCERT_PUBLIC_KEY_INFO;
87 typedef struct _CERT_EXTENSION {
88 LPSTR pszObjId;
89 BOOL fCritical;
90 CRYPT_OBJID_BLOB Value;
91 } CERT_EXTENSION, *PCERT_EXTENSION;
93 typedef struct _CERT_INFO {
94 DWORD dwVersion;
95 CRYPT_INTEGER_BLOB SerialNumber;
96 CRYPT_ALGORITHM_IDENTIFIER SignatureAlgorithm;
97 CERT_NAME_BLOB Issuer;
98 FILETIME NotBefore;
99 FILETIME NotAfter;
100 CERT_NAME_BLOB Subject;
101 CERT_PUBLIC_KEY_INFO SubjectPublicKeyInfo;
102 CRYPT_BIT_BLOB IssuerUniqueId;
103 CRYPT_BIT_BLOB SubjectUniqueId;
104 DWORD cExtension;
105 PCERT_EXTENSION rgExtension;
106 } CERT_INFO, *PCERT_INFO;
108 typedef struct _CERT_CONTEXT {
109 DWORD dwCertEncodingType;
110 BYTE *pbCertEncoded;
111 DWORD cbCertEncoded;
112 PCERT_INFO pCertInfo;
113 HCERTSTORE hCertStore;
114 } CERT_CONTEXT, *PCERT_CONTEXT;
115 typedef const CERT_CONTEXT *PCCERT_CONTEXT;
117 typedef struct _CRL_ENTRY {
118 CRYPT_INTEGER_BLOB SerialNumber;
119 FILETIME RevocationDate;
120 DWORD cExtension;
121 PCERT_EXTENSION rgExtension;
122 } CRL_ENTRY, *PCRL_ENTRY;
124 typedef struct _CRL_INFO {
125 DWORD dwVersion;
126 CRYPT_ALGORITHM_IDENTIFIER SignatureAlgorithm;
127 CERT_NAME_BLOB Issuer;
128 FILETIME ThisUpdate;
129 FILETIME NextUpdate;
130 DWORD cCRLEntry;
131 PCRL_ENTRY rgCRLEntry;
132 DWORD cExtension;
133 PCERT_EXTENSION rgExtension;
134 } CRL_INFO, *PCRL_INFO;
136 typedef struct _CRL_CONTEXT {
137 DWORD dwCertEncodingType;
138 BYTE *pbCrlEncoded;
139 DWORD cbCrlEncoded;
140 PCRL_INFO pCrlInfo;
141 HCERTSTORE hCertStore;
142 } CRL_CONTEXT, *PCRL_CONTEXT;
143 typedef const CRL_CONTEXT *PCCRL_CONTEXT;
145 typedef struct _VTableProvStruc {
146 DWORD Version;
147 FARPROC pFuncVerifyImage;
148 FARPROC pFuncReturnhWnd;
149 DWORD dwProvType;
150 BYTE *pbContextInfo;
151 DWORD cbContextInfo;
152 LPSTR pszProvName;
153 } VTableProvStruc, *PVTableProvStruc;
155 /* Algorithm IDs */
157 #define GET_ALG_CLASS(x) (x & (7 << 13))
158 #define GET_ALG_TYPE(x) (x & (15 << 9))
159 #define GET_ALG_SID(x) (x & (511))
161 /* Algorithm Classes */
162 #define ALG_CLASS_ANY (0)
163 #define ALG_CLASS_SIGNATURE (1 << 13)
164 #define ALG_CLASS_MSG_ENCRYPT (2 << 13)
165 #define ALG_CLASS_DATA_ENCRYPT (3 << 13)
166 #define ALG_CLASS_HASH (4 << 13)
167 #define ALG_CLASS_KEY_EXCHANGE (5 << 13)
168 /* Algorithm types */
169 #define ALG_TYPE_ANY (0)
170 #define ALG_TYPE_DSS (1 << 9)
171 #define ALG_TYPE_RSA (2 << 9)
172 #define ALG_TYPE_BLOCK (3 << 9)
173 #define ALG_TYPE_STREAM (4 << 9)
175 /* SIDs */
176 #define ALG_SID_ANY (0)
177 /* RSA SIDs */
178 #define ALG_SID_RSA_ANY 0
179 #define ALG_SID_RSA_PKCS 1
180 #define ALG_SID_RSA_MSATWORK 2
181 #define ALG_SID_RSA_ENTRUST 3
182 #define ALG_SID_RSA_PGP 4
183 /* DSS SIDs */
184 #define ALG_SID_DSS_ANY 0
185 #define ALG_SID_DSS_PKCS 1
186 #define ALG_SID_DSS_DMS 2
188 /* DES SIDs */
189 #define ALG_SID_DES 1
190 #define ALG_SID_3DES 3
191 #define ALG_SID_DESX 4
192 #define ALG_SID_IDEA 5
193 #define ALG_SID_CAST 6
194 #define ALG_SID_SAFERSK64 7
195 #define ALD_SID_SAFERSK128 8
196 /* RC2 SIDs */
197 #define ALG_SID_RC4 1
198 #define ALG_SID_RC2 2
199 #define ALG_SID_SEAL 2
200 /* Hash SIDs */
201 #define ALG_SID_MD2 1
202 #define ALG_SID_MD4 2
203 #define ALG_SID_MD5 3
204 #define ALG_SID_SHA 4
205 #define ALG_SID_MAC 5
206 #define ALG_SID_RIPEMD 6
207 #define ALG_SID_RIPEMD160 7
208 #define ALG_SID_SSL3SHAMD5 8
210 /* Algorithm Definitions */
211 #define CALG_MD2 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MD2)
212 #define CALG_MD4 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MD4)
213 #define CALG_MD5 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MD5)
214 #define CALG_SHA (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA)
215 #define CALG_MAC (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MAC)
216 #define CALG_RSA_SIGN (ALG_CLASS_SIGNATURE | ALG_TYPE_RSA | ALG_SID_RSA_ANY)
217 #define CALG_DSS_SIGN (ALG_CLASS_SIGNATURE | ALG_TYPE_DSS | ALG_SID_DSS_ANY)
218 #define CALG_RSA_KEYX (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_RSA | ALG_SID_RSA_ANY)
219 #define CALG_DES (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_DES)
220 #define CALG_RC2 (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_RC2)
221 #define CALG_RC4 (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_STREAM | ALG_SID_RC4)
222 #define CALG_SEAL (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_STREAM | ALG_SID_SEAL)
224 /* Provider names */
225 #define MS_DEF_PROV_A "Microsoft Base Cryptographic Provider v1.0"
226 #if defined(__GNUC__)
227 # define MS_DEF_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
228 'B','a','s','e',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ', \
229 'P','r','o','v','i','d','e','r',' ','v','1','.','0',0 }
230 #elif defined(_MSC_VER)
231 # define MS_DEF_PROV_W L"Microsoft Base Cryptographic Provider v1.0"
232 #else
233 static const WCHAR MS_DEF_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
234 'B','a','s','e',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ',
235 'P','r','o','v','i','d','e','r',' ','v','1','.','0',0 };
236 #endif
237 #define MS_DEF_PROV WINELIB_NAME_AW(MS_DEF_PROV_)
239 #define MS_ENHANCED_PROV_A "Microsoft Enhanced Cryptographic Provider v1.0"
240 #if defined(__GNUC__)
241 # define MS_ENHANCED_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
242 'E','n','h','a','n','c','e','d',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ', \
243 'P','r','o','v','i','d','e','r',' ','v','1','.','0',0 }
244 #elif defined(_MSC_VER)
245 # define MS_ENHANCED_PROV_W L"Microsoft Enhanced Cryptographic Provider v1.0"
246 #else
247 static const WCHAR MS_ENHANCED_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
248 'E','n','h','a','n','c','e','d',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ',
249 'P','r','o','v','i','d','e','r',' ','v','1','.','0',0 };
250 #endif
251 #define MS_ENHANCED_PROV WINELIB_NAME_AW(MS_ENHANCED_PROV_)
253 #define MS_STRONG_PROV_A "Microsoft Strong Cryptographic Provider"
254 #if defined(__GNUC__)
255 # define MS_STRONG_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
256 'S','t','r','o','n','g',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ', \
257 'P','r','o','v','i','d','e','r',0 }
258 #elif defined(_MSC_VER)
259 # define MS_STRONG_PROV_W L"Microsoft Strong Cryptographic Provider"
260 #else
261 static const WCHAR MS_STRONG_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
262 'S','t','r','o','n','g',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ',
263 'P','r','o','v','i','d','e','r',0 };
264 #endif
265 #define MS_STRONG_PROV WINELIB_NAME_AW(MS_STRONG_PROV_)
267 #define MS_DEF_RSA_SIG_PROV_A "Microsoft RSA Signature Cryptographic Provider"
268 #if defined(__GNUC__)
269 # define MS_DEF_RSA_SIG_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
270 'R','S','A',' ','S','i','g','n','a','t','u','r','e',' ', \
271 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
272 #elif defined(_MSC_VER)
273 # define MS_DEF_RSA_SIG_PROV_W L"Microsoft RSA Signature Cryptographic Provider"
274 #else
275 static const WCHAR MS_DEF_RSA_SIG_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
276 'R','S','A',' ','S','i','g','n','a','t','u','r','e',' ',
277 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
278 #endif
279 #define MS_DEF_RSA_SIG_PROV WINELIB_NAME_AW(MS_DEF_RSA_SIG_PROV_)
281 #define MS_DEF_RSA_SCHANNEL_PROV_A "Microsoft RSA SChannel Cryptographic Provider"
282 #if defined(__GNUC__)
283 # define MS_DEF_RSA_SCHANNEL_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
284 'R','S','A',' ','S','C','h','a','n','n','e','l',' ', \
285 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
286 #elif defined(_MSC_VER)
287 # define MS_DEF_RSA_SCHANNEL_PROV_W L"Microsoft RSA SChannel Cryptographic Provider"
288 #else
289 static const WCHAR MS_DEF_RSA_SCHANNEL_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
290 'R','S','A',' ','S','C','h','a','n','n','e','l',' ',
291 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
292 #endif
293 #define MS_DEF_RSA_SCHANNEL_PROV WINELIB_NAME_AW(MS_DEF_RSA_SCHANNEL_PROV_)
295 #define MS_DEF_DSS_PROV_A "Microsoft Base DSS Cryptographic Provider"
296 #if defined(__GNUC__)
297 # define MS_DEF_DSS_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
298 'B','a','s','e',' ','D','S','S',' ', \
299 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
300 #elif defined(_MSC_VER)
301 # define MS_DEF_DSS_PROV_W L"Microsoft Base DSS Cryptographic Provider"
302 #else
303 static const WCHAR MS_DEF_DSS_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
304 'B','a','s','e',' ','D','S','S',' ',
305 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
306 #endif
307 #define MS_DEF_DSS_PROV WINELIB_NAME_AW(MS_DEF_DSS_PROV_)
309 #define MS_DEF_DSS_DH_PROV_A "Microsoft Base DSS and Diffie-Hellman Cryptographic Provider"
310 #if defined(__GNUC__)
311 # define MS_DEF_DSS_DH_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
312 'B','a','s','e',' ','D','S','S',' ','a','n','d',' ', \
313 'D','i','f','f','i','e','-','H','e','l','l','m','a','n',' ', \
314 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
315 #elif defined(_MSC_VER)
316 # define MS_DEF_DSS_DH_PROV_W L"Microsoft Base DSS and Diffie-Hellman Cryptographic Provider"
317 #else
318 static const WCHAR MS_DEF_DSS_DH_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
319 'B','a','s','e',' ','D','S','S',' ','a','n','d',' ',
320 'D','i','f','f','i','e','-','H','e','l','l','m','a','n',' ',
321 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
322 #endif
323 #define MS_DEF_DSS_DH_PROV WINELIB_NAME_AW(MS_DEF_DSS_DH_PROV_)
325 #define MS_ENH_DSS_DH_PROV_A "Microsoft Enhanced DSS and Diffie-Hellman Cryptographic Provider"
326 #if defined(__GNUC__)
327 # define MS_ENH_DSS_DH_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
328 'E','n','h','a','n','c','e','d',' ','D','S','S',' ','a','n','d',' ', \
329 'D','i','f','f','i','e','-','H','e','l','l','m','a','n',' ', \
330 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
331 #elif defined(_MSC_VER)
332 # define MS_ENH_DSS_DH_PROV_W L"Microsoft Enhanced DSS and Diffie-Hellman Cryptographic Provider"
333 #else
334 static const WCHAR MS_ENH_DSS_DH_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
335 'E','n','h','a','n','c','e','d',' ','D','S','S',' ','a','n','d',' ',
336 'D','i','f','f','i','e','-','H','e','l','l','m','a','n',' ',
337 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
338 #endif
339 #define MS_ENH_DSS_DH_PROV WINELIB_NAME_AW(MS_ENH_DSS_DH_PROV_)
341 #define MS_DEF_DH_SCHANNEL_PROV_A "Microsoft DH SChannel Cryptographic Provider"
342 #if defined(__GNUC__)
343 # define MS_DEF_DH_SCHANNEL_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
344 'D','H',' ','S','C','h','a','n','n','e','l',' ', \
345 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
346 #elif defined(_MSC_VER)
347 # define MS_DEF_DH_SCHANNEL_PROV_W L"Microsoft DH SChannel Cryptographic Provider"
348 #else
349 static const WCHAR MS_DEF_DH_SCHANNEL_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
350 'D','H',' ','S','C','h','a','n','n','e','l',' ',
351 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
352 #endif
353 #define MS_DEF_DH_SCHANNEL_PROV WINELIB_NAME_AW(MS_DEF_DH_SCHANNEL_PROV_)
355 #define MS_SCARD_PROV_A "Microsoft Base Smart Card Cryptographic Provider"
356 #if defined(__GNUC__)
357 # define MS_SCARD_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
358 'B','a','s','e',' ','S','m','a','r','t',' ','C','a','r','d',' ', \
359 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
360 #elif defined(_MSC_VER)
361 # define MS_SCARD_PROV_W L"Microsoft Base Smart Card Cryptographic Provider"
362 #else
363 static const WCHAR MS_SCARD_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
364 'B','a','s','e',' ','S','m','a','r','t',' ','C','a','r','d',' ',
365 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
366 #endif
367 #define MS_SCARD_PROV WINELIB_NAME_AW(MS_SCARD_PROV_)
369 /* Key Specs*/
370 #define AT_KEYEXCHANGE 1
371 #define AT_SIGNATURE 2
373 /* Provider Types */
374 #define PROV_RSA_FULL 1
375 #define PROV_RSA_SIG 2
376 #define PROV_DSS 3
377 #define PROV_FORTEZZA 4
378 #define PROV_MS_EXCHANGE 5
379 #define PROV_SSL 6
380 #define PROV_RSA_SCHANNEL 12
381 #define PROV_DSS_DH 13
382 #define PROV_EC_ECDSA_SIG 14
383 #define PROV_EC_ECNRA_SIG 15
384 #define PROV_EC_ECDSA_FULL 16
385 #define PROV_EC_ECNRA_FULL 17
386 #define PROV_DH_SCHANNEL 18
387 #define PROV_SPYRUS_LYNKS 20
388 #define PROV_RNG 21
389 #define PROV_INTEL_SEC 22
390 #define PROV_REPLACE_OWF 23
391 #define PROV_RSA_AES 24
393 /* FLAGS Section */
395 /* Provider Parameters */
396 #define PP_ENUMALGS 1
397 #define PP_ENUMCONTAINERS 2
398 #define PP_IMPTYPE 3
399 #define PP_NAME 4
400 #define PP_VERSION 5
401 #define PP_CONTAINER 6
403 #define CRYPT_FIRST 1
404 #define CRYPT_NEXT 2
406 #define CRYPT_IMPL_HARDWARE 1
407 #define CRYPT_IMPL_SOFTWARE 2
408 #define CRYPT_IMPL_MIXED 3
409 #define CRYPT_IMPL_UNKNOWN 4
411 /* CryptAcquireContext */
412 #define CRYPT_VERIFYCONTEXT 0xF0000000
413 #define CRYPT_NEWKEYSET 0x00000008
414 #define CRYPT_MACHINE_KEYSET 0x00000000
415 #define CRYPT_DELETEKEYSET 0x00000010
416 #define CRYPT_SILENT 0x00000000
418 /* Crypt{Get|Set}Provider */
419 #define CRYPT_MACHINE_DEFAULT 0x00000001
420 #define CRYPT_USER_DEFAULT 0x00000002
421 #define CRYPT_DELETE_DEFAULT 0x00000004
423 /* Crypt{Get/Set}ProvParam */
424 #define PP_CLIENT_HWND 1
425 #define PP_ENUMALGS 1
426 #define PP_ENUMCONTAINERS 2
427 #define PP_IMPTYPE 3
428 #define PP_NAME 4
429 #define PP_VERSION 5
430 #define PP_CONTAINER 6
431 #define PP_CHANGE_PASSWORD 7
432 #define PP_KEYSET_SEC_DESCR 8
433 #define PP_KEY_TYPE_SUBTYPE 10
434 #define PP_CONTEXT_INFO 11
435 #define PP_KEYEXCHANGE_KEYSIZE 12
436 #define PP_SIGNATURE_KEYSIZE 13
437 #define PP_KEYEXCHANGE_ALG 14
438 #define PP_SIGNATURE_ALG 15
439 #define PP_PROVTYPE 16
440 #define PP_KEYSTORAGE 17
441 #define PP_SYM_KEYSIZE 19
442 #define PP_SESSION_KEYSIZE 20
443 #define PP_UI_PROMPT 21
444 #define PP_ENUMALGS_EX 22
445 #define PP_DELETEKEY 24
446 #define PP_ENUMMANDROOTS 25
447 #define PP_ENUMELECTROOTS 26
448 #define PP_KEYSET_TYPE 27
449 #define PP_ADMIN_PIN 31
450 #define PP_KEYEXCHANGE_PIN 32
451 #define PP_SIGNATURE_PIN 33
452 #define PP_SIG_KEYSIZE_INC 34
453 #define PP_KEYX_KEYSIZE_INC 35
454 #define PP_UNIQUE_CONTAINER 36
455 #define PP_SGC_INFO 37
456 #define PP_USE_HARDWARE_RNG 38
457 #define PP_KEYSPEC 39
458 #define PP_ENUMEX_SIGNING_PROT 40
460 /* CryptSignHash/CryptVerifySignature */
461 #define CRYPT_NOHASHOID 0x00000001
462 #define CRYPT_TYPE2_FORMAT 0x00000002
463 #define CRYPT_X931_FORMAT 0x00000004
465 /* Crypt*Key */
466 #define CRYPT_EXPORTABLE 0x00000001
467 #define CRYPT_USER_PROTECTED 0x00000002
468 #define CRYPT_CREATE_SALT 0x00000004
469 #define CRYPT_UPDATE_KEY 0x00000008
470 #define CRYPT_NO_SALT 0x00000010
471 #define CRYPT_PREGEN 0x00000040
472 #define CRYPT_ARCHIVABLE 0x00004000
473 #define CRYPT_SSL2_FALLBACK 0x00000002
474 #define CRYPT_DESTROYKEY 0x00000004
475 #define CRYPT_OAEP 0x00000040
477 /* Blob Types */
478 #define SIMPLEBLOB 0x1
479 #define PUBLICKEYBLOB 0x6
480 #define PRIVATEKEYBLOB 0x7
481 #define PLAINTEXTKEYBLOB 0x8
482 #define OPAQUEKEYBLOB 0x9
483 #define PUBLICKEYBLOBEX 0xA
484 #define SYMMETRICWRAPKEYBLOB 0xB
486 #define CERT_STORE_PROV_MSG ((LPCSTR)1)
487 #define CERT_STORE_PROV_MEMORY ((LPCSTR)2)
488 #define CERT_STORE_PROV_FILE ((LPCSTR)3)
489 #define CERT_STORE_PROV_REG ((LPCSTR)4)
490 #define CERT_STORE_PROV_PKCS7 ((LPCSTR)5)
491 #define CERT_STORE_PROV_SERIALIZED ((LPCSTR)6)
492 #define CERT_STORE_PROV_FILENAME_A ((LPCSTR)7)
493 #define CERT_STORE_PROV_FILENAME_W ((LPCSTR)8)
494 #define CERT_STORE_PROV_SYSTEM_A ((LPCSTR)9)
495 #define CERT_STORE_PROV_SYSTEM_W ((LPCSTR)10)
497 #define X509_ASN_ENCODING 0x00000001
498 #define X509_NDR_ENCODING 0x00000002
499 #define PKCS_7_ASN_ENCODING 0x00010000
500 #define PKCS_7_NDR_ENCODING 0x00020000
502 /* function declarations */
503 /* advapi32.dll */
504 BOOL WINAPI CryptAcquireContextA(HCRYPTPROV *phProv, LPCSTR pszContainer,
505 LPCSTR pszProvider, DWORD dwProvType,
506 DWORD dwFlags);
507 BOOL WINAPI CryptAcquireContextW (HCRYPTPROV *phProv, LPCWSTR pszContainer,
508 LPCWSTR pszProvider, DWORD dwProvType, DWORD dwFlags);
509 #define CryptAcquireContext WINELIB_NAME_AW(CryptAcquireContext)
510 BOOL WINAPI CryptGenRandom (HCRYPTPROV hProv, DWORD dwLen, BYTE *pbBuffer);
511 BOOL WINAPI CryptContextAddRef (HCRYPTPROV hProv, DWORD *pdwReserved, DWORD dwFlags);
512 BOOL WINAPI CryptCreateHash (HCRYPTPROV hProv, ALG_ID Algid, HCRYPTKEY hKey,
513 DWORD dwFlags, HCRYPTHASH *phHash);
514 BOOL WINAPI CryptDecrypt (HCRYPTKEY hKey, HCRYPTHASH hHash, BOOL Final,
515 DWORD dwFlags, BYTE *pbData, DWORD *pdwDataLen);
516 BOOL WINAPI CryptDeriveKey (HCRYPTPROV hProv, ALG_ID Algid, HCRYPTHASH hBaseData,
517 DWORD dwFlags, HCRYPTKEY *phKey);
518 BOOL WINAPI CryptDestroyHash (HCRYPTHASH hHash);
519 BOOL WINAPI CryptDestroyKey (HCRYPTKEY hKey);
520 BOOL WINAPI CryptDuplicateKey (HCRYPTKEY hKey, DWORD *pdwReserved, DWORD dwFlags, HCRYPTKEY *phKey);
521 BOOL WINAPI CryptDuplicateHash (HCRYPTHASH hHash, DWORD *pdwReserved,
522 DWORD dwFlags, HCRYPTHASH *phHash);
523 BOOL WINAPI CryptEncrypt (HCRYPTKEY hKey, HCRYPTHASH hHash, BOOL Final,
524 DWORD dwFlags, BYTE *pbData, DWORD *pdwDataLen, DWORD dwBufLen);
525 BOOL WINAPI CryptEnumProvidersA (DWORD dwIndex, DWORD *pdwReserved,
526 DWORD dwFlags, DWORD *pdwProvType, LPSTR pszProvName, DWORD *pcbProvName);
527 BOOL WINAPI CryptEnumProvidersW (DWORD dwIndex, DWORD *pdwReserved,
528 DWORD dwFlags, DWORD *pdwProvType, LPWSTR pszProvName, DWORD *pcbProvName);
529 #define CryptEnumProviders WINELIB_NAME_AW(CryptEnumProviders)
530 BOOL WINAPI CryptEnumProviderTypesA (DWORD dwIndex, DWORD *pdwReserved,
531 DWORD dwFlags, DWORD *pdwProvType, LPSTR pszTypeName, DWORD *pcbTypeName);
532 BOOL WINAPI CryptEnumProviderTypesW (DWORD dwIndex, DWORD *pdwReserved,
533 DWORD dwFlags, DWORD *pdwProvType, LPWSTR pszTypeName, DWORD *pcbTypeName);
534 #define CryptEnumProviderTypes WINELIB_NAME_AW(CryptEnumProviderTypes)
535 BOOL WINAPI CryptExportKey (HCRYPTKEY hKey, HCRYPTKEY hExpKey, DWORD dwBlobType,
536 DWORD dwFlags, BYTE *pbData, DWORD *pdwDataLen);
537 BOOL WINAPI CryptGenKey (HCRYPTPROV hProv, ALG_ID Algid, DWORD dwFlags, HCRYPTKEY *phKey);
538 BOOL WINAPI CryptGetKeyParam (HCRYPTKEY hKey, DWORD dwParam, BYTE *pbData,
539 DWORD *pdwDataLen, DWORD dwFlags);
540 BOOL WINAPI CryptGetHashParam (HCRYPTHASH hHash, DWORD dwParam, BYTE *pbData,
541 DWORD *pdwDataLen, DWORD dwFlags);
542 BOOL WINAPI CryptGetProvParam (HCRYPTPROV hProv, DWORD dwParam, BYTE *pbData,
543 DWORD *pdwDataLen, DWORD dwFlags);
544 BOOL WINAPI CryptGetDefaultProviderA (DWORD dwProvType, DWORD *pdwReserved,
545 DWORD dwFlags, LPSTR pszProvName, DWORD *pcbProvName);
546 BOOL WINAPI CryptGetDefaultProviderW (DWORD dwProvType, DWORD *pdwReserved,
547 DWORD dwFlags, LPWSTR pszProvName, DWORD *pcbProvName);
548 #define CryptGetDefaultProvider WINELIB_NAME_AW(CryptGetDefaultProvider)
549 BOOL WINAPI CryptGetUserKey (HCRYPTPROV hProv, DWORD dwKeySpec, HCRYPTKEY *phUserKey);
550 BOOL WINAPI CryptHashData (HCRYPTHASH hHash, BYTE *pbData, DWORD dwDataLen, DWORD dwFlags);
551 BOOL WINAPI CryptHashSessionKey (HCRYPTHASH hHash, HCRYPTKEY hKey, DWORD dwFlags);
552 BOOL WINAPI CryptImportKey (HCRYPTPROV hProv, BYTE *pbData, DWORD dwDataLen,
553 HCRYPTKEY hPubKey, DWORD dwFlags, HCRYPTKEY *phKey);
554 BOOL WINAPI CryptRegisterOIDFunction(DWORD,LPCSTR,LPCSTR,LPCWSTR,LPCSTR);
556 BOOL WINAPI CryptReleaseContext (HCRYPTPROV hProv, DWORD dwFlags);
557 BOOL WINAPI CryptSignHashA (HCRYPTHASH hHash, DWORD dwKeySpec, LPCSTR sDescription,
558 DWORD dwFlags, BYTE *pbSignature, DWORD *pdwSigLen);
559 BOOL WINAPI CryptSignHashW (HCRYPTHASH hHash, DWORD dwKeySpec, LPCWSTR sDescription,
560 DWORD dwFlags, BYTE *pbSignature, DWORD *pdwSigLen);
561 #define CryptSignHash WINELIB_NAME_AW(CryptSignHash)
562 BOOL WINAPI CryptSetHashParam (HCRYPTHASH hHash, DWORD dwParam, BYTE *pbData, DWORD dwFlags);
563 BOOL WINAPI CryptSetKeyParam (HCRYPTKEY hKey, DWORD dwParam, BYTE *pbData, DWORD dwFlags);
564 BOOL WINAPI CryptSetProviderA (LPCSTR pszProvName, DWORD dwProvType);
565 BOOL WINAPI CryptSetProviderW (LPCWSTR pszProvName, DWORD dwProvType);
566 #define CryptSetProvider WINELIB_NAME_AW(CryptSetProvider)
567 BOOL WINAPI CryptSetProviderExA (LPCSTR pszProvName, DWORD dwProvType, DWORD *pdwReserved, DWORD dwFlags);
568 BOOL WINAPI CryptSetProviderExW (LPCWSTR pszProvName, DWORD dwProvType, DWORD *pdwReserved, DWORD dwFlags);
569 #define CryptSetProviderEx WINELIB_NAME_AW(CryptSetProviderEx)
570 BOOL WINAPI CryptSetProvParam (HCRYPTPROV hProv, DWORD dwParam, BYTE *pbData, DWORD dwFlags);
571 BOOL WINAPI CryptVerifySignatureA (HCRYPTHASH hHash, BYTE *pbSignature, DWORD dwSigLen,
572 HCRYPTKEY hPubKey, LPCSTR sDescription, DWORD dwFlags);
573 BOOL WINAPI CryptVerifySignatureW (HCRYPTHASH hHash, BYTE *pbSignature, DWORD dwSigLen,
574 HCRYPTKEY hPubKey, LPCWSTR sDescription, DWORD dwFlags);
575 #define CryptVerifySignature WINELIB_NAME_AW(CryptVerifySignature)
577 #ifdef __cplusplus
579 #endif
581 #endif