Add dev hint line for itss (part of html help).
[wine.git] / include / wincrypt.h
blob3ecb9a2714f5a95075035d59acd9a8ed68b1cc01
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 /* Crypt{Get/Set}KeyParam */
663 #define KP_IV 1
664 #define KP_SALT 2
665 #define KP_PADDING 3
666 #define KP_MODE 4
667 #define KP_MODE_BITS 5
668 #define KP_PERMISSIONS 6
669 #define KP_ALGID 7
670 #define KP_BLOCKLEN 8
671 #define KP_KEYLEN 9
672 #define KP_SALT_EX 10
673 #define KP_P 11
674 #define KP_G 12
675 #define KP_Q 13
676 #define KP_X 14
677 #define KP_Y 15
678 #define KP_RA 16
679 #define KP_RB 17
680 #define KP_INFO 18
681 #define KP_EFFECTIVE_KEYLEN 19
682 #define KP_SCHANNEL_ALG 20
683 #define KP_CLIENT_RANDOM 21
684 #define KP_SERVER_RANDOM 22
685 #define KP_RP 23
686 #define KP_PRECOMP_MD5 24
687 #define KP_PRECOMP_SHA 25
688 #define KP_CERTIFICATE 26
689 #define KP_CLEAR_KEY 27
690 #define KP_PUB_EX_LEN 28
691 #define KP_PUB_EX_VAL 29
692 #define KP_KEYVAL 30
693 #define KP_ADMIN_PIN 31
694 #define KP_KEYEXCHANGE_PIN 32
695 #define KP_SIGNATURE_PIN 33
696 #define KP_PREHASH 34
698 /* CryptSignHash/CryptVerifySignature */
699 #define CRYPT_NOHASHOID 0x00000001
700 #define CRYPT_TYPE2_FORMAT 0x00000002
701 #define CRYPT_X931_FORMAT 0x00000004
703 /* Crypt{Get,Set}HashParam */
704 #define HP_ALGID 0x0001
705 #define HP_HASHVAL 0x0002
706 #define HP_HASHSIZE 0x0004
707 #define HP_HMAC_INFO 0x0005
708 #define HP_TLS1PRF_LABEL 0x0006
709 #define HP_TLS1PRF_SEED 0x0007
711 /* Crypt{Get,Set}KeyParam */
712 #define CRYPT_MODE_CBC 1
713 #define CRYPT_MODE_ECB 2
714 #define CRYPT_MODE_OFB 3
715 #define CRYPT_MODE_CFB 4
717 #define CRYPT_ENCRYPT 0x0001
718 #define CRYPT_DECRYPT 0x0002
719 #define CRYPT_EXPORT 0x0004
720 #define CRYPT_READ 0x0008
721 #define CRYPT_WRITE 0x0010
722 #define CRYPT_MAC 0x0020
724 /* Crypt*Key */
725 #define CRYPT_EXPORTABLE 0x00000001
726 #define CRYPT_USER_PROTECTED 0x00000002
727 #define CRYPT_CREATE_SALT 0x00000004
728 #define CRYPT_UPDATE_KEY 0x00000008
729 #define CRYPT_NO_SALT 0x00000010
730 #define CRYPT_PREGEN 0x00000040
731 #define CRYPT_ARCHIVABLE 0x00004000
732 #define CRYPT_SSL2_FALLBACK 0x00000002
733 #define CRYPT_DESTROYKEY 0x00000004
734 #define CRYPT_OAEP 0x00000040
736 /* Blob Types */
737 #define SIMPLEBLOB 0x1
738 #define PUBLICKEYBLOB 0x6
739 #define PRIVATEKEYBLOB 0x7
740 #define PLAINTEXTKEYBLOB 0x8
741 #define OPAQUEKEYBLOB 0x9
742 #define PUBLICKEYBLOBEX 0xA
743 #define SYMMETRICWRAPKEYBLOB 0xB
745 /* cert store provider types */
746 #define CERT_STORE_PROV_MSG ((LPCSTR)1)
747 #define CERT_STORE_PROV_MEMORY ((LPCSTR)2)
748 #define CERT_STORE_PROV_FILE ((LPCSTR)3)
749 #define CERT_STORE_PROV_REG ((LPCSTR)4)
750 #define CERT_STORE_PROV_PKCS7 ((LPCSTR)5)
751 #define CERT_STORE_PROV_SERIALIZED ((LPCSTR)6)
752 #define CERT_STORE_PROV_FILENAME_A ((LPCSTR)7)
753 #define CERT_STORE_PROV_FILENAME_W ((LPCSTR)8)
754 #define CERT_STORE_PROV_SYSTEM_A ((LPCSTR)9)
755 #define CERT_STORE_PROV_SYSTEM_W ((LPCSTR)10)
756 #define CERT_STORE_PROV_SYSTEM CERT_STORE_PROV_SYSTEM_W
757 #define CERT_STORE_PROV_COLLECTION ((LPCSTR)11)
758 #define CERT_STORE_PROV_SYSTEM_REGISTRY_A ((LPCSTR)12)
759 #define CERT_STORE_PROV_SYSTEM_REGISTRY_W ((LPCSTR)13)
760 #define CERT_STORE_PROV_SYSTEM_REGISTRY CERT_STORE_PROV_SYSTEM_REGISTRY_W
761 #define CERT_STORE_PROV_PHYSICAL_W ((LPCSTR)14)
762 #define CERT_STORE_PROV_PHYSICAL CERT_STORE_PROV_PHYSICAL_W
763 #define CERT_STORE_PROV_SMART_CARD_W ((LPCSTR)15)
764 #define CERT_STORE_PROV_SMART_CARD CERT_STORE_PROV_SMART_CARD_W
765 #define CERT_STORE_PROV_LDAP_W ((LPCSTR)16)
766 #define CERT_STORE_PROV_LDAP CERT_STORE_PROV_LDAP_W
768 #define sz_CERT_STORE_PROV_MEMORY "Memory"
769 #define sz_CERT_STORE_PROV_FILENAME_W "File"
770 #define sz_CERT_STORE_PROV_FILENAME sz_CERT_STORE_PROV_FILENAME_W
771 #define sz_CERT_STORE_PROV_SYSTEM_W "System"
772 #define sz_CERT_STORE_PROV_SYSTEM sz_CERT_STORE_PROV_SYSTEM_W
773 #define sz_CERT_STORE_PROV_PKCS7 "PKCS7"
774 #define sz_CERT_STORE_PROV_SERIALIZED "Serialized"
775 #define sz_CERT_STORE_PROV_COLLECTION "Collection"
776 #define sz_CERT_STORE_PROV_SYSTEM_REGISTRY_W "SystemRegistry"
777 #define sz_CERT_STORE_PROV_SYSTEM_REGISTRY sz_CERT_STORE_PROV_SYSTEM_REGISTRY_W
778 #define sz_CERT_STORE_PROV_PHYSICAL_W "Physical"
779 #define sz_CERT_STORE_PROV_PHYSICAL sz_CERT_STORE_PROV_PHYSICAL_W
780 #define sz_CERT_STORE_PROV_SMART_CARD_W "SmartCard"
781 #define sz_CERT_STORE_PROV_SMART_CARD sz_CERT_STORE_PROV_SMART_CARD_W
782 #define sz_CERT_STORE_PROV_LDAP_W "Ldap"
783 #define sz_CERT_STORE_PROV_LDAP sz_CERT_STORE_PROV_LDAP_W
785 /* types for CertOpenStore dwEncodingType */
786 #define X509_ASN_ENCODING 0x00000001
787 #define X509_NDR_ENCODING 0x00000002
788 #define PKCS_7_ASN_ENCODING 0x00010000
789 #define PKCS_7_NDR_ENCODING 0x00020000
791 /* system store locations */
792 #define CERT_SYSTEM_STORE_LOCATION_MASK 0x00ff0000
793 #define CERT_SYSTEM_STORE_LOCATION_SHIFT 16
795 /* system store location ids */
796 /* hkcu */
797 #define CERT_SYSTEM_STORE_CURRENT_USER_ID 1
798 /* hklm */
799 #define CERT_SYSTEM_STORE_LOCAL_MACHINE_ID 2
800 /* hklm\Software\Microsoft\Cryptography\Services */
801 #define CERT_SYSTEM_STORE_CURRENT_SERVICE_ID 4
802 #define CERT_SYSTEM_STORE_SERVICES_ID 5
803 /* HKEY_USERS */
804 #define CERT_SYSTEM_STORE_USERS_ID 6
805 /* hkcu\Software\Microsoft\Policies\Microsoft\SystemCertificates */
806 #define CERT_SYSTEM_STORE_CURRENT_USER_GROUP_POLICY_ID 7
807 /* hklm\Software\Microsoft\Policies\Microsoft\SystemCertificates */
808 #define CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY_ID 8
809 /* hklm\Software\Microsoft\EnterpriseCertificates */
810 #define CERT_SYSTEM_STORE_LOCAL_MACHINE_ENTERPRISE_ID 9
812 /* system store location values */
813 #define CERT_SYSTEM_STORE_CURRENT_USER \
814 (CERT_SYSTEM_STORE_CURRENT_USER_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
815 #define CERT_SYSTEM_STORE_LOCAL_MACHINE \
816 (CERT_SYSTEM_STORE_LOCAL_MACHINE_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
817 #define CERT_SYSTEM_STORE_CURRENT_SERVICE \
818 (CERT_SYSTEM_STORE_CURRENT_SERVICE_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
819 #define CERT_SYSTEM_STORE_SERVICE \
820 (CERT_SYSTEM_STORE_SERVICES_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
821 #define CERT_SYSTEM_STORE_USERS \
822 (CERT_SYSTEM_STORE_USERS_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
823 #define CERT_SYSTEM_STORE_CURRENT_USER_GROUP_POLICY \
824 (CERT_SYSTEM_STORE_CURRENT_USER_GROUP_POLICY_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
825 #define CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY \
826 (CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
827 #define CERT_SYSTEM_STORE_LOCAL_MACHINE_ENTERPRISE \
828 (CERT_SYSTEM_STORE_LOCAL_MACHINE_ENTERPRISE_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
830 /* flags for CertOpenStore dwFlags */
831 #define CERT_STORE_NO_CRYPT_RELEASE_FLAG 0x00000001
832 #define CERT_STORE_SET_LOCALIZED_NAME_FLAG 0x00000002
833 #define CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG 0x00000004
834 #define CERT_STORE_DELETE_FLAG 0x00000010
835 #define CERT_STORE_UNSAFE_PHYSICAL_FLAG 0x00000020
836 #define CERT_STORE_SHARE_STORE_FLAG 0x00000040
837 #define CERT_STORE_SHARE_CONTEXT_FLAG 0x00000080
838 #define CERT_STORE_MANIFOLD_FLAG 0x00000100
839 #define CERT_STORE_ENUM_ARCHIVED_FLAG 0x00000200
840 #define CERT_STORE_UPDATE_KEYID_FLAG 0x00000400
841 #define CERT_STORE_BACKUP_RESTORE_FLAG 0x00000800
842 #define CERT_STORE_MAXIMUM_ALLOWED_FLAG 0x00001000
843 #define CERT_STORE_CREATE_NEW_FLAG 0x00002000
844 #define CERT_STORE_OPEN_EXISTING_FLAG 0x00004000
845 #define CERT_STORE_READONLY_FLAG 0x00008000
847 /* physical store dwFlags, also used by CertAddStoreToCollection as
848 * dwUpdateFlags
850 #define CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG 0x1
851 #define CERT_PHYSICAL_STORE_OPEN_DISABLE_FLAG 0x2
852 #define CERT_PHYSICAL_STORE_REMOVE_OPEN_DISABLE_FLAG 0x4
853 #define CERT_PHYSICAL_STORE_INSERT_COMPUTER_NAME_ENABLE_FLAG 0x8
855 /* dwFlag values for CertEnumPhysicalStore callback */
856 #define CERT_PHYSICAL_STORE_PREDEFINED_ENUM_FLAG 0x1
858 /* predefined store names */
859 #if defined(__GNUC__)
860 # define CERT_PHYSICAL_STORE_DEFAULT_NAME (const WCHAR[])\
861 {'.','D','e','f','a','u','l','t','0'}
862 # define CERT_PHYSICAL_STORE_GROUP_POLICY_NAME (const WCHAR[])\
863 {'.','G','r','o','u','p','P','o','l','i','c','y',0}
864 # define CERT_PHYSICAL_STORE_LOCAL_MACHINE_NAME (const WCHAR[])\
865 {'.','L','o','c','a','l','M','a','c','h','i','n','e',0}
866 # define CERT_PHYSICAL_STORE_DS_USER_CERTIFICATE_NAME (const WCHAR[])\
867 {'.','U','s','e','r','C','e','r','t','i','f','i','c','a','t','e',0}
868 # define CERT_PHYSICAL_STORE_LOCAL_MACHINE_GROUP_POLICY_NAME (const WCHAR[])\
869 {'.','L','o','c','a','l','M','a','c','h','i','n','e','G','r','o','u','p',\
870 'P','o','l','i','c','y',0}
871 # define CERT_PHYSICAL_STORE_ENTERPRISE_NAME (const WCHAR[])\
872 {'.','E','n','t','e','r','p','r','i','s','e',0}
873 # define CERT_PHYSICAL_STORE_AUTH_ROOT_NAME (const WCHAR[])\
874 {'.','A','u','t','h','R','o','o','t',0}
875 #elif defined(_MSC_VER)
876 # define CERT_PHYSICAL_STORE_DEFAULT_NAME \
877 L".Default"
878 # define CERT_PHYSICAL_STORE_GROUP_POLICY_NAME \
879 L".GroupPolicy"
880 # define CERT_PHYSICAL_STORE_LOCAL_MACHINE_NAME \
881 L".LocalMachine"
882 # define CERT_PHYSICAL_STORE_DS_USER_CERTIFICATE_NAME \
883 L".UserCertificate"
884 # define CERT_PHYSICAL_STORE_LOCAL_MACHINE_GROUP_POLICY_NAME \
885 L".LocalMachineGroupPolicy"
886 # define CERT_PHYSICAL_STORE_ENTERPRISE_NAME \
887 L".Enterprise"
888 # define CERT_PHYSICAL_STORE_AUTH_ROOT_NAME \
889 L".AuthRoot"
890 #else
891 static const WCHAR CERT_PHYSICAL_STORE_DEFAULT_NAME[] =
892 {'.','D','e','f','a','u','l','t','0'};
893 static const WCHAR CERT_PHYSICAL_STORE_GROUP_POLICY_NAME[] =
894 {'.','G','r','o','u','p','P','o','l','i','c','y',0};
895 static const WCHAR CERT_PHYSICAL_STORE_LOCAL_MACHINE_NAME[] =
896 {'.','L','o','c','a','l','M','a','c','h','i','n','e',0};
897 static const WCHAR CERT_PHYSICAL_STORE_DS_USER_CERTIFICATE_NAME[] =
898 {'.','U','s','e','r','C','e','r','t','i','f','i','c','a','t','e',0};
899 static const WCHAR CERT_PHYSICAL_STORE_LOCAL_MACHINE_GROUP_POLICY_NAME[] =
900 {'.','L','o','c','a','l','M','a','c','h','i','n','e','G','r','o','u','p',
901 'P','o','l','i','c','y',0};
902 static const WCHAR CERT_PHYSICAL_STORE_ENTERPRISE_NAME[] =
903 {'.','E','n','t','e','r','p','r','i','s','e',0};
904 static const WCHAR CERT_PHYSICAL_STORE_AUTH_ROOT_NAME[] =
905 {'.','A','u','t','h','R','o','o','t',0};
906 #endif
908 /* cert system store flags */
909 #define CERT_SYSTEM_STORE_MASK 0xffff0000
910 #define CERT_SYSTEM_STORE_RELOCATE_FLAG 0x80000000
912 /* CertFindChainInStore dwFindType types */
913 #define CERT_CHAIN_FIND_BY_ISSUER 1
915 /* function declarations */
916 /* advapi32.dll */
917 BOOL WINAPI CryptAcquireContextA(HCRYPTPROV *phProv, LPCSTR pszContainer,
918 LPCSTR pszProvider, DWORD dwProvType,
919 DWORD dwFlags);
920 BOOL WINAPI CryptAcquireContextW (HCRYPTPROV *phProv, LPCWSTR pszContainer,
921 LPCWSTR pszProvider, DWORD dwProvType, DWORD dwFlags);
922 #define CryptAcquireContext WINELIB_NAME_AW(CryptAcquireContext)
923 BOOL WINAPI CryptGenRandom (HCRYPTPROV hProv, DWORD dwLen, BYTE *pbBuffer);
924 BOOL WINAPI CryptContextAddRef (HCRYPTPROV hProv, DWORD *pdwReserved, DWORD dwFlags);
925 BOOL WINAPI CryptCreateHash (HCRYPTPROV hProv, ALG_ID Algid, HCRYPTKEY hKey,
926 DWORD dwFlags, HCRYPTHASH *phHash);
927 BOOL WINAPI CryptDecrypt (HCRYPTKEY hKey, HCRYPTHASH hHash, BOOL Final,
928 DWORD dwFlags, BYTE *pbData, DWORD *pdwDataLen);
929 BOOL WINAPI CryptDeriveKey (HCRYPTPROV hProv, ALG_ID Algid, HCRYPTHASH hBaseData,
930 DWORD dwFlags, HCRYPTKEY *phKey);
931 BOOL WINAPI CryptDestroyHash (HCRYPTHASH hHash);
932 BOOL WINAPI CryptDestroyKey (HCRYPTKEY hKey);
933 BOOL WINAPI CryptDuplicateKey (HCRYPTKEY hKey, DWORD *pdwReserved, DWORD dwFlags, HCRYPTKEY *phKey);
934 BOOL WINAPI CryptDuplicateHash (HCRYPTHASH hHash, DWORD *pdwReserved,
935 DWORD dwFlags, HCRYPTHASH *phHash);
936 BOOL WINAPI CryptEncrypt (HCRYPTKEY hKey, HCRYPTHASH hHash, BOOL Final,
937 DWORD dwFlags, BYTE *pbData, DWORD *pdwDataLen, DWORD dwBufLen);
938 BOOL WINAPI CryptEnumProvidersA (DWORD dwIndex, DWORD *pdwReserved,
939 DWORD dwFlags, DWORD *pdwProvType, LPSTR pszProvName, DWORD *pcbProvName);
940 BOOL WINAPI CryptEnumProvidersW (DWORD dwIndex, DWORD *pdwReserved,
941 DWORD dwFlags, DWORD *pdwProvType, LPWSTR pszProvName, DWORD *pcbProvName);
942 #define CryptEnumProviders WINELIB_NAME_AW(CryptEnumProviders)
943 BOOL WINAPI CryptEnumProviderTypesA (DWORD dwIndex, DWORD *pdwReserved,
944 DWORD dwFlags, DWORD *pdwProvType, LPSTR pszTypeName, DWORD *pcbTypeName);
945 BOOL WINAPI CryptEnumProviderTypesW (DWORD dwIndex, DWORD *pdwReserved,
946 DWORD dwFlags, DWORD *pdwProvType, LPWSTR pszTypeName, DWORD *pcbTypeName);
947 #define CryptEnumProviderTypes WINELIB_NAME_AW(CryptEnumProviderTypes)
948 BOOL WINAPI CryptExportKey (HCRYPTKEY hKey, HCRYPTKEY hExpKey, DWORD dwBlobType,
949 DWORD dwFlags, BYTE *pbData, DWORD *pdwDataLen);
950 BOOL WINAPI CryptGenKey (HCRYPTPROV hProv, ALG_ID Algid, DWORD dwFlags, HCRYPTKEY *phKey);
951 BOOL WINAPI CryptGetKeyParam (HCRYPTKEY hKey, DWORD dwParam, BYTE *pbData,
952 DWORD *pdwDataLen, DWORD dwFlags);
953 BOOL WINAPI CryptGetHashParam (HCRYPTHASH hHash, DWORD dwParam, BYTE *pbData,
954 DWORD *pdwDataLen, DWORD dwFlags);
955 BOOL WINAPI CryptGetProvParam (HCRYPTPROV hProv, DWORD dwParam, BYTE *pbData,
956 DWORD *pdwDataLen, DWORD dwFlags);
957 BOOL WINAPI CryptGetDefaultProviderA (DWORD dwProvType, DWORD *pdwReserved,
958 DWORD dwFlags, LPSTR pszProvName, DWORD *pcbProvName);
959 BOOL WINAPI CryptGetDefaultProviderW (DWORD dwProvType, DWORD *pdwReserved,
960 DWORD dwFlags, LPWSTR pszProvName, DWORD *pcbProvName);
961 #define CryptGetDefaultProvider WINELIB_NAME_AW(CryptGetDefaultProvider)
962 BOOL WINAPI CryptGetUserKey (HCRYPTPROV hProv, DWORD dwKeySpec, HCRYPTKEY *phUserKey);
963 BOOL WINAPI CryptHashData (HCRYPTHASH hHash, BYTE *pbData, DWORD dwDataLen, DWORD dwFlags);
964 BOOL WINAPI CryptHashSessionKey (HCRYPTHASH hHash, HCRYPTKEY hKey, DWORD dwFlags);
965 BOOL WINAPI CryptImportKey (HCRYPTPROV hProv, BYTE *pbData, DWORD dwDataLen,
966 HCRYPTKEY hPubKey, DWORD dwFlags, HCRYPTKEY *phKey);
967 BOOL WINAPI CryptRegisterOIDFunction(DWORD,LPCSTR,LPCSTR,LPCWSTR,LPCSTR);
969 BOOL WINAPI CryptReleaseContext (HCRYPTPROV hProv, DWORD dwFlags);
970 BOOL WINAPI CryptSignHashA (HCRYPTHASH hHash, DWORD dwKeySpec, LPCSTR sDescription,
971 DWORD dwFlags, BYTE *pbSignature, DWORD *pdwSigLen);
972 BOOL WINAPI CryptSignHashW (HCRYPTHASH hHash, DWORD dwKeySpec, LPCWSTR sDescription,
973 DWORD dwFlags, BYTE *pbSignature, DWORD *pdwSigLen);
974 #define CryptSignHash WINELIB_NAME_AW(CryptSignHash)
975 BOOL WINAPI CryptSetHashParam (HCRYPTHASH hHash, DWORD dwParam, BYTE *pbData, DWORD dwFlags);
976 BOOL WINAPI CryptSetKeyParam (HCRYPTKEY hKey, DWORD dwParam, BYTE *pbData, DWORD dwFlags);
977 BOOL WINAPI CryptSetProviderA (LPCSTR pszProvName, DWORD dwProvType);
978 BOOL WINAPI CryptSetProviderW (LPCWSTR pszProvName, DWORD dwProvType);
979 #define CryptSetProvider WINELIB_NAME_AW(CryptSetProvider)
980 BOOL WINAPI CryptSetProviderExA (LPCSTR pszProvName, DWORD dwProvType, DWORD *pdwReserved, DWORD dwFlags);
981 BOOL WINAPI CryptSetProviderExW (LPCWSTR pszProvName, DWORD dwProvType, DWORD *pdwReserved, DWORD dwFlags);
982 #define CryptSetProviderEx WINELIB_NAME_AW(CryptSetProviderEx)
983 BOOL WINAPI CryptSetProvParam (HCRYPTPROV hProv, DWORD dwParam, BYTE *pbData, DWORD dwFlags);
984 BOOL WINAPI CryptVerifySignatureA (HCRYPTHASH hHash, BYTE *pbSignature, DWORD dwSigLen,
985 HCRYPTKEY hPubKey, LPCSTR sDescription, DWORD dwFlags);
986 BOOL WINAPI CryptVerifySignatureW (HCRYPTHASH hHash, BYTE *pbSignature, DWORD dwSigLen,
987 HCRYPTKEY hPubKey, LPCWSTR sDescription, DWORD dwFlags);
988 #define CryptVerifySignature WINELIB_NAME_AW(CryptVerifySignature)
990 /* cert store functions */
991 HCERTSTORE WINAPI CertOpenStore(LPCSTR lpszStoreProvider, DWORD dwEncodingType,
992 HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara);
994 HCERTSTORE WINAPI CertOpenSystemStoreA(HCRYPTPROV hProv,
995 LPCSTR szSubSystemProtocol);
996 HCERTSTORE WINAPI CertOpenSystemStoreW(HCRYPTPROV hProv,
997 LPCWSTR szSubSystemProtocol);
998 #define CertOpenSystemStore WINELIB_NAME_AW(CertOpenSystemStore)
1000 PCCERT_CONTEXT WINAPI CertEnumCertificatesInStore(HCERTSTORE hCertStore, PCCERT_CONTEXT pPrev);
1002 BOOL WINAPI CertEnumSystemStoreLocation(DWORD dwFlags, void *pvArg,
1003 PFN_CERT_ENUM_SYSTEM_STORE_LOCATION pfnEnum);
1005 BOOL WINAPI CertEnumSystemStore(DWORD dwFlags, void *pvSystemStoreLocationPara,
1006 void *pvArg, PFN_CERT_ENUM_SYSTEM_STORE pfnEnum);
1008 BOOL WINAPI CertEnumPhysicalStore(const void *pvSystemStore, DWORD dwFlags,
1009 void *pvArg, PFN_CERT_ENUM_PHYSICAL_STORE pfnEnum);
1011 BOOL WINAPI CertSaveStore(HCERTSTORE hCertStore, DWORD dwMsgAndCertEncodingType,
1012 DWORD dwSaveAs, DWORD dwSaveTo, void* pvSaveToPara, DWORD dwFlags);
1014 PCCRL_CONTEXT WINAPI CertCreateCRLContext( DWORD dwCertEncodingType,
1015 const BYTE* pbCrlEncoded, DWORD cbCrlEncoded);
1017 BOOL WINAPI CertAddStoreToCollection(HCERTSTORE hCollectionStore,
1018 HCERTSTORE hSiblingStore, DWORD dwUpdateFlags, DWORD dwPriority);
1020 void WINAPI CertRemoveStoreFromCollection(HCERTSTORE hCollectionStore,
1021 HCERTSTORE hSiblingStore);
1023 PCCERT_CHAIN_CONTEXT WINAPI CertFindChainInStore(HCERTSTORE hCertStore,
1024 DWORD dwCertEncodingType, DWORD dwFindFlags, DWORD dwFindType,
1025 const void *pvFindPara, PCCERT_CHAIN_CONTEXT pPrevChainContext);
1027 BOOL WINAPI CertVerifyCertificateChainPolicy(LPCSTR szPolicyOID,
1028 PCCERT_CHAIN_CONTEXT pChainContext, PCERT_CHAIN_POLICY_PARA pPolicyPara,
1029 PCERT_CHAIN_POLICY_STATUS pPolicyStatus);
1031 BOOL WINAPI CertCloseStore( HCERTSTORE hCertStore, DWORD dwFlags );
1033 BOOL WINAPI CertFreeCertificateContext( PCCERT_CONTEXT pCertContext );
1035 #ifdef __cplusplus
1037 #endif
1039 #endif