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