Replaced undefined C expression.
[wine.git] / include / wincrypt.h
blob5695faefbc2dc7bc6d6867f6758e1ce1e0cc3a8c
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;
32 typedef void *HCRYPTMSG;
34 /* CSP Structs */
36 typedef struct _PROV_ENUMALGS {
37 ALG_ID aiAlgid;
38 DWORD dwBitLen;
39 DWORD dwNameLen;
40 CHAR szName[20];
41 } PROV_ENUMALGS;
43 typedef struct _PROV_ENUMALGS_EX {
44 ALG_ID aiAlgid;
45 DWORD dwDefaultLen;
46 DWORD dwMinLen;
47 DWORD dwMaxLen;
48 DWORD dwProtocols;
49 DWORD dwNameLen;
50 CHAR szName[20];
51 DWORD dwLongNameLen;
52 CHAR szLongName[40];
53 } PROV_ENUMALGS_EX;
55 typedef struct _CRYPTOAPI_BLOB {
56 DWORD cbData;
57 BYTE* pbData;
58 } CRYPT_INTEGER_BLOB, *PCRYPT_INTEGER_BLOB,
59 CRYPT_UINT_BLOB, *PCRYPT_UINT_BLOB,
60 CRYPT_OBJID_BLOB, *PCRYPT_OBJID_BLOB,
61 CERT_NAME_BLOB, *PCERT_NAME_BLOB,
62 CERT_RDN_VALUE_BLOB, *PCERT_RDN_VALUE_BLOB,
63 CERT_BLOB, *PCERT_BLOB,
64 CRL_BLOB, *PCRL_BLOB,
65 DATA_BLOB, *PDATA_BLOB,
66 CRYPT_DATA_BLOB, *PCRYPT_DATA_BLOB,
67 CRYPT_HASH_BLOB, *PCRYPT_HASH_BLOB,
68 CRYPT_DIGEST_BLOB, *PCRYPT_DIGEST_BLOB,
69 CRYPT_DER_BLOB, *PCRYPT_DER_BLOB,
70 CRYPT_ATTR_BLOB, *PCRYPT_ATTR_BLOB;
72 typedef struct _CRYPTPROTECT_PROMPTSTRUCT{
73 DWORD cbSize;
74 DWORD dwPromptFlags;
75 HWND hwndApp;
76 LPCWSTR szPrompt;
77 } CRYPTPROTECT_PROMPTSTRUCT, *PCRYPTPROTECT_PROMPTSTRUCT;
79 typedef struct _CRYPT_ALGORITHM_IDENTIFIER {
80 LPSTR pszObjId;
81 CRYPT_OBJID_BLOB Parameters;
82 } CRYPT_ALGORITHM_IDENTIFIER, *PCRYPT_ALGORITHM_IDENTIFIER;
84 typedef struct _CRYPT_ATTRIBUTE_TYPE_VALUE {
85 LPSTR pszObjId;
86 CRYPT_OBJID_BLOB Value;
87 } CRYPT_ATTRIBUTE_TYPE_VALUE, *PCRYPT_ATTRIBUTE_TYPE_VALUE;
89 typedef struct _PUBLICKEYSTRUC {
90 BYTE bType;
91 BYTE bVersion;
92 WORD reserved;
93 ALG_ID aiKeyAlg;
94 } BLOBHEADER, PUBLICKEYSTRUC;
96 typedef struct _RSAPUBKEY {
97 DWORD magic;
98 DWORD bitlen;
99 DWORD pubexp;
100 } RSAPUBKEY;
102 typedef struct _CRYPT_BIT_BLOB {
103 DWORD cbData;
104 BYTE *pbData;
105 DWORD cUnusedBits;
106 } CRYPT_BIT_BLOB, *PCRYPT_BIT_BLOB;
108 typedef struct _CERT_PUBLIC_KEY_INFO {
109 CRYPT_ALGORITHM_IDENTIFIER Algorithm;
110 CRYPT_BIT_BLOB PublicKey;
111 } CERT_PUBLIC_KEY_INFO, *PCERT_PUBLIC_KEY_INFO;
113 typedef struct _CERT_EXTENSION {
114 LPSTR pszObjId;
115 BOOL fCritical;
116 CRYPT_OBJID_BLOB Value;
117 } CERT_EXTENSION, *PCERT_EXTENSION;
119 typedef struct _CERT_INFO {
120 DWORD dwVersion;
121 CRYPT_INTEGER_BLOB SerialNumber;
122 CRYPT_ALGORITHM_IDENTIFIER SignatureAlgorithm;
123 CERT_NAME_BLOB Issuer;
124 FILETIME NotBefore;
125 FILETIME NotAfter;
126 CERT_NAME_BLOB Subject;
127 CERT_PUBLIC_KEY_INFO SubjectPublicKeyInfo;
128 CRYPT_BIT_BLOB IssuerUniqueId;
129 CRYPT_BIT_BLOB SubjectUniqueId;
130 DWORD cExtension;
131 PCERT_EXTENSION rgExtension;
132 } CERT_INFO, *PCERT_INFO;
134 typedef struct _CERT_CONTEXT {
135 DWORD dwCertEncodingType;
136 BYTE *pbCertEncoded;
137 DWORD cbCertEncoded;
138 PCERT_INFO pCertInfo;
139 HCERTSTORE hCertStore;
140 } CERT_CONTEXT, *PCERT_CONTEXT;
141 typedef const CERT_CONTEXT *PCCERT_CONTEXT;
143 typedef struct _CRL_ENTRY {
144 CRYPT_INTEGER_BLOB SerialNumber;
145 FILETIME RevocationDate;
146 DWORD cExtension;
147 PCERT_EXTENSION rgExtension;
148 } CRL_ENTRY, *PCRL_ENTRY;
150 typedef struct _CRL_INFO {
151 DWORD dwVersion;
152 CRYPT_ALGORITHM_IDENTIFIER SignatureAlgorithm;
153 CERT_NAME_BLOB Issuer;
154 FILETIME ThisUpdate;
155 FILETIME NextUpdate;
156 DWORD cCRLEntry;
157 PCRL_ENTRY rgCRLEntry;
158 DWORD cExtension;
159 PCERT_EXTENSION rgExtension;
160 } CRL_INFO, *PCRL_INFO;
162 typedef struct _CRL_CONTEXT {
163 DWORD dwCertEncodingType;
164 BYTE *pbCrlEncoded;
165 DWORD cbCrlEncoded;
166 PCRL_INFO pCrlInfo;
167 HCERTSTORE hCertStore;
168 } CRL_CONTEXT, *PCRL_CONTEXT;
169 typedef const CRL_CONTEXT *PCCRL_CONTEXT;
171 typedef struct _VTableProvStruc {
172 DWORD Version;
173 FARPROC pFuncVerifyImage;
174 FARPROC pFuncReturnhWnd;
175 DWORD dwProvType;
176 BYTE *pbContextInfo;
177 DWORD cbContextInfo;
178 LPSTR pszProvName;
179 } VTableProvStruc, *PVTableProvStruc;
181 typedef struct _CRYPT_ATTRIBUTE {
182 LPSTR pszObjId;
183 DWORD cValue;
184 CRYPT_DATA_BLOB rgValue;
185 } CRYPT_ATTRIBUTE, *PCRYPT_ATTRIBUTE;
187 typedef struct _CRYPT_ATTRIBUTES {
188 DWORD cAttr;
189 PCRYPT_ATTRIBUTE rgAttr;
190 } CRYPT_ATTRIBUTES, *PCRYPT_ATTRIBUTES;
192 typedef struct _CTL_USAGE {
193 DWORD cUsageIdentifier;
194 LPSTR *rgpszUsageIdentifier;
195 } CTL_USAGE, *PCTL_USAGE, CERT_ENHKEY_USAGE, *PCERT_ENHKEY_USAGE;
197 typedef struct _CTL_ENTRY {
198 CRYPT_DATA_BLOB SubjectIdentifier;
199 DWORD cAttribute;
200 PCRYPT_ATTRIBUTE rgAttribute;
201 } CTL_ENTRY, *PCTL_ENTRY;
203 typedef struct _CTL_INFO {
204 DWORD dwVersion;
205 CTL_USAGE SubjectUsage;
206 CRYPT_DATA_BLOB ListIdentifier;
207 CRYPT_INTEGER_BLOB SequenceNumber;
208 FILETIME ThisUpdate;
209 FILETIME NextUpdate;
210 CRYPT_ALGORITHM_IDENTIFIER SubjectAlgorithm;
211 DWORD cCTLEntry;
212 PCTL_ENTRY rgCTLEntry;
213 DWORD cExtension;
214 PCERT_EXTENSION rgExtension;
215 } CTL_INFO, *PCTL_INFO;
217 typedef struct _CTL_CONTEXT {
218 DWORD dwMsgAndCertEncodingType;
219 BYTE *pbCtlEncoded;
220 DWORD cbCtlEncoded;
221 PCTL_INFO pCtlInfo;
222 HCERTSTORE hCertStore;
223 HCRYPTMSG hCryptMsg;
224 BYTE *pbCtlContext;
225 DWORD cbCtlContext;
226 } CTL_CONTEXT, *PCTL_CONTEXT;
227 typedef const CTL_CONTEXT *PCCTL_CONTEXT;
229 typedef struct _CERT_REVOCATION_CRL_INFO {
230 DWORD cbSize;
231 PCCRL_CONTEXT pBaseCrlContext;
232 PCCRL_CONTEXT pDeltaCrlContext;
233 PCRL_ENTRY pCrlEntry;
234 BOOL fDeltaCrlEntry;
235 } CERT_REVOCATION_CRL_INFO, *PCERT_REVOCATION_CRL_INFO;
237 typedef struct _CERT_REVOCATION_INFO {
238 DWORD cbSize;
239 DWORD dwRevocationResult;
240 LPCSTR pszRevocationOid;
241 LPVOID pvOidSpecificInfo;
242 BOOL fHasFreshnessTime;
243 DWORD dwFreshnessTime;
244 PCERT_REVOCATION_CRL_INFO pCrlInfo;
245 } CERT_REVOCATION_INFO, *PCERT_REVOCATION_INFO;
247 typedef struct _CERT_TRUST_LIST_INFO {
248 DWORD cbSize;
249 PCTL_ENTRY pCtlEntry;
250 PCCTL_CONTEXT pCtlContext;
251 } CERT_TRUST_LIST_INFO, *PCERT_TRUST_LIST_INFO;
253 typedef struct _CERT_TRUST_STATUS {
254 DWORD dwErrorStatus;
255 DWORD dwInfoStatus;
256 } CERT_TRUST_STATUS, *PCERT_TRUST_STATUS;
258 typedef struct _CERT_CHAIN_ELEMENT {
259 DWORD cbSize;
260 PCCERT_CONTEXT pCertContext;
261 CERT_TRUST_STATUS TrustStatus;
262 PCERT_REVOCATION_INFO pRevocationInfo;
263 PCERT_ENHKEY_USAGE pIssuanceUsage;
264 PCERT_ENHKEY_USAGE pApplicationUsage;
265 LPCWSTR pwszExtendedErrorInfo;
266 } CERT_CHAIN_ELEMENT, *PCERT_CHAIN_ELEMENT;
268 typedef struct _CERT_SIMPLE_CHAIN {
269 DWORD cbSize;
270 CERT_TRUST_STATUS TrustStatus;
271 DWORD cElement;
272 PCERT_CHAIN_ELEMENT *rgpElement;
273 PCERT_TRUST_LIST_INFO pTrustListInfo;
274 BOOL fHasRevocationFreshnessTime;
275 DWORD dwRevocationFreshnessTime;
276 } CERT_SIMPLE_CHAIN, *PCERT_SIMPLE_CHAIN;
278 typedef struct _CERT_CHAIN_CONTEXT CERT_CHAIN_CONTEXT, *PCERT_CHAIN_CONTEXT;
279 typedef const CERT_CHAIN_CONTEXT *PCCERT_CHAIN_CONTEXT;
281 struct _CERT_CHAIN_CONTEXT {
282 DWORD cbSize;
283 CERT_TRUST_STATUS TrustStatus;
284 DWORD cChain;
285 PCERT_SIMPLE_CHAIN *rgpChain;
286 DWORD cLowerQualityChainContext;
287 PCCERT_CHAIN_CONTEXT *rgbLowerQualityChainContext;
288 BOOL fHasRevocationFreshnessTime;
289 DWORD dwRevocationFreshnessTime;
292 typedef struct _CERT_CHAIN_POLICY_PARA {
293 DWORD cbSize;
294 DWORD dwFlags;
295 void *pvExtraPolicyPara;
296 } CERT_CHAIN_POLICY_PARA, *PCERT_CHAIN_POLICY_PARA;
298 typedef struct _CERT_CHAIN_POLICY_STATUS {
299 DWORD cbSize;
300 DWORD dwError;
301 LONG lChainIndex;
302 LONG lElementIndex;
303 void *pvExtraPolicyStatus;
304 } CERT_CHAIN_POLICY_STATUS, *PCERT_CHAIN_POLICY_STATUS;
306 typedef struct _CERT_SYSTEM_STORE_INFO {
307 DWORD cbSize;
308 } CERT_SYSTEM_STORE_INFO, *PCERT_SYSTEM_STORE_INFO;
310 typedef struct _CERT_PHYSICAL_STORE_INFO {
311 DWORD cbSize;
312 LPSTR pszOpenStoreProvider;
313 DWORD dwOpenEncodingType;
314 DWORD dwOpenFlags;
315 CRYPT_DATA_BLOB OpenParameters;
316 DWORD dwFlags;
317 DWORD dwPriority;
318 } CERT_PHYSICAL_STORE_INFO, *PCERT_PHYSICAL_STORE_INFO;
320 typedef struct _CERT_SYSTEM_STORE_RELOCATE_PARA {
321 union {
322 HKEY hKeyBase;
323 VOID *pvBase;
324 } DUMMYUNIONNAME;
325 union {
326 void *pvSystemStore;
327 LPCSTR pszSystemStore;
328 LPCWSTR pwszSystemStore;
329 } DUMMYUNIONNAME2;
330 } CERT_SYSTEM_STORE_RELOCATE_PARA, *PCERT_SYSTEM_STORE_RELOCATE_PARA;
332 typedef BOOL (WINAPI *PFN_CERT_ENUM_SYSTEM_STORE_LOCATION)(
333 LPCWSTR pwszStoreLocation, DWORD dwFlags, void *pvReserved, void *pvArg);
335 typedef BOOL (WINAPI *PFN_CERT_ENUM_SYSTEM_STORE)(const void *pvSystemStore,
336 DWORD dwFlags, PCERT_SYSTEM_STORE_INFO pStoreInfo, void *pvReserved,
337 void *pvArg);
339 typedef BOOL (WINAPI *PFN_CERT_ENUM_PHYSICAL_STORE)(const void *pvSystemStore,
340 DWORD dwFlags, LPCWSTR pwszStoreName, PCERT_PHYSICAL_STORE_INFO pStoreInfo,
341 void *pvReserved, void *pvArg);
343 /* Algorithm IDs */
345 #define GET_ALG_CLASS(x) (x & (7 << 13))
346 #define GET_ALG_TYPE(x) (x & (15 << 9))
347 #define GET_ALG_SID(x) (x & (511))
349 /* Algorithm Classes */
350 #define ALG_CLASS_ANY (0)
351 #define ALG_CLASS_SIGNATURE (1 << 13)
352 #define ALG_CLASS_MSG_ENCRYPT (2 << 13)
353 #define ALG_CLASS_DATA_ENCRYPT (3 << 13)
354 #define ALG_CLASS_HASH (4 << 13)
355 #define ALG_CLASS_KEY_EXCHANGE (5 << 13)
356 /* Algorithm types */
357 #define ALG_TYPE_ANY (0)
358 #define ALG_TYPE_DSS (1 << 9)
359 #define ALG_TYPE_RSA (2 << 9)
360 #define ALG_TYPE_BLOCK (3 << 9)
361 #define ALG_TYPE_STREAM (4 << 9)
363 /* SIDs */
364 #define ALG_SID_ANY (0)
365 /* RSA SIDs */
366 #define ALG_SID_RSA_ANY 0
367 #define ALG_SID_RSA_PKCS 1
368 #define ALG_SID_RSA_MSATWORK 2
369 #define ALG_SID_RSA_ENTRUST 3
370 #define ALG_SID_RSA_PGP 4
371 /* DSS SIDs */
372 #define ALG_SID_DSS_ANY 0
373 #define ALG_SID_DSS_PKCS 1
374 #define ALG_SID_DSS_DMS 2
376 /* DES SIDs */
377 #define ALG_SID_DES 1
378 #define ALG_SID_3DES 3
379 #define ALG_SID_DESX 4
380 #define ALG_SID_IDEA 5
381 #define ALG_SID_CAST 6
382 #define ALG_SID_SAFERSK64 7
383 #define ALG_SID_SAFERSK128 8
384 #define ALG_SID_3DES_112 9
385 /* RC2 SIDs */
386 #define ALG_SID_RC4 1
387 #define ALG_SID_RC2 2
388 #define ALG_SID_SEAL 2
389 /* Hash SIDs */
390 #define ALG_SID_MD2 1
391 #define ALG_SID_MD4 2
392 #define ALG_SID_MD5 3
393 #define ALG_SID_SHA 4
394 #define ALG_SID_MAC 5
395 #define ALG_SID_RIPEMD 6
396 #define ALG_SID_RIPEMD160 7
397 #define ALG_SID_SSL3SHAMD5 8
398 #define ALG_SID_HMAC 9
400 /* Algorithm Definitions */
401 #define CALG_MD2 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MD2)
402 #define CALG_MD4 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MD4)
403 #define CALG_MD5 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MD5)
404 #define CALG_SHA (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA)
405 #define CALG_MAC (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MAC)
406 #define CALG_SSL3_SHAMD5 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SSL3SHAMD5)
407 #define CALG_HMAC (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_HMAC)
408 #define CALG_RSA_SIGN (ALG_CLASS_SIGNATURE | ALG_TYPE_RSA | ALG_SID_RSA_ANY)
409 #define CALG_DSS_SIGN (ALG_CLASS_SIGNATURE | ALG_TYPE_DSS | ALG_SID_DSS_ANY)
410 #define CALG_RSA_KEYX (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_RSA | ALG_SID_RSA_ANY)
411 #define CALG_DES (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_DES)
412 #define CALG_RC2 (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_RC2)
413 #define CALG_3DES (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_3DES)
414 #define CALG_3DES_112 (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_3DES_112)
415 #define CALG_RC4 (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_STREAM | ALG_SID_RC4)
416 #define CALG_SEAL (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_STREAM | ALG_SID_SEAL)
418 /* Protocol Flags */
419 #define CRYPT_FLAG_PCT1 0x0001
420 #define CRYPT_FLAG_SSL2 0x0002
421 #define CRYPT_FLAG_SSL3 0x0004
422 #define CRYPT_FLAG_TLS1 0x0008
423 #define CRYPT_FLAG_IPSEC 0x0010
424 #define CRYPT_FLAG_SIGNING 0x0020
426 /* Provider names */
427 #define MS_DEF_PROV_A "Microsoft Base Cryptographic Provider v1.0"
428 #if defined(__GNUC__)
429 # define MS_DEF_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
430 'B','a','s','e',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ', \
431 'P','r','o','v','i','d','e','r',' ','v','1','.','0',0 }
432 #elif defined(_MSC_VER)
433 # define MS_DEF_PROV_W L"Microsoft Base Cryptographic Provider v1.0"
434 #else
435 static const WCHAR MS_DEF_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
436 'B','a','s','e',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ',
437 'P','r','o','v','i','d','e','r',' ','v','1','.','0',0 };
438 #endif
439 #define MS_DEF_PROV WINELIB_NAME_AW(MS_DEF_PROV_)
441 #define MS_ENHANCED_PROV_A "Microsoft Enhanced Cryptographic Provider v1.0"
442 #if defined(__GNUC__)
443 # define MS_ENHANCED_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
444 'E','n','h','a','n','c','e','d',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ', \
445 'P','r','o','v','i','d','e','r',' ','v','1','.','0',0 }
446 #elif defined(_MSC_VER)
447 # define MS_ENHANCED_PROV_W L"Microsoft Enhanced Cryptographic Provider v1.0"
448 #else
449 static const WCHAR MS_ENHANCED_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
450 'E','n','h','a','n','c','e','d',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ',
451 'P','r','o','v','i','d','e','r',' ','v','1','.','0',0 };
452 #endif
453 #define MS_ENHANCED_PROV WINELIB_NAME_AW(MS_ENHANCED_PROV_)
455 #define MS_STRONG_PROV_A "Microsoft Strong Cryptographic Provider"
456 #if defined(__GNUC__)
457 # define MS_STRONG_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
458 'S','t','r','o','n','g',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ', \
459 'P','r','o','v','i','d','e','r',0 }
460 #elif defined(_MSC_VER)
461 # define MS_STRONG_PROV_W L"Microsoft Strong Cryptographic Provider"
462 #else
463 static const WCHAR MS_STRONG_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
464 'S','t','r','o','n','g',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ',
465 'P','r','o','v','i','d','e','r',0 };
466 #endif
467 #define MS_STRONG_PROV WINELIB_NAME_AW(MS_STRONG_PROV_)
469 #define MS_DEF_RSA_SIG_PROV_A "Microsoft RSA Signature Cryptographic Provider"
470 #if defined(__GNUC__)
471 # define MS_DEF_RSA_SIG_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
472 'R','S','A',' ','S','i','g','n','a','t','u','r','e',' ', \
473 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
474 #elif defined(_MSC_VER)
475 # define MS_DEF_RSA_SIG_PROV_W L"Microsoft RSA Signature Cryptographic Provider"
476 #else
477 static const WCHAR MS_DEF_RSA_SIG_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
478 'R','S','A',' ','S','i','g','n','a','t','u','r','e',' ',
479 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
480 #endif
481 #define MS_DEF_RSA_SIG_PROV WINELIB_NAME_AW(MS_DEF_RSA_SIG_PROV_)
483 #define MS_DEF_RSA_SCHANNEL_PROV_A "Microsoft RSA SChannel Cryptographic Provider"
484 #if defined(__GNUC__)
485 # define MS_DEF_RSA_SCHANNEL_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
486 'R','S','A',' ','S','C','h','a','n','n','e','l',' ', \
487 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
488 #elif defined(_MSC_VER)
489 # define MS_DEF_RSA_SCHANNEL_PROV_W L"Microsoft RSA SChannel Cryptographic Provider"
490 #else
491 static const WCHAR MS_DEF_RSA_SCHANNEL_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
492 'R','S','A',' ','S','C','h','a','n','n','e','l',' ',
493 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
494 #endif
495 #define MS_DEF_RSA_SCHANNEL_PROV WINELIB_NAME_AW(MS_DEF_RSA_SCHANNEL_PROV_)
497 #define MS_DEF_DSS_PROV_A "Microsoft Base DSS Cryptographic Provider"
498 #if defined(__GNUC__)
499 # define MS_DEF_DSS_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
500 'B','a','s','e',' ','D','S','S',' ', \
501 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
502 #elif defined(_MSC_VER)
503 # define MS_DEF_DSS_PROV_W L"Microsoft Base DSS Cryptographic Provider"
504 #else
505 static const WCHAR MS_DEF_DSS_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
506 'B','a','s','e',' ','D','S','S',' ',
507 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
508 #endif
509 #define MS_DEF_DSS_PROV WINELIB_NAME_AW(MS_DEF_DSS_PROV_)
511 #define MS_DEF_DSS_DH_PROV_A "Microsoft Base DSS and Diffie-Hellman Cryptographic Provider"
512 #if defined(__GNUC__)
513 # define MS_DEF_DSS_DH_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
514 'B','a','s','e',' ','D','S','S',' ','a','n','d',' ', \
515 'D','i','f','f','i','e','-','H','e','l','l','m','a','n',' ', \
516 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
517 #elif defined(_MSC_VER)
518 # define MS_DEF_DSS_DH_PROV_W L"Microsoft Base DSS and Diffie-Hellman Cryptographic Provider"
519 #else
520 static const WCHAR MS_DEF_DSS_DH_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
521 'B','a','s','e',' ','D','S','S',' ','a','n','d',' ',
522 'D','i','f','f','i','e','-','H','e','l','l','m','a','n',' ',
523 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
524 #endif
525 #define MS_DEF_DSS_DH_PROV WINELIB_NAME_AW(MS_DEF_DSS_DH_PROV_)
527 #define MS_ENH_DSS_DH_PROV_A "Microsoft Enhanced DSS and Diffie-Hellman Cryptographic Provider"
528 #if defined(__GNUC__)
529 # define MS_ENH_DSS_DH_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
530 'E','n','h','a','n','c','e','d',' ','D','S','S',' ','a','n','d',' ', \
531 'D','i','f','f','i','e','-','H','e','l','l','m','a','n',' ', \
532 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
533 #elif defined(_MSC_VER)
534 # define MS_ENH_DSS_DH_PROV_W L"Microsoft Enhanced DSS and Diffie-Hellman Cryptographic Provider"
535 #else
536 static const WCHAR MS_ENH_DSS_DH_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
537 'E','n','h','a','n','c','e','d',' ','D','S','S',' ','a','n','d',' ',
538 'D','i','f','f','i','e','-','H','e','l','l','m','a','n',' ',
539 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
540 #endif
541 #define MS_ENH_DSS_DH_PROV WINELIB_NAME_AW(MS_ENH_DSS_DH_PROV_)
543 #define MS_DEF_DH_SCHANNEL_PROV_A "Microsoft DH SChannel Cryptographic Provider"
544 #if defined(__GNUC__)
545 # define MS_DEF_DH_SCHANNEL_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
546 'D','H',' ','S','C','h','a','n','n','e','l',' ', \
547 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
548 #elif defined(_MSC_VER)
549 # define MS_DEF_DH_SCHANNEL_PROV_W L"Microsoft DH SChannel Cryptographic Provider"
550 #else
551 static const WCHAR MS_DEF_DH_SCHANNEL_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
552 'D','H',' ','S','C','h','a','n','n','e','l',' ',
553 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
554 #endif
555 #define MS_DEF_DH_SCHANNEL_PROV WINELIB_NAME_AW(MS_DEF_DH_SCHANNEL_PROV_)
557 #define MS_SCARD_PROV_A "Microsoft Base Smart Card Cryptographic Provider"
558 #if defined(__GNUC__)
559 # define MS_SCARD_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
560 'B','a','s','e',' ','S','m','a','r','t',' ','C','a','r','d',' ', \
561 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
562 #elif defined(_MSC_VER)
563 # define MS_SCARD_PROV_W L"Microsoft Base Smart Card Cryptographic Provider"
564 #else
565 static const WCHAR MS_SCARD_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
566 'B','a','s','e',' ','S','m','a','r','t',' ','C','a','r','d',' ',
567 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
568 #endif
569 #define MS_SCARD_PROV WINELIB_NAME_AW(MS_SCARD_PROV_)
571 /* Key Specs*/
572 #define AT_KEYEXCHANGE 1
573 #define AT_SIGNATURE 2
575 /* Provider Types */
576 #define PROV_RSA_FULL 1
577 #define PROV_RSA_SIG 2
578 #define PROV_DSS 3
579 #define PROV_FORTEZZA 4
580 #define PROV_MS_EXCHANGE 5
581 #define PROV_SSL 6
582 #define PROV_RSA_SCHANNEL 12
583 #define PROV_DSS_DH 13
584 #define PROV_EC_ECDSA_SIG 14
585 #define PROV_EC_ECNRA_SIG 15
586 #define PROV_EC_ECDSA_FULL 16
587 #define PROV_EC_ECNRA_FULL 17
588 #define PROV_DH_SCHANNEL 18
589 #define PROV_SPYRUS_LYNKS 20
590 #define PROV_RNG 21
591 #define PROV_INTEL_SEC 22
592 #define PROV_REPLACE_OWF 23
593 #define PROV_RSA_AES 24
595 /* FLAGS Section */
597 /* Provider Parameters */
598 #define PP_ENUMALGS 1
599 #define PP_ENUMCONTAINERS 2
600 #define PP_IMPTYPE 3
601 #define PP_NAME 4
602 #define PP_VERSION 5
603 #define PP_CONTAINER 6
605 #define CRYPT_FIRST 1
606 #define CRYPT_NEXT 2
608 #define CRYPT_IMPL_HARDWARE 1
609 #define CRYPT_IMPL_SOFTWARE 2
610 #define CRYPT_IMPL_MIXED 3
611 #define CRYPT_IMPL_UNKNOWN 4
613 /* CryptAcquireContext */
614 #define CRYPT_VERIFYCONTEXT 0xF0000000
615 #define CRYPT_NEWKEYSET 0x00000008
616 #define CRYPT_MACHINE_KEYSET 0x00000000
617 #define CRYPT_DELETEKEYSET 0x00000010
618 #define CRYPT_SILENT 0x00000000
620 /* Crypt{Get|Set}Provider */
621 #define CRYPT_MACHINE_DEFAULT 0x00000001
622 #define CRYPT_USER_DEFAULT 0x00000002
623 #define CRYPT_DELETE_DEFAULT 0x00000004
625 /* Crypt{Get/Set}ProvParam */
626 #define PP_CLIENT_HWND 1
627 #define PP_ENUMALGS 1
628 #define PP_ENUMCONTAINERS 2
629 #define PP_IMPTYPE 3
630 #define PP_NAME 4
631 #define PP_VERSION 5
632 #define PP_CONTAINER 6
633 #define PP_CHANGE_PASSWORD 7
634 #define PP_KEYSET_SEC_DESCR 8
635 #define PP_KEY_TYPE_SUBTYPE 10
636 #define PP_CONTEXT_INFO 11
637 #define PP_KEYEXCHANGE_KEYSIZE 12
638 #define PP_SIGNATURE_KEYSIZE 13
639 #define PP_KEYEXCHANGE_ALG 14
640 #define PP_SIGNATURE_ALG 15
641 #define PP_PROVTYPE 16
642 #define PP_KEYSTORAGE 17
643 #define PP_SYM_KEYSIZE 19
644 #define PP_SESSION_KEYSIZE 20
645 #define PP_UI_PROMPT 21
646 #define PP_ENUMALGS_EX 22
647 #define PP_DELETEKEY 24
648 #define PP_ENUMMANDROOTS 25
649 #define PP_ENUMELECTROOTS 26
650 #define PP_KEYSET_TYPE 27
651 #define PP_ADMIN_PIN 31
652 #define PP_KEYEXCHANGE_PIN 32
653 #define PP_SIGNATURE_PIN 33
654 #define PP_SIG_KEYSIZE_INC 34
655 #define PP_KEYX_KEYSIZE_INC 35
656 #define PP_UNIQUE_CONTAINER 36
657 #define PP_SGC_INFO 37
658 #define PP_USE_HARDWARE_RNG 38
659 #define PP_KEYSPEC 39
660 #define PP_ENUMEX_SIGNING_PROT 40
662 /* CryptSignHash/CryptVerifySignature */
663 #define CRYPT_NOHASHOID 0x00000001
664 #define CRYPT_TYPE2_FORMAT 0x00000002
665 #define CRYPT_X931_FORMAT 0x00000004
667 /* Crypt{Get,Set}HashParam */
668 #define HP_ALGID 0x0001
669 #define HP_HASHVAL 0x0002
670 #define HP_HASHSIZE 0x0004
671 #define HP_HMAC_INFO 0x0005
672 #define HP_TLS1PRF_LABEL 0x0006
673 #define HP_TLS1PRF_SEED 0x0007
675 /* Crypt*Key */
676 #define CRYPT_EXPORTABLE 0x00000001
677 #define CRYPT_USER_PROTECTED 0x00000002
678 #define CRYPT_CREATE_SALT 0x00000004
679 #define CRYPT_UPDATE_KEY 0x00000008
680 #define CRYPT_NO_SALT 0x00000010
681 #define CRYPT_PREGEN 0x00000040
682 #define CRYPT_ARCHIVABLE 0x00004000
683 #define CRYPT_SSL2_FALLBACK 0x00000002
684 #define CRYPT_DESTROYKEY 0x00000004
685 #define CRYPT_OAEP 0x00000040
687 /* Blob Types */
688 #define SIMPLEBLOB 0x1
689 #define PUBLICKEYBLOB 0x6
690 #define PRIVATEKEYBLOB 0x7
691 #define PLAINTEXTKEYBLOB 0x8
692 #define OPAQUEKEYBLOB 0x9
693 #define PUBLICKEYBLOBEX 0xA
694 #define SYMMETRICWRAPKEYBLOB 0xB
696 /* cert store provider types */
697 #define CERT_STORE_PROV_MSG ((LPCSTR)1)
698 #define CERT_STORE_PROV_MEMORY ((LPCSTR)2)
699 #define CERT_STORE_PROV_FILE ((LPCSTR)3)
700 #define CERT_STORE_PROV_REG ((LPCSTR)4)
701 #define CERT_STORE_PROV_PKCS7 ((LPCSTR)5)
702 #define CERT_STORE_PROV_SERIALIZED ((LPCSTR)6)
703 #define CERT_STORE_PROV_FILENAME_A ((LPCSTR)7)
704 #define CERT_STORE_PROV_FILENAME_W ((LPCSTR)8)
705 #define CERT_STORE_PROV_SYSTEM_A ((LPCSTR)9)
706 #define CERT_STORE_PROV_SYSTEM_W ((LPCSTR)10)
707 #define CERT_STORE_PROV_SYSTEM CERT_STORE_PROV_SYSTEM_W
708 #define CERT_STORE_PROV_COLLECTION ((LPCSTR)11)
709 #define CERT_STORE_PROV_SYSTEM_REGISTRY_A ((LPCSTR)12)
710 #define CERT_STORE_PROV_SYSTEM_REGISTRY_W ((LPCSTR)13)
711 #define CERT_STORE_PROV_SYSTEM_REGISTRY CERT_STORE_PROV_SYSTEM_REGISTRY_W
712 #define CERT_STORE_PROV_PHYSICAL_W ((LPCSTR)14)
713 #define CERT_STORE_PROV_PHYSICAL CERT_STORE_PROV_PHYSICAL_W
714 #define CERT_STORE_PROV_SMART_CARD_W ((LPCSTR)15)
715 #define CERT_STORE_PROV_SMART_CARD CERT_STORE_PROV_SMART_CARD_W
716 #define CERT_STORE_PROV_LDAP_W ((LPCSTR)16)
717 #define CERT_STORE_PROV_LDAP CERT_STORE_PROV_LDAP_W
719 #define sz_CERT_STORE_PROV_MEMORY "Memory"
720 #define sz_CERT_STORE_PROV_FILENAME_W "File"
721 #define sz_CERT_STORE_PROV_FILENAME sz_CERT_STORE_PROV_FILENAME_W
722 #define sz_CERT_STORE_PROV_SYSTEM_W "System"
723 #define sz_CERT_STORE_PROV_SYSTEM sz_CERT_STORE_PROV_SYSTEM_W
724 #define sz_CERT_STORE_PROV_PKCS7 "PKCS7"
725 #define sz_CERT_STORE_PROV_SERIALIZED "Serialized"
726 #define sz_CERT_STORE_PROV_COLLECTION "Collection"
727 #define sz_CERT_STORE_PROV_SYSTEM_REGISTRY_W "SystemRegistry"
728 #define sz_CERT_STORE_PROV_SYSTEM_REGISTRY sz_CERT_STORE_PROV_SYSTEM_REGISTRY_W
729 #define sz_CERT_STORE_PROV_PHYSICAL_W "Physical"
730 #define sz_CERT_STORE_PROV_PHYSICAL sz_CERT_STORE_PROV_PHYSICAL_W
731 #define sz_CERT_STORE_PROV_SMART_CARD_W "SmartCard"
732 #define sz_CERT_STORE_PROV_SMART_CARD sz_CERT_STORE_PROV_SMART_CARD_W
733 #define sz_CERT_STORE_PROV_LDAP_W "Ldap"
734 #define sz_CERT_STORE_PROV_LDAP sz_CERT_STORE_PROV_LDAP_W
736 /* types for CertOpenStore dwEncodingType */
737 #define X509_ASN_ENCODING 0x00000001
738 #define X509_NDR_ENCODING 0x00000002
739 #define PKCS_7_ASN_ENCODING 0x00010000
740 #define PKCS_7_NDR_ENCODING 0x00020000
742 /* system store locations */
743 #define CERT_SYSTEM_STORE_LOCATION_MASK 0x00ff0000
744 #define CERT_SYSTEM_STORE_LOCATION_SHIFT 16
746 /* system store location ids */
747 /* hkcu */
748 #define CERT_SYSTEM_STORE_CURRENT_USER_ID 1
749 /* hklm */
750 #define CERT_SYSTEM_STORE_LOCAL_MACHINE_ID 2
751 /* hklm\Software\Microsoft\Cryptography\Services */
752 #define CERT_SYSTEM_STORE_CURRENT_SERVICE_ID 4
753 #define CERT_SYSTEM_STORE_SERVICES_ID 5
754 /* HKEY_USERS */
755 #define CERT_SYSTEM_STORE_USERS_ID 6
756 /* hkcu\Software\Microsoft\Policies\Microsoft\SystemCertificates */
757 #define CERT_SYSTEM_STORE_CURRENT_USER_GROUP_POLICY_ID 7
758 /* hklm\Software\Microsoft\Policies\Microsoft\SystemCertificates */
759 #define CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY_ID 8
760 /* hklm\Software\Microsoft\EnterpriseCertificates */
761 #define CERT_SYSTEM_STORE_LOCAL_MACHINE_ENTERPRISE_ID 9
763 /* system store location values */
764 #define CERT_SYSTEM_STORE_CURRENT_USER \
765 (CERT_SYSTEM_STORE_CURRENT_USER_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
766 #define CERT_SYSTEM_STORE_LOCAL_MACHINE \
767 (CERT_SYSTEM_STORE_LOCAL_MACHINE_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
768 #define CERT_SYSTEM_STORE_CURRENT_SERVICE \
769 (CERT_SYSTEM_STORE_CURRENT_SERVICE_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
770 #define CERT_SYSTEM_STORE_SERVICE \
771 (CERT_SYSTEM_STORE_SERVICES_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
772 #define CERT_SYSTEM_STORE_USERS \
773 (CERT_SYSTEM_STORE_USERS_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
774 #define CERT_SYSTEM_STORE_CURRENT_USER_GROUP_POLICY \
775 (CERT_SYSTEM_STORE_CURRENT_USER_GROUP_POLICY_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
776 #define CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY \
777 (CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
778 #define CERT_SYSTEM_STORE_LOCAL_MACHINE_ENTERPRISE \
779 (CERT_SYSTEM_STORE_LOCAL_MACHINE_ENTERPRISE_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
781 /* flags for CertOpenStore dwFlags */
782 #define CERT_STORE_NO_CRYPT_RELEASE_FLAG 0x00000001
783 #define CERT_STORE_SET_LOCALIZED_NAME_FLAG 0x00000002
784 #define CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG 0x00000004
785 #define CERT_STORE_DELETE_FLAG 0x00000010
786 #define CERT_STORE_UNSAFE_PHYSICAL_FLAG 0x00000020
787 #define CERT_STORE_SHARE_STORE_FLAG 0x00000040
788 #define CERT_STORE_SHARE_CONTEXT_FLAG 0x00000080
789 #define CERT_STORE_MANIFOLD_FLAG 0x00000100
790 #define CERT_STORE_ENUM_ARCHIVED_FLAG 0x00000200
791 #define CERT_STORE_UPDATE_KEYID_FLAG 0x00000400
792 #define CERT_STORE_BACKUP_RESTORE_FLAG 0x00000800
793 #define CERT_STORE_MAXIMUM_ALLOWED_FLAG 0x00001000
794 #define CERT_STORE_CREATE_NEW_FLAG 0x00002000
795 #define CERT_STORE_OPEN_EXISTING_FLAG 0x00004000
796 #define CERT_STORE_READONLY_FLAG 0x00008000
798 /* physical store dwFlags, also used by CertAddStoreToCollection as
799 * dwUpdateFlags
801 #define CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG 0x1
802 #define CERT_PHYSICAL_STORE_OPEN_DISABLE_FLAG 0x2
803 #define CERT_PHYSICAL_STORE_REMOVE_OPEN_DISABLE_FLAG 0x4
804 #define CERT_PHYSICAL_STORE_INSERT_COMPUTER_NAME_ENABLE_FLAG 0x8
806 /* dwFlag values for CertEnumPhysicalStore callback */
807 #define CERT_PHYSICAL_STORE_PREDEFINED_ENUM_FLAG 0x1
809 /* predefined store names */
810 #if defined(__GNUC__)
811 # define CERT_PHYSICAL_STORE_DEFAULT_NAME (const WCHAR[])\
812 {'.','D','e','f','a','u','l','t','0'}
813 # define CERT_PHYSICAL_STORE_GROUP_POLICY_NAME (const WCHAR[])\
814 {'.','G','r','o','u','p','P','o','l','i','c','y',0}
815 # define CERT_PHYSICAL_STORE_LOCAL_MACHINE_NAME (const WCHAR[])\
816 {'.','L','o','c','a','l','M','a','c','h','i','n','e',0}
817 # define CERT_PHYSICAL_STORE_DS_USER_CERTIFICATE_NAME (const WCHAR[])\
818 {'.','U','s','e','r','C','e','r','t','i','f','i','c','a','t','e',0}
819 # define CERT_PHYSICAL_STORE_LOCAL_MACHINE_GROUP_POLICY_NAME (const WCHAR[])\
820 {'.','L','o','c','a','l','M','a','c','h','i','n','e','G','r','o','u','p',\
821 'P','o','l','i','c','y',0}
822 # define CERT_PHYSICAL_STORE_ENTERPRISE_NAME (const WCHAR[])\
823 {'.','E','n','t','e','r','p','r','i','s','e',0}
824 # define CERT_PHYSICAL_STORE_AUTH_ROOT_NAME (const WCHAR[])\
825 {'.','A','u','t','h','R','o','o','t',0}
826 #elif defined(_MSC_VER)
827 # define CERT_PHYSICAL_STORE_DEFAULT_NAME \
828 L".Default"
829 # define CERT_PHYSICAL_STORE_GROUP_POLICY_NAME \
830 L".GroupPolicy"
831 # define CERT_PHYSICAL_STORE_LOCAL_MACHINE_NAME \
832 L".LocalMachine"
833 # define CERT_PHYSICAL_STORE_DS_USER_CERTIFICATE_NAME \
834 L".UserCertificate"
835 # define CERT_PHYSICAL_STORE_LOCAL_MACHINE_GROUP_POLICY_NAME \
836 L".LocalMachineGroupPolicy"
837 # define CERT_PHYSICAL_STORE_ENTERPRISE_NAME \
838 L".Enterprise"
839 # define CERT_PHYSICAL_STORE_AUTH_ROOT_NAME \
840 L".AuthRoot"
841 #else
842 static const WCHAR CERT_PHYSICAL_STORE_DEFAULT_NAME[] =
843 {'.','D','e','f','a','u','l','t','0'};
844 static const WCHAR CERT_PHYSICAL_STORE_GROUP_POLICY_NAME[] =
845 {'.','G','r','o','u','p','P','o','l','i','c','y',0};
846 static const WCHAR CERT_PHYSICAL_STORE_LOCAL_MACHINE_NAME[] =
847 {'.','L','o','c','a','l','M','a','c','h','i','n','e',0};
848 static const WCHAR CERT_PHYSICAL_STORE_DS_USER_CERTIFICATE_NAME[] =
849 {'.','U','s','e','r','C','e','r','t','i','f','i','c','a','t','e',0};
850 static const WCHAR CERT_PHYSICAL_STORE_LOCAL_MACHINE_GROUP_POLICY_NAME[] =
851 {'.','L','o','c','a','l','M','a','c','h','i','n','e','G','r','o','u','p',
852 'P','o','l','i','c','y',0};
853 static const WCHAR CERT_PHYSICAL_STORE_ENTERPRISE_NAME[] =
854 {'.','E','n','t','e','r','p','r','i','s','e',0};
855 static const WCHAR CERT_PHYSICAL_STORE_AUTH_ROOT_NAME[] =
856 {'.','A','u','t','h','R','o','o','t',0};
857 #endif
859 /* cert system store flags */
860 #define CERT_SYSTEM_STORE_MASK 0xffff0000
861 #define CERT_SYSTEM_STORE_RELOCATE_FLAG 0x80000000
863 /* CertFindChainInStore dwFindType types */
864 #define CERT_CHAIN_FIND_BY_ISSUER 1
866 /* function declarations */
867 /* advapi32.dll */
868 BOOL WINAPI CryptAcquireContextA(HCRYPTPROV *phProv, LPCSTR pszContainer,
869 LPCSTR pszProvider, DWORD dwProvType,
870 DWORD dwFlags);
871 BOOL WINAPI CryptAcquireContextW (HCRYPTPROV *phProv, LPCWSTR pszContainer,
872 LPCWSTR pszProvider, DWORD dwProvType, DWORD dwFlags);
873 #define CryptAcquireContext WINELIB_NAME_AW(CryptAcquireContext)
874 BOOL WINAPI CryptGenRandom (HCRYPTPROV hProv, DWORD dwLen, BYTE *pbBuffer);
875 BOOL WINAPI CryptContextAddRef (HCRYPTPROV hProv, DWORD *pdwReserved, DWORD dwFlags);
876 BOOL WINAPI CryptCreateHash (HCRYPTPROV hProv, ALG_ID Algid, HCRYPTKEY hKey,
877 DWORD dwFlags, HCRYPTHASH *phHash);
878 BOOL WINAPI CryptDecrypt (HCRYPTKEY hKey, HCRYPTHASH hHash, BOOL Final,
879 DWORD dwFlags, BYTE *pbData, DWORD *pdwDataLen);
880 BOOL WINAPI CryptDeriveKey (HCRYPTPROV hProv, ALG_ID Algid, HCRYPTHASH hBaseData,
881 DWORD dwFlags, HCRYPTKEY *phKey);
882 BOOL WINAPI CryptDestroyHash (HCRYPTHASH hHash);
883 BOOL WINAPI CryptDestroyKey (HCRYPTKEY hKey);
884 BOOL WINAPI CryptDuplicateKey (HCRYPTKEY hKey, DWORD *pdwReserved, DWORD dwFlags, HCRYPTKEY *phKey);
885 BOOL WINAPI CryptDuplicateHash (HCRYPTHASH hHash, DWORD *pdwReserved,
886 DWORD dwFlags, HCRYPTHASH *phHash);
887 BOOL WINAPI CryptEncrypt (HCRYPTKEY hKey, HCRYPTHASH hHash, BOOL Final,
888 DWORD dwFlags, BYTE *pbData, DWORD *pdwDataLen, DWORD dwBufLen);
889 BOOL WINAPI CryptEnumProvidersA (DWORD dwIndex, DWORD *pdwReserved,
890 DWORD dwFlags, DWORD *pdwProvType, LPSTR pszProvName, DWORD *pcbProvName);
891 BOOL WINAPI CryptEnumProvidersW (DWORD dwIndex, DWORD *pdwReserved,
892 DWORD dwFlags, DWORD *pdwProvType, LPWSTR pszProvName, DWORD *pcbProvName);
893 #define CryptEnumProviders WINELIB_NAME_AW(CryptEnumProviders)
894 BOOL WINAPI CryptEnumProviderTypesA (DWORD dwIndex, DWORD *pdwReserved,
895 DWORD dwFlags, DWORD *pdwProvType, LPSTR pszTypeName, DWORD *pcbTypeName);
896 BOOL WINAPI CryptEnumProviderTypesW (DWORD dwIndex, DWORD *pdwReserved,
897 DWORD dwFlags, DWORD *pdwProvType, LPWSTR pszTypeName, DWORD *pcbTypeName);
898 #define CryptEnumProviderTypes WINELIB_NAME_AW(CryptEnumProviderTypes)
899 BOOL WINAPI CryptExportKey (HCRYPTKEY hKey, HCRYPTKEY hExpKey, DWORD dwBlobType,
900 DWORD dwFlags, BYTE *pbData, DWORD *pdwDataLen);
901 BOOL WINAPI CryptGenKey (HCRYPTPROV hProv, ALG_ID Algid, DWORD dwFlags, HCRYPTKEY *phKey);
902 BOOL WINAPI CryptGetKeyParam (HCRYPTKEY hKey, DWORD dwParam, BYTE *pbData,
903 DWORD *pdwDataLen, DWORD dwFlags);
904 BOOL WINAPI CryptGetHashParam (HCRYPTHASH hHash, DWORD dwParam, BYTE *pbData,
905 DWORD *pdwDataLen, DWORD dwFlags);
906 BOOL WINAPI CryptGetProvParam (HCRYPTPROV hProv, DWORD dwParam, BYTE *pbData,
907 DWORD *pdwDataLen, DWORD dwFlags);
908 BOOL WINAPI CryptGetDefaultProviderA (DWORD dwProvType, DWORD *pdwReserved,
909 DWORD dwFlags, LPSTR pszProvName, DWORD *pcbProvName);
910 BOOL WINAPI CryptGetDefaultProviderW (DWORD dwProvType, DWORD *pdwReserved,
911 DWORD dwFlags, LPWSTR pszProvName, DWORD *pcbProvName);
912 #define CryptGetDefaultProvider WINELIB_NAME_AW(CryptGetDefaultProvider)
913 BOOL WINAPI CryptGetUserKey (HCRYPTPROV hProv, DWORD dwKeySpec, HCRYPTKEY *phUserKey);
914 BOOL WINAPI CryptHashData (HCRYPTHASH hHash, BYTE *pbData, DWORD dwDataLen, DWORD dwFlags);
915 BOOL WINAPI CryptHashSessionKey (HCRYPTHASH hHash, HCRYPTKEY hKey, DWORD dwFlags);
916 BOOL WINAPI CryptImportKey (HCRYPTPROV hProv, BYTE *pbData, DWORD dwDataLen,
917 HCRYPTKEY hPubKey, DWORD dwFlags, HCRYPTKEY *phKey);
918 BOOL WINAPI CryptRegisterOIDFunction(DWORD,LPCSTR,LPCSTR,LPCWSTR,LPCSTR);
920 BOOL WINAPI CryptReleaseContext (HCRYPTPROV hProv, DWORD dwFlags);
921 BOOL WINAPI CryptSignHashA (HCRYPTHASH hHash, DWORD dwKeySpec, LPCSTR sDescription,
922 DWORD dwFlags, BYTE *pbSignature, DWORD *pdwSigLen);
923 BOOL WINAPI CryptSignHashW (HCRYPTHASH hHash, DWORD dwKeySpec, LPCWSTR sDescription,
924 DWORD dwFlags, BYTE *pbSignature, DWORD *pdwSigLen);
925 #define CryptSignHash WINELIB_NAME_AW(CryptSignHash)
926 BOOL WINAPI CryptSetHashParam (HCRYPTHASH hHash, DWORD dwParam, BYTE *pbData, DWORD dwFlags);
927 BOOL WINAPI CryptSetKeyParam (HCRYPTKEY hKey, DWORD dwParam, BYTE *pbData, DWORD dwFlags);
928 BOOL WINAPI CryptSetProviderA (LPCSTR pszProvName, DWORD dwProvType);
929 BOOL WINAPI CryptSetProviderW (LPCWSTR pszProvName, DWORD dwProvType);
930 #define CryptSetProvider WINELIB_NAME_AW(CryptSetProvider)
931 BOOL WINAPI CryptSetProviderExA (LPCSTR pszProvName, DWORD dwProvType, DWORD *pdwReserved, DWORD dwFlags);
932 BOOL WINAPI CryptSetProviderExW (LPCWSTR pszProvName, DWORD dwProvType, DWORD *pdwReserved, DWORD dwFlags);
933 #define CryptSetProviderEx WINELIB_NAME_AW(CryptSetProviderEx)
934 BOOL WINAPI CryptSetProvParam (HCRYPTPROV hProv, DWORD dwParam, BYTE *pbData, DWORD dwFlags);
935 BOOL WINAPI CryptVerifySignatureA (HCRYPTHASH hHash, BYTE *pbSignature, DWORD dwSigLen,
936 HCRYPTKEY hPubKey, LPCSTR sDescription, DWORD dwFlags);
937 BOOL WINAPI CryptVerifySignatureW (HCRYPTHASH hHash, BYTE *pbSignature, DWORD dwSigLen,
938 HCRYPTKEY hPubKey, LPCWSTR sDescription, DWORD dwFlags);
939 #define CryptVerifySignature WINELIB_NAME_AW(CryptVerifySignature)
941 /* cert store functions */
942 HCERTSTORE WINAPI CertOpenStore(LPCSTR lpszStoreProvider, DWORD dwEncodingType,
943 HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara);
945 HCERTSTORE WINAPI CertOpenSystemStoreA(HCRYPTPROV hProv,
946 LPCSTR szSubSystemProtocol);
947 HCERTSTORE WINAPI CertOpenSystemStoreW(HCRYPTPROV hProv,
948 LPCWSTR szSubSystemProtocol);
949 #define CertOpenSystemStore WINELIB_NAME_AW(CertOpenSystemStore)
951 PCCERT_CONTEXT WINAPI CertEnumCertificatesInStore(HCERTSTORE hCertStore, PCCERT_CONTEXT pPrev);
953 BOOL WINAPI CertEnumSystemStoreLocation(DWORD dwFlags, void *pvArg,
954 PFN_CERT_ENUM_SYSTEM_STORE_LOCATION pfnEnum);
956 BOOL WINAPI CertEnumSystemStore(DWORD dwFlags, void *pvSystemStoreLocationPara,
957 void *pvArg, PFN_CERT_ENUM_SYSTEM_STORE pfnEnum);
959 BOOL WINAPI CertEnumPhysicalStore(const void *pvSystemStore, DWORD dwFlags,
960 void *pvArg, PFN_CERT_ENUM_PHYSICAL_STORE pfnEnum);
962 BOOL WINAPI CertSaveStore(HCERTSTORE hCertStore, DWORD dwMsgAndCertEncodingType,
963 DWORD dwSaveAs, DWORD dwSaveTo, void* pvSaveToPara, DWORD dwFlags);
965 PCCRL_CONTEXT WINAPI CertCreateCRLContext( DWORD dwCertEncodingType,
966 const BYTE* pbCrlEncoded, DWORD cbCrlEncoded);
968 BOOL WINAPI CertAddStoreToCollection(HCERTSTORE hCollectionStore,
969 HCERTSTORE hSiblingStore, DWORD dwUpdateFlags, DWORD dwPriority);
971 void WINAPI CertRemoveStoreFromCollection(HCERTSTORE hCollectionStore,
972 HCERTSTORE hSiblingStore);
974 PCCERT_CHAIN_CONTEXT WINAPI CertFindChainInStore(HCERTSTORE hCertStore,
975 DWORD dwCertEncodingType, DWORD dwFindFlags, DWORD dwFindType,
976 const void *pvFindPara, PCCERT_CHAIN_CONTEXT pPrevChainContext);
978 BOOL WINAPI CertVerifyCertificateChainPolicy(LPCSTR szPolicyOID,
979 PCCERT_CHAIN_CONTEXT pChainContext, PCERT_CHAIN_POLICY_PARA pPolicyPara,
980 PCERT_CHAIN_POLICY_STATUS pPolicyStatus);
982 BOOL WINAPI CertCloseStore( HCERTSTORE hCertStore, DWORD dwFlags );
984 BOOL WINAPI CertFreeCertificateContext( PCCERT_CONTEXT pCertContext );
986 #ifdef __cplusplus
988 #endif
990 #endif