Added missing register defines for Linux/PPC.
[wine.git] / include / wincrypt.h
blob3e0206bfbabbcce5f6dd4e09424752aa73b0fe59
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 #include "windef.h"
24 /* some typedefs for function parameters */
25 typedef unsigned int ALG_ID;
26 typedef unsigned long HCRYPTPROV;
27 typedef unsigned long HCRYPTKEY;
28 typedef unsigned long HCRYPTHASH;
29 typedef void *HCERTSTORE;
31 /* CSP Structs */
33 typedef struct _CRYPTOAPI_BLOB {
34 DWORD cbData;
35 BYTE* pbData;
36 } CRYPT_INTEGER_BLOB, *PCRYPT_INTEGER_BLOB,
37 CRYPT_UINT_BLOB, *PCRYPT_UINT_BLOB,
38 CRYPT_OBJID_BLOB, *PCRYPT_OBJID_BLOB,
39 CERT_NAME_BLOB, *PCERT_NAME_BLOB,
40 CERT_RDN_VALUE_BLOB, *PCERT_RDN_VALUE_BLOB,
41 CERT_BLOB, *PCERT_BLOB,
42 CRL_BLOB, *PCRL_BLOB,
43 DATA_BLOB, *PDATA_BLOB,
44 CRYPT_DATA_BLOB, *PCRYPT_DATA_BLOB,
45 CRYPT_HASH_BLOB, *PCRYPT_HASH_BLOB,
46 CRYPT_DIGEST_BLOB, *PCRYPT_DIGEST_BLOB,
47 CRYPT_DER_BLOB, *PCRYPT_DER_BLOB,
48 CRYPT_ATTR_BLOB, *PCRYPT_ATTR_BLOB;
50 typedef struct _CRYPT_ALGORITHM_IDENTIFIER {
51 LPSTR pszObjId;
52 CRYPT_OBJID_BLOB Parameters;
53 } CRYPT_ALGORITHM_IDENTIFIER, *PCRYPT_ALGORITHM_IDENTIFIER;
55 typedef struct _CRYPT_ATTRIBUTE_TYPE_VALUE {
56 LPSTR pszObjId;
57 CRYPT_OBJID_BLOB Value;
58 } CRYPT_ATTRIBUTE_TYPE_VALUE, *PCRYPT_ATTRIBUTE_TYPE_VALUE;
60 typedef struct _PUBLICKEYSTRUC {
61 BYTE bType;
62 BYTE bVersion;
63 WORD reserved;
64 ALG_ID aiKeyAlg;
65 } BLOBHEADER, PUBLICKEYSTRUC;
67 typedef struct _CRYPT_BIT_BLOB {
68 DWORD cbData;
69 BYTE *pbData;
70 DWORD cUnusedBits;
71 } CRYPT_BIT_BLOB, *PCRYPT_BIT_BLOB;
73 typedef struct _CERT_PUBLIC_KEY_INFO {
74 CRYPT_ALGORITHM_IDENTIFIER Algorithm;
75 CRYPT_BIT_BLOB PublicKey;
76 } CERT_PUBLIC_KEY_INFO, *PCERT_PUBLIC_KEY_INFO;
78 typedef struct _CERT_EXTENSION {
79 LPSTR pszObjId;
80 BOOL fCritical;
81 CRYPT_OBJID_BLOB Value;
82 } CERT_EXTENSION, *PCERT_EXTENSION;
84 typedef struct _CERT_INFO {
85 DWORD dwVersion;
86 CRYPT_INTEGER_BLOB SerialNumber;
87 CRYPT_ALGORITHM_IDENTIFIER SignatureAlgorithm;
88 CERT_NAME_BLOB Issuer;
89 FILETIME NotBefore;
90 FILETIME NotAfter;
91 CERT_NAME_BLOB Subject;
92 CERT_PUBLIC_KEY_INFO SubjectPublicKeyInfo;
93 CRYPT_BIT_BLOB IssuerUniqueId;
94 CRYPT_BIT_BLOB SubjectUniqueId;
95 DWORD cExtension;
96 PCERT_EXTENSION rgExtension;
97 } CERT_INFO, *PCERT_INFO;
99 typedef struct _CERT_CONTEXT {
100 DWORD dwCertEncodingType;
101 BYTE *pbCertEncoded;
102 DWORD cbCertEncoded;
103 PCERT_INFO pCertInfo;
104 HCERTSTORE hCertStore;
105 } CERT_CONTEXT, *PCERT_CONTEXT;
106 typedef const CERT_CONTEXT *PCCERT_CONTEXT;
108 /* Algorithm IDs */
110 #define GET_ALG_CLASS(x) (x & (7 << 13))
111 #define GET_ALG_TYPE(x) (x & (15 << 9))
112 #define GET_ALG_SID(x) (x & (511))
114 /* Algorithm Classes */
115 #define ALG_CLASS_ANY (0)
116 #define ALG_CLASS_SIGNATURE (1 << 13)
117 #define ALG_CLASS_MSG_ENCRYPT (2 << 13)
118 #define ALG_CLASS_DATA_ENCRYPT (3 << 13)
119 #define ALG_CLASS_HASH (4 << 13)
120 #define ALG_CLASS_KEY_EXCHANGE (5 << 13)
121 /* Algorithm types */
122 #define ALG_TYPE_ANY (0)
123 #define ALG_TYPE_DSS (1 << 9)
124 #define ALG_TYPE_RSA (2 << 9)
125 #define ALG_TYPE_BLOCK (3 << 9)
126 #define ALG_TYPE_STREAM (4 << 9)
128 /* SIDs */
129 #define ALG_SID_ANY (0)
130 /* RSA SIDs */
131 #define ALG_SID_RSA_ANY 0
132 #define ALG_SID_RSA_PKCS 1
133 #define ALG_SID_RSA_MSATWORK 2
134 #define ALG_SID_RSA_ENTRUST 3
135 #define ALG_SID_RSA_PGP 4
136 /* DSS SIDs */
137 #define ALG_SID_DSS_ANY 0
138 #define ALG_SID_DSS_PKCS 1
139 #define ALG_SID_DSS_DMS 2
141 /* DES SIDs */
142 #define ALG_SID_DES 1
143 #define ALG_SID_3DES 3
144 #define ALG_SID_DESX 4
145 #define ALG_SID_IDEA 5
146 #define ALG_SID_CAST 6
147 #define ALG_SID_SAFERSK64 7
148 #define ALD_SID_SAFERSK128 8
149 /* RC2 SIDs */
150 #define ALG_SID_RC4 1
151 #define ALG_SID_RC2 2
152 #define ALG_SID_SEAL 2
153 /* Hash SIDs */
154 #define ALG_SID_MD2 1
155 #define ALG_SID_MD4 2
156 #define ALG_SID_MD5 3
157 #define ALG_SID_SHA 4
158 #define ALG_SID_MAC 5
159 #define ALG_SID_RIPEMD 6
160 #define ALG_SID_RIPEMD160 7
161 #define ALG_SID_SSL3SHAMD5 8
163 /* Algorithm Definitions */
164 #define CALG_MD2 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MD2)
165 #define CALG_MD4 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MD4)
166 #define CALG_MD5 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MD5)
167 #define CALG_SHA (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA)
168 #define CALG_MAC (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MAC)
169 #define CALG_RSA_SIGN (ALG_CLASS_SIGNATURE | ALG_TYPE_RSA | ALG_SID_RSA_ANY)
170 #define CALG_DSS_SIGN (ALG_CLASS_SIGNATURE | ALG_TYPE_DSS | ALG_SID_DSS_ANY)
171 #define CALG_RSA_KEYX (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_RSA | ALG_SID_RSA_ANY)
172 #define CALG_DES (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_DES)
173 #define CALG_RC2 (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_RC2)
174 #define CALG_RC4 (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_STREAM | ALG_SID_RC4)
175 #define CALG_SEAL (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_STREAM | ALG_SID_SEAL)
177 /* Provider names */
178 #define MS_DEF_PROV_A "Microsoft Base Cryptographic Provider v1.0"
179 #if defined(__GNUC__)
180 # define MS_DEF_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
181 'B','a','s','e',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ', \
182 'P','r','o','v','i','d','e','r',' ','v','1','.','0',0 }
183 #elif defined(_MSC_VER)
184 # define MS_DEF_PROV_W L"Microsoft Base Cryptographic Provider v1.0"
185 #else
186 static const WCHAR MS_DEF_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
187 'B','a','s','e',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ',
188 'P','r','o','v','i','d','e','r',' ','v','1','.','0',0 };
189 #endif
190 #define MS_DEF_PROV WINELIB_NAME_AW(MS_DEF_PROV_)
192 #define MS_ENHANCED_PROV_A "Microsoft Enhanced Cryptographic Provider v1.0"
193 #if defined(__GNUC__)
194 # define MS_ENHANCED_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
195 'E','n','h','a','n','c','e','d',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ', \
196 'P','r','o','v','i','d','e','r',' ','v','1','.','0',0 }
197 #elif defined(_MSC_VER)
198 # define MS_ENHANCED_PROV_W L"Microsoft Enhanced Cryptographic Provider v1.0"
199 #else
200 static const WCHAR MS_ENHANCED_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
201 'E','n','h','a','n','c','e','d',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ',
202 'P','r','o','v','i','d','e','r',' ','v','1','.','0',0 };
203 #endif
204 #define MS_ENHANCED_PROV WINELIB_NAME_AW(MS_ENHANCED_PROV_)
206 #define MS_STRONG_PROV_A "Microsoft Strong Cryptographic Provider"
207 #if defined(__GNUC__)
208 # define MS_STRONG_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
209 'S','t','r','o','n','g',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ', \
210 'P','r','o','v','i','d','e','r',0 }
211 #elif defined(_MSC_VER)
212 # define MS_STRONG_PROV_W L"Microsoft Strong Cryptographic Provider"
213 #else
214 static const WCHAR MS_STRONG_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
215 'S','t','r','o','n','g',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ',
216 'P','r','o','v','i','d','e','r',0 };
217 #endif
218 #define MS_STRONG_PROV WINELIB_NAME_AW(MS_STRONG_PROV_)
220 #define MS_DEF_RSA_SIG_PROV_A "Microsoft RSA Signature Cryptographic Provider"
221 #if defined(__GNUC__)
222 # define MS_DEF_RSA_SIG_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
223 'R','S','A',' ','S','i','g','n','a','t','u','r','e',' ', \
224 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
225 #elif defined(_MSC_VER)
226 # define MS_DEF_RSA_SIG_PROV_W L"Microsoft RSA Signature Cryptographic Provider"
227 #else
228 static const WCHAR MS_DEF_RSA_SIG_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
229 'R','S','A',' ','S','i','g','n','a','t','u','r','e',' ',
230 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
231 #endif
232 #define MS_DEF_RSA_SIG_PROV WINELIB_NAME_AW(MS_DEF_RSA_SIG_PROV_)
234 #define MS_DEF_RSA_SCHANNEL_PROV_A "Microsoft RSA SChannel Cryptographic Provider"
235 #if defined(__GNUC__)
236 # define MS_DEF_RSA_SCHANNEL_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
237 'R','S','A',' ','S','C','h','a','n','n','e','l',' ', \
238 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
239 #elif defined(_MSC_VER)
240 # define MS_DEF_RSA_SCHANNEL_PROV_W L"Microsoft RSA SChannel Cryptographic Provider"
241 #else
242 static const WCHAR MS_DEF_RSA_SCHANNEL_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
243 'R','S','A',' ','S','C','h','a','n','n','e','l',' ',
244 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
245 #endif
246 #define MS_DEF_RSA_SCHANNEL_PROV WINELIB_NAME_AW(MS_DEF_RSA_SCHANNEL_PROV_)
248 #define MS_DEF_DSS_PROV_A "Microsoft Base DSS Cryptographic Provider"
249 #if defined(__GNUC__)
250 # define MS_DEF_DSS_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
251 'B','a','s','e',' ','D','S','S',' ', \
252 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
253 #elif defined(_MSC_VER)
254 # define MS_DEF_DSS_PROV_W L"Microsoft Base DSS Cryptographic Provider"
255 #else
256 static const WCHAR MS_DEF_DSS_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
257 'B','a','s','e',' ','D','S','S',' ',
258 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
259 #endif
260 #define MS_DEF_DSS_PROV WINELIB_NAME_AW(MS_DEF_DSS_PROV_)
262 #define MS_DEF_DSS_DH_PROV_A "Microsoft Base DSS and Diffie-Hellman Cryptographic Provider"
263 #if defined(__GNUC__)
264 # define MS_DEF_DSS_DH_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
265 'B','a','s','e',' ','D','S','S',' ','a','n','d',' ', \
266 'D','i','f','f','i','e','-','H','e','l','l','m','a','n',' ', \
267 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
268 #elif defined(_MSC_VER)
269 # define MS_DEF_DSS_DH_PROV_W L"Microsoft Base DSS and Diffie-Hellman Cryptographic Provider"
270 #else
271 static const WCHAR MS_DEF_DSS_DH_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
272 'B','a','s','e',' ','D','S','S',' ','a','n','d',' ',
273 'D','i','f','f','i','e','-','H','e','l','l','m','a','n',' ',
274 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
275 #endif
276 #define MS_DEF_DSS_DH_PROV WINELIB_NAME_AW(MS_DEF_DSS_DH_PROV_)
278 #define MS_ENH_DSS_DH_PROV_A "Microsoft Enhanced DSS and Diffie-Hellman Cryptographic Provider"
279 #if defined(__GNUC__)
280 # define MS_ENH_DSS_DH_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
281 'E','n','h','a','n','c','e','d',' ','D','S','S',' ','a','n','d',' ', \
282 'D','i','f','f','i','e','-','H','e','l','l','m','a','n',' ', \
283 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
284 #elif defined(_MSC_VER)
285 # define MS_ENH_DSS_DH_PROV_W L"Microsoft Enhanced DSS and Diffie-Hellman Cryptographic Provider"
286 #else
287 static const WCHAR MS_ENH_DSS_DH_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
288 'E','n','h','a','n','c','e','d',' ','D','S','S',' ','a','n','d',' ',
289 'D','i','f','f','i','e','-','H','e','l','l','m','a','n',' ',
290 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
291 #endif
292 #define MS_ENH_DSS_DH_PROV WINELIB_NAME_AW(MS_ENH_DSS_DH_PROV_)
294 #define MS_DEF_DH_SCHANNEL_PROV_A "Microsoft DH SChannel Cryptographic Provider"
295 #if defined(__GNUC__)
296 # define MS_DEF_DH_SCHANNEL_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
297 'D','H',' ','S','C','h','a','n','n','e','l',' ', \
298 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
299 #elif defined(_MSC_VER)
300 # define MS_DEF_DH_SCHANNEL_PROV_W L"Microsoft DH SChannel Cryptographic Provider"
301 #else
302 static const WCHAR MS_DEF_DH_SCHANNEL_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
303 'D','H',' ','S','C','h','a','n','n','e','l',' ',
304 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
305 #endif
306 #define MS_DEF_DH_SCHANNEL_PROV WINELIB_NAME_AW(MS_DEF_DH_SCHANNEL_PROV_)
308 #define MS_SCARD_PROV_A "Microsoft Base Smart Card Cryptographic Provider"
309 #if defined(__GNUC__)
310 # define MS_SCARD_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
311 'B','a','s','e',' ','S','m','a','r','t',' ','C','a','r','d',' ', \
312 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
313 #elif defined(_MSC_VER)
314 # define MS_SCARD_PROV_W L"Microsoft Base Smart Card Cryptographic Provider"
315 #else
316 static const WCHAR MS_SCARD_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
317 'B','a','s','e',' ','S','m','a','r','t',' ','C','a','r','d',' ',
318 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
319 #endif
320 #define MS_SCARD_PROV WINELIB_NAME_AW(MS_SCARD_PROV_)
322 /* Key Specs*/
323 #define AT_KEYEXCHANGE 1
324 #define AT_SIGNATURE 2
326 /* Provider Types */
327 #define PROV_RSA_FULL 1
328 #define PROV_RSA_SIG 2
329 #define PROV_DSS 3
330 #define PROV_FORTEZZA 4
331 #define PROV_MS_EXCHANGE 5
332 #define PROV_SSL 6
333 #define PROV_RSA_SCHANNEL 12
334 #define PROV_DSS_DH 13
335 #define PROV_EC_ECDSA_SIG 14
336 #define PROV_EC_ECNRA_SIG 15
337 #define PROV_EC_ECDSA_FULL 16
338 #define PROV_EC_ECNRA_FULL 17
339 #define PROV_DH_SCHANNEL 18
340 #define PROV_SPYRUS_LYNKS 20
341 #define PROV_RNG 21
342 #define PROV_INTEL_SEC 22
343 #define PROV_REPLACE_OWF 23
344 #define PROV_RSA_AES 24
346 /* FLAGS Section */
348 /* Provider Parameters */
349 #define PP_ENUMALGS 1
350 #define PP_ENUMCONTAINERS 2
351 #define PP_IMPTYPE 3
352 #define PP_NAME 4
353 #define PP_VERSION 5
354 #define PP_CONTAINER 6
356 #define CRYPT_FIRST 1
357 #define CRYPT_NEXT 2
359 #define CRYPT_IMPL_HARDWARE 1
360 #define CRYPT_IMPL_SOFTWARE 2
361 #define CRYPT_IMPL_MIXED 3
362 #define CRYPT_IMPL_UNKNOWN 4
364 /* CryptAcquireContext */
365 #define CRYPT_VERIFYCONTEXT 0xF0000000
366 #define CRYPT_NEWKEYSET 0x00000008
367 #define CRYPT_MACHINE_KEYSET 0x00000000
368 #define CRYPT_DELETEKEYSET 0x00000010
369 #define CRYPT_SILENT 0x00000000
371 /* Crypt{Get|Set}Provider */
372 #define CRYPT_MACHINE_DEFAULT 0x00000001
373 #define CRYPT_USER_DEFAULT 0x00000002
374 #define CRYPT_DELETE_DEFAULT 0x00000004
376 /* Crypt{Get/Set}ProvParam */
377 #define PP_CLIENT_HWND 1
378 #define PP_ENUMALGS 1
379 #define PP_ENUMCONTAINERS 2
380 #define PP_IMPTYPE 3
381 #define PP_NAME 4
382 #define PP_VERSION 5
383 #define PP_CONTAINER 6
384 #define PP_CHANGE_PASSWORD 7
385 #define PP_KEYSET_SEC_DESCR 8
386 #define PP_KEY_TYPE_SUBTYPE 10
387 #define PP_CONTEXT_INFO 11
388 #define PP_KEYEXCHANGE_KEYSIZE 12
389 #define PP_SIGNATURE_KEYSIZE 13
390 #define PP_KEYEXCHANGE_ALG 14
391 #define PP_SIGNATURE_ALG 15
392 #define PP_PROVTYPE 16
393 #define PP_KEYSTORAGE 17
394 #define PP_SYM_KEYSIZE 19
395 #define PP_SESSION_KEYSIZE 20
396 #define PP_UI_PROMPT 21
397 #define PP_ENUMALGS_EX 22
398 #define PP_DELETEKEY 24
399 #define PP_ENUMMANDROOTS 25
400 #define PP_ENUMELECTROOTS 26
401 #define PP_KEYSET_TYPE 27
402 #define PP_ADMIN_PIN 31
403 #define PP_KEYEXCHANGE_PIN 32
404 #define PP_SIGNATURE_PIN 33
405 #define PP_SIG_KEYSIZE_INC 34
406 #define PP_KEYX_KEYSIZE_INC 35
407 #define PP_UNIQUE_CONTAINER 36
408 #define PP_SGC_INFO 37
409 #define PP_USE_HARDWARE_RNG 38
410 #define PP_KEYSPEC 39
411 #define PP_ENUMEX_SIGNING_PROT 40
413 /* CryptSignHash/CryptVerifySignature */
414 #define CRYPT_NOHASHOID 0x00000001
415 #define CRYPT_TYPE2_FORMAT 0x00000002
416 #define CRYPT_X931_FORMAT 0x00000004
418 /* Crypt*Key */
419 #define CRYPT_EXPORTABLE 0x00000001
420 #define CRYPT_USER_PROTECTED 0x00000002
421 #define CRYPT_CREATE_SALT 0x00000004
422 #define CRYPT_UPDATE_KEY 0x00000008
423 #define CRYPT_NO_SALT 0x00000010
424 #define CRYPT_PREGEN 0x00000040
425 #define CRYPT_ARCHIVABLE 0x00004000
426 #define CRYPT_SSL2_FALLBACK 0x00000002
427 #define CRYPT_DESTROYKEY 0x00000004
428 #define CRYPT_OAEP 0x00000040
430 /* Blob Types */
431 #define SIMPLEBLOB 0x1
432 #define PUBLICKEYBLOB 0x6
433 #define PRIVATEKEYBLOB 0x7
434 #define PLAINTEXTKEYBLOB 0x8
435 #define OPAQUEKEYBLOB 0x9
436 #define PUBLICKEYBLOBEX 0xA
437 #define SYMMETRICWRAPKEYBLOB 0xB
439 /* function declarations */
440 /* advapi32.dll */
441 BOOL WINAPI CryptAcquireContextA(HCRYPTPROV *phProv, LPCSTR pszContainer,
442 LPCSTR pszProvider, DWORD dwProvType,
443 DWORD dwFlags);
444 BOOL WINAPI CryptAcquireContextW (HCRYPTPROV *phProv, LPCWSTR pszContainer,
445 LPCWSTR pszProvider, DWORD dwProvType, DWORD dwFlags);
446 #define CryptAcquireContext WINELIB_NAME_AW(CryptAcquireContext)
447 BOOL WINAPI CryptGenRandom (HCRYPTPROV hProv, DWORD dwLen, BYTE *pbBuffer);
448 BOOL WINAPI CryptContextAddRef (HCRYPTPROV hProv, DWORD *pdwReserved, DWORD dwFlags);
449 BOOL WINAPI CryptCreateHash (HCRYPTPROV hProv, ALG_ID Algid, HCRYPTKEY hKey,
450 DWORD dwFlags, HCRYPTHASH *phHash);
451 BOOL WINAPI CryptDecrypt (HCRYPTKEY hKey, HCRYPTHASH hHash, BOOL Final,
452 DWORD dwFlags, BYTE *pbData, DWORD *pdwDataLen);
453 BOOL WINAPI CryptDeriveKey (HCRYPTPROV hProv, ALG_ID Algid, HCRYPTHASH hBaseData,
454 DWORD dwFlags, HCRYPTKEY *phKey);
455 BOOL WINAPI CryptDestroyHash (HCRYPTHASH hHash);
456 BOOL WINAPI CryptDestroyKey (HCRYPTKEY hKey);
457 BOOL WINAPI CryptDuplicateKey (HCRYPTKEY hKey, DWORD *pdwReserved, DWORD dwFlags, HCRYPTKEY *phKey);
458 BOOL WINAPI CryptDuplicateHash (HCRYPTHASH hHash, DWORD *pdwReserved,
459 DWORD dwFlags, HCRYPTHASH *phHash);
460 BOOL WINAPI CryptEncrypt (HCRYPTKEY hKey, HCRYPTHASH hHash, BOOL Final,
461 DWORD dwFlags, BYTE *pbData, DWORD *pdwDataLen, DWORD dwBufLen);
462 BOOL WINAPI CryptEnumProvidersA (DWORD dwIndex, DWORD *pdwReserved,
463 DWORD dwFlags, DWORD *pdwProvType, LPSTR pszProvName, DWORD *pcbProvName);
464 BOOL WINAPI CryptEnumProvidersW (DWORD dwIndex, DWORD *pdwReserved,
465 DWORD dwFlags, DWORD *pdwProvType, LPWSTR pszProvName, DWORD *pcbProvName);
466 #define CryptEnumProviders WINELIB_NAME_AW(CryptEnumProviders)
467 BOOL WINAPI CryptEnumProviderTypesA (DWORD dwIndex, DWORD *pdwReserved,
468 DWORD dwFlags, DWORD *pdwProvType, LPSTR pszTypeName, DWORD *pcbTypeName);
469 BOOL WINAPI CryptEnumProviderTypesW (DWORD dwIndex, DWORD *pdwReserved,
470 DWORD dwFlags, DWORD *pdwProvType, LPWSTR pszTypeName, DWORD *pcbTypeName);
471 #define CryptEnumProviderTypes WINELIB_NAME_AW(CryptEnumProviderTypes)
472 BOOL WINAPI CryptExportKey (HCRYPTKEY hKey, HCRYPTKEY hExpKey, DWORD dwBlobType,
473 DWORD dwFlags, BYTE *pbData, DWORD *pdwDataLen);
474 BOOL WINAPI CryptGenKey (HCRYPTPROV hProv, ALG_ID Algid, DWORD dwFlags, HCRYPTKEY *phKey);
475 BOOL WINAPI CryptGetKeyParam (HCRYPTKEY hKey, DWORD dwParam, BYTE *pbData,
476 DWORD *pdwDataLen, DWORD dwFlags);
477 BOOL WINAPI CryptGetHashParam (HCRYPTHASH hHash, DWORD dwParam, BYTE *pbData,
478 DWORD *pdwDataLen, DWORD dwFlags);
479 BOOL WINAPI CryptGetProvParam (HCRYPTPROV hProv, DWORD dwParam, BYTE *pbData,
480 DWORD *pdwDataLen, DWORD dwFlags);
481 BOOL WINAPI CryptGetDefaultProviderA (DWORD dwProvType, DWORD *pdwReserved,
482 DWORD dwFlags, LPSTR pszProvName, DWORD *pcbProvName);
483 BOOL WINAPI CryptGetDefaultProviderW (DWORD dwProvType, DWORD *pdwReserved,
484 DWORD dwFlags, LPWSTR pszProvName, DWORD *pcbProvName);
485 #define CryptGetDefaultProvider WINELIB_NAME_AW(CryptGetDefaultProvider)
486 BOOL WINAPI CryptGetUserKey (HCRYPTPROV hProv, DWORD dwKeySpec, HCRYPTKEY *phUserKey);
487 BOOL WINAPI CryptHashData (HCRYPTHASH hHash, BYTE *pbData, DWORD dwDataLen, DWORD dwFlags);
488 BOOL WINAPI CryptHashSessionKey (HCRYPTHASH hHash, HCRYPTKEY hKey, DWORD dwFlags);
489 BOOL WINAPI CryptImportKey (HCRYPTPROV hProv, BYTE *pbData, DWORD dwDataLen,
490 HCRYPTKEY hPubKey, DWORD dwFlags, HCRYPTKEY *phKey);
491 BOOL WINAPI CryptReleaseContext (HCRYPTPROV hProv, DWORD dwFlags);
492 BOOL WINAPI CryptSignHashA (HCRYPTHASH hHash, DWORD dwKeySpec, LPCSTR sDescription,
493 DWORD dwFlags, BYTE *pbSignature, DWORD *pdwSigLen);
494 /*BOOL WINAPI CryptSignHashW (HCRYPTHASH hHash, DWORD dwKeySpec, LPCWSTR sDescription,
495 DWORD dwFlags, BYTE *pbSignature, DWORD *pdwSigLen);*/
496 #define CryptSignHashW(hHash, dwKeySpec, sDescription, dwFlags, pbSignature, pdwSigLen) \\
497 CryptSignHashA(hHash, dwKeySpec, (LPCSTR)sDescription, dwFlags, pbSignature, pdwSigLen)
498 #define CryptSignHash WINELIB_NAME_AW(CryptSignHash)
499 BOOL WINAPI CryptSetHashParam (HCRYPTHASH hHash, DWORD dwParam, BYTE *pbData, DWORD dwFlags);
500 BOOL WINAPI CryptSetKeyParam (HCRYPTKEY hKey, DWORD dwParam, BYTE *pbData, DWORD dwFlags);
501 BOOL WINAPI CryptSetProviderA (LPCSTR pszProvName, DWORD dwProvType);
502 BOOL WINAPI CryptSetProviderW (LPCWSTR pszProvName, DWORD dwProvType);
503 #define CryptSetProvider WINELIB_NAME_AW(CryptSetProvider)
504 BOOL WINAPI CryptSetProviderExA (LPCSTR pszProvName, DWORD dwProvType, DWORD *pdwReserved, DWORD dwFlags);
505 BOOL WINAPI CryptSetProviderExW (LPCWSTR pszProvName, DWORD dwProvType, DWORD *pdwReserved, DWORD dwFlags);
506 #define CryptSetProviderEx WINELIB_NAME_AW(CryptSetProviderEx)
507 BOOL WINAPI CryptSetProvParam (HCRYPTPROV hProv, DWORD dwParam, BYTE *pbData, DWORD dwFlags);
508 BOOL WINAPI CryptVerifySignatureA (HCRYPTHASH hHash, BYTE *pbSignature, DWORD dwSigLen,
509 HCRYPTKEY hPubKey, LPCSTR sDescription, DWORD dwFlags);
510 /*BOOL WINAPI CryptVerifySignatureW (HCRYPTHASH hHash, BYTE *pbSignature, DWORD dwSigLen,
511 HCRYPTKEY hPubKey, LPCWSTR sDescription, DWORD dwFlags);*/
512 #define CryptVerifySignatureW(hHash, pbSignature, dwSigLen, hPubKey, sDescription, dwFlags) \\
513 CryptVerifySignatureA(hHash, pbSignature, dwSigLen, hPubKey, (LPCSTR)sDescription, dwFlags)
514 #define CryptVerifySignature WINELIB_NAME_AW(CryptVerifySignature)
516 #endif