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
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
;
36 typedef struct _CRYPTOAPI_BLOB
{
39 } CRYPT_INTEGER_BLOB
, *PCRYPT_INTEGER_BLOB
,
40 CRYPT_UINT_BLOB
, *PCRYPT_UINT_BLOB
,
41 CRYPT_OBJID_BLOB
, *PCRYPT_OBJID_BLOB
,
42 CERT_NAME_BLOB
, *PCERT_NAME_BLOB
,
43 CERT_RDN_VALUE_BLOB
, *PCERT_RDN_VALUE_BLOB
,
44 CERT_BLOB
, *PCERT_BLOB
,
46 DATA_BLOB
, *PDATA_BLOB
,
47 CRYPT_DATA_BLOB
, *PCRYPT_DATA_BLOB
,
48 CRYPT_HASH_BLOB
, *PCRYPT_HASH_BLOB
,
49 CRYPT_DIGEST_BLOB
, *PCRYPT_DIGEST_BLOB
,
50 CRYPT_DER_BLOB
, *PCRYPT_DER_BLOB
,
51 CRYPT_ATTR_BLOB
, *PCRYPT_ATTR_BLOB
;
53 typedef struct _CRYPTPROTECT_PROMPTSTRUCT
{
58 } CRYPTPROTECT_PROMPTSTRUCT
, *PCRYPTPROTECT_PROMPTSTRUCT
;
60 typedef struct _CRYPT_ALGORITHM_IDENTIFIER
{
62 CRYPT_OBJID_BLOB Parameters
;
63 } CRYPT_ALGORITHM_IDENTIFIER
, *PCRYPT_ALGORITHM_IDENTIFIER
;
65 typedef struct _CRYPT_ATTRIBUTE_TYPE_VALUE
{
67 CRYPT_OBJID_BLOB Value
;
68 } CRYPT_ATTRIBUTE_TYPE_VALUE
, *PCRYPT_ATTRIBUTE_TYPE_VALUE
;
70 typedef struct _PUBLICKEYSTRUC
{
75 } BLOBHEADER
, PUBLICKEYSTRUC
;
77 typedef struct _CRYPT_BIT_BLOB
{
81 } CRYPT_BIT_BLOB
, *PCRYPT_BIT_BLOB
;
83 typedef struct _CERT_PUBLIC_KEY_INFO
{
84 CRYPT_ALGORITHM_IDENTIFIER Algorithm
;
85 CRYPT_BIT_BLOB PublicKey
;
86 } CERT_PUBLIC_KEY_INFO
, *PCERT_PUBLIC_KEY_INFO
;
88 typedef struct _CERT_EXTENSION
{
91 CRYPT_OBJID_BLOB Value
;
92 } CERT_EXTENSION
, *PCERT_EXTENSION
;
94 typedef struct _CERT_INFO
{
96 CRYPT_INTEGER_BLOB SerialNumber
;
97 CRYPT_ALGORITHM_IDENTIFIER SignatureAlgorithm
;
98 CERT_NAME_BLOB Issuer
;
101 CERT_NAME_BLOB Subject
;
102 CERT_PUBLIC_KEY_INFO SubjectPublicKeyInfo
;
103 CRYPT_BIT_BLOB IssuerUniqueId
;
104 CRYPT_BIT_BLOB SubjectUniqueId
;
106 PCERT_EXTENSION rgExtension
;
107 } CERT_INFO
, *PCERT_INFO
;
109 typedef struct _CERT_CONTEXT
{
110 DWORD dwCertEncodingType
;
113 PCERT_INFO pCertInfo
;
114 HCERTSTORE hCertStore
;
115 } CERT_CONTEXT
, *PCERT_CONTEXT
;
116 typedef const CERT_CONTEXT
*PCCERT_CONTEXT
;
118 typedef struct _CRL_ENTRY
{
119 CRYPT_INTEGER_BLOB SerialNumber
;
120 FILETIME RevocationDate
;
122 PCERT_EXTENSION rgExtension
;
123 } CRL_ENTRY
, *PCRL_ENTRY
;
125 typedef struct _CRL_INFO
{
127 CRYPT_ALGORITHM_IDENTIFIER SignatureAlgorithm
;
128 CERT_NAME_BLOB Issuer
;
132 PCRL_ENTRY rgCRLEntry
;
134 PCERT_EXTENSION rgExtension
;
135 } CRL_INFO
, *PCRL_INFO
;
137 typedef struct _CRL_CONTEXT
{
138 DWORD dwCertEncodingType
;
142 HCERTSTORE hCertStore
;
143 } CRL_CONTEXT
, *PCRL_CONTEXT
;
144 typedef const CRL_CONTEXT
*PCCRL_CONTEXT
;
146 typedef struct _VTableProvStruc
{
148 FARPROC pFuncVerifyImage
;
149 FARPROC pFuncReturnhWnd
;
154 } VTableProvStruc
, *PVTableProvStruc
;
156 typedef struct _CRYPT_ATTRIBUTE
{
159 CRYPT_DATA_BLOB rgValue
;
160 } CRYPT_ATTRIBUTE
, *PCRYPT_ATTRIBUTE
;
162 typedef struct _CRYPT_ATTRIBUTES
{
164 PCRYPT_ATTRIBUTE rgAttr
;
165 } CRYPT_ATTRIBUTES
, *PCRYPT_ATTRIBUTES
;
167 typedef struct _CTL_USAGE
{
168 DWORD cUsageIdentifier
;
169 LPSTR
*rgpszUsageIdentifier
;
170 } CTL_USAGE
, *PCTL_USAGE
, CERT_ENHKEY_USAGE
, *PCERT_ENHKEY_USAGE
;
172 typedef struct _CTL_ENTRY
{
173 CRYPT_DATA_BLOB SubjectIdentifier
;
175 PCRYPT_ATTRIBUTE rgAttribute
;
176 } CTL_ENTRY
, *PCTL_ENTRY
;
178 typedef struct _CTL_INFO
{
180 CTL_USAGE SubjectUsage
;
181 CRYPT_DATA_BLOB ListIdentifier
;
182 CRYPT_INTEGER_BLOB SequenceNumber
;
185 CRYPT_ALGORITHM_IDENTIFIER SubjectAlgorithm
;
187 PCTL_ENTRY rgCTLEntry
;
189 PCERT_EXTENSION rgExtension
;
190 } CTL_INFO
, *PCTL_INFO
;
192 typedef struct _CTL_CONTEXT
{
193 DWORD dwMsgAndCertEncodingType
;
197 HCERTSTORE hCertStore
;
201 } CTL_CONTEXT
, *PCTL_CONTEXT
;
202 typedef const CTL_CONTEXT
*PCCTL_CONTEXT
;
204 typedef struct _CERT_REVOCATION_CRL_INFO
{
206 PCCRL_CONTEXT pBaseCrlContext
;
207 PCCRL_CONTEXT pDeltaCrlContext
;
208 PCRL_ENTRY pCrlEntry
;
210 } CERT_REVOCATION_CRL_INFO
, *PCERT_REVOCATION_CRL_INFO
;
212 typedef struct _CERT_REVOCATION_INFO
{
214 DWORD dwRevocationResult
;
215 LPCSTR pszRevocationOid
;
216 LPVOID pvOidSpecificInfo
;
217 BOOL fHasFreshnessTime
;
218 DWORD dwFreshnessTime
;
219 PCERT_REVOCATION_CRL_INFO pCrlInfo
;
220 } CERT_REVOCATION_INFO
, *PCERT_REVOCATION_INFO
;
222 typedef struct _CERT_TRUST_LIST_INFO
{
224 PCTL_ENTRY pCtlEntry
;
225 PCCTL_CONTEXT pCtlContext
;
226 } CERT_TRUST_LIST_INFO
, *PCERT_TRUST_LIST_INFO
;
228 typedef struct _CERT_TRUST_STATUS
{
231 } CERT_TRUST_STATUS
, *PCERT_TRUST_STATUS
;
233 typedef struct _CERT_CHAIN_ELEMENT
{
235 PCCERT_CONTEXT pCertContext
;
236 CERT_TRUST_STATUS TrustStatus
;
237 PCERT_REVOCATION_INFO pRevocationInfo
;
238 PCERT_ENHKEY_USAGE pIssuanceUsage
;
239 PCERT_ENHKEY_USAGE pApplicationUsage
;
240 LPCWSTR pwszExtendedErrorInfo
;
241 } CERT_CHAIN_ELEMENT
, *PCERT_CHAIN_ELEMENT
;
243 typedef struct _CERT_SIMPLE_CHAIN
{
245 CERT_TRUST_STATUS TrustStatus
;
247 PCERT_CHAIN_ELEMENT
*rgpElement
;
248 PCERT_TRUST_LIST_INFO pTrustListInfo
;
249 BOOL fHasRevocationFreshnessTime
;
250 DWORD dwRevocationFreshnessTime
;
251 } CERT_SIMPLE_CHAIN
, *PCERT_SIMPLE_CHAIN
;
253 typedef struct _CERT_CHAIN_CONTEXT CERT_CHAIN_CONTEXT
, *PCERT_CHAIN_CONTEXT
;
254 typedef const CERT_CHAIN_CONTEXT
*PCCERT_CHAIN_CONTEXT
;
256 struct _CERT_CHAIN_CONTEXT
{
258 CERT_TRUST_STATUS TrustStatus
;
260 PCERT_SIMPLE_CHAIN
*rgpChain
;
261 DWORD cLowerQualityChainContext
;
262 PCCERT_CHAIN_CONTEXT
*rgbLowerQualityChainContext
;
263 BOOL fHasRevocationFreshnessTime
;
264 DWORD dwRevocationFreshnessTime
;
267 typedef struct _CERT_CHAIN_POLICY_PARA
{
270 void *pvExtraPolicyPara
;
271 } CERT_CHAIN_POLICY_PARA
, *PCERT_CHAIN_POLICY_PARA
;
273 typedef struct _CERT_CHAIN_POLICY_STATUS
{
278 void *pvExtraPolicyStatus
;
279 } CERT_CHAIN_POLICY_STATUS
, *PCERT_CHAIN_POLICY_STATUS
;
281 typedef struct _CERT_SYSTEM_STORE_INFO
{
283 } CERT_SYSTEM_STORE_INFO
, *PCERT_SYSTEM_STORE_INFO
;
285 typedef struct _CERT_PHYSICAL_STORE_INFO
{
287 LPSTR pszOpenStoreProvider
;
288 DWORD dwOpenEncodingType
;
290 CRYPT_DATA_BLOB OpenParameters
;
293 } CERT_PHYSICAL_STORE_INFO
, *PCERT_PHYSICAL_STORE_INFO
;
295 typedef struct _CERT_SYSTEM_STORE_RELOCATE_PARA
{
302 LPCSTR pszSystemStore
;
303 LPCWSTR pwszSystemStore
;
305 } CERT_SYSTEM_STORE_RELOCATE_PARA
, *PCERT_SYSTEM_STORE_RELOCATE_PARA
;
307 typedef BOOL (WINAPI
*PFN_CERT_ENUM_SYSTEM_STORE_LOCATION
)(
308 LPCWSTR pwszStoreLocation
, DWORD dwFlags
, void *pvReserved
, void *pvArg
);
310 typedef BOOL (WINAPI
*PFN_CERT_ENUM_SYSTEM_STORE
)(const void *pvSystemStore
,
311 DWORD dwFlags
, PCERT_SYSTEM_STORE_INFO pStoreInfo
, void *pvReserved
,
314 typedef BOOL (WINAPI
*PFN_CERT_ENUM_PHYSICAL_STORE
)(const void *pvSystemStore
,
315 DWORD dwFlags
, LPCWSTR pwszStoreName
, PCERT_PHYSICAL_STORE_INFO pStoreInfo
,
316 void *pvReserved
, void *pvArg
);
320 #define GET_ALG_CLASS(x) (x & (7 << 13))
321 #define GET_ALG_TYPE(x) (x & (15 << 9))
322 #define GET_ALG_SID(x) (x & (511))
324 /* Algorithm Classes */
325 #define ALG_CLASS_ANY (0)
326 #define ALG_CLASS_SIGNATURE (1 << 13)
327 #define ALG_CLASS_MSG_ENCRYPT (2 << 13)
328 #define ALG_CLASS_DATA_ENCRYPT (3 << 13)
329 #define ALG_CLASS_HASH (4 << 13)
330 #define ALG_CLASS_KEY_EXCHANGE (5 << 13)
331 /* Algorithm types */
332 #define ALG_TYPE_ANY (0)
333 #define ALG_TYPE_DSS (1 << 9)
334 #define ALG_TYPE_RSA (2 << 9)
335 #define ALG_TYPE_BLOCK (3 << 9)
336 #define ALG_TYPE_STREAM (4 << 9)
339 #define ALG_SID_ANY (0)
341 #define ALG_SID_RSA_ANY 0
342 #define ALG_SID_RSA_PKCS 1
343 #define ALG_SID_RSA_MSATWORK 2
344 #define ALG_SID_RSA_ENTRUST 3
345 #define ALG_SID_RSA_PGP 4
347 #define ALG_SID_DSS_ANY 0
348 #define ALG_SID_DSS_PKCS 1
349 #define ALG_SID_DSS_DMS 2
352 #define ALG_SID_DES 1
353 #define ALG_SID_3DES 3
354 #define ALG_SID_DESX 4
355 #define ALG_SID_IDEA 5
356 #define ALG_SID_CAST 6
357 #define ALG_SID_SAFERSK64 7
358 #define ALD_SID_SAFERSK128 8
360 #define ALG_SID_RC4 1
361 #define ALG_SID_RC2 2
362 #define ALG_SID_SEAL 2
364 #define ALG_SID_MD2 1
365 #define ALG_SID_MD4 2
366 #define ALG_SID_MD5 3
367 #define ALG_SID_SHA 4
368 #define ALG_SID_MAC 5
369 #define ALG_SID_RIPEMD 6
370 #define ALG_SID_RIPEMD160 7
371 #define ALG_SID_SSL3SHAMD5 8
373 /* Algorithm Definitions */
374 #define CALG_MD2 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MD2)
375 #define CALG_MD4 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MD4)
376 #define CALG_MD5 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MD5)
377 #define CALG_SHA (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA)
378 #define CALG_MAC (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MAC)
379 #define CALG_RSA_SIGN (ALG_CLASS_SIGNATURE | ALG_TYPE_RSA | ALG_SID_RSA_ANY)
380 #define CALG_DSS_SIGN (ALG_CLASS_SIGNATURE | ALG_TYPE_DSS | ALG_SID_DSS_ANY)
381 #define CALG_RSA_KEYX (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_RSA | ALG_SID_RSA_ANY)
382 #define CALG_DES (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_DES)
383 #define CALG_RC2 (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_RC2)
384 #define CALG_RC4 (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_STREAM | ALG_SID_RC4)
385 #define CALG_SEAL (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_STREAM | ALG_SID_SEAL)
388 #define MS_DEF_PROV_A "Microsoft Base Cryptographic Provider v1.0"
389 #if defined(__GNUC__)
390 # define MS_DEF_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
391 'B','a','s','e',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ', \
392 'P','r','o','v','i','d','e','r',' ','v','1','.','0',0 }
393 #elif defined(_MSC_VER)
394 # define MS_DEF_PROV_W L"Microsoft Base Cryptographic Provider v1.0"
396 static const WCHAR MS_DEF_PROV_W
[] = { 'M','i','c','r','o','s','o','f','t',' ',
397 'B','a','s','e',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ',
398 'P','r','o','v','i','d','e','r',' ','v','1','.','0',0 };
400 #define MS_DEF_PROV WINELIB_NAME_AW(MS_DEF_PROV_)
402 #define MS_ENHANCED_PROV_A "Microsoft Enhanced Cryptographic Provider v1.0"
403 #if defined(__GNUC__)
404 # define MS_ENHANCED_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
405 'E','n','h','a','n','c','e','d',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ', \
406 'P','r','o','v','i','d','e','r',' ','v','1','.','0',0 }
407 #elif defined(_MSC_VER)
408 # define MS_ENHANCED_PROV_W L"Microsoft Enhanced Cryptographic Provider v1.0"
410 static const WCHAR MS_ENHANCED_PROV_W
[] = { 'M','i','c','r','o','s','o','f','t',' ',
411 'E','n','h','a','n','c','e','d',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ',
412 'P','r','o','v','i','d','e','r',' ','v','1','.','0',0 };
414 #define MS_ENHANCED_PROV WINELIB_NAME_AW(MS_ENHANCED_PROV_)
416 #define MS_STRONG_PROV_A "Microsoft Strong Cryptographic Provider"
417 #if defined(__GNUC__)
418 # define MS_STRONG_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
419 'S','t','r','o','n','g',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ', \
420 'P','r','o','v','i','d','e','r',0 }
421 #elif defined(_MSC_VER)
422 # define MS_STRONG_PROV_W L"Microsoft Strong Cryptographic Provider"
424 static const WCHAR MS_STRONG_PROV_W
[] = { 'M','i','c','r','o','s','o','f','t',' ',
425 'S','t','r','o','n','g',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ',
426 'P','r','o','v','i','d','e','r',0 };
428 #define MS_STRONG_PROV WINELIB_NAME_AW(MS_STRONG_PROV_)
430 #define MS_DEF_RSA_SIG_PROV_A "Microsoft RSA Signature Cryptographic Provider"
431 #if defined(__GNUC__)
432 # define MS_DEF_RSA_SIG_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
433 'R','S','A',' ','S','i','g','n','a','t','u','r','e',' ', \
434 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
435 #elif defined(_MSC_VER)
436 # define MS_DEF_RSA_SIG_PROV_W L"Microsoft RSA Signature Cryptographic Provider"
438 static const WCHAR MS_DEF_RSA_SIG_PROV_W
[] = { 'M','i','c','r','o','s','o','f','t',' ',
439 'R','S','A',' ','S','i','g','n','a','t','u','r','e',' ',
440 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
442 #define MS_DEF_RSA_SIG_PROV WINELIB_NAME_AW(MS_DEF_RSA_SIG_PROV_)
444 #define MS_DEF_RSA_SCHANNEL_PROV_A "Microsoft RSA SChannel Cryptographic Provider"
445 #if defined(__GNUC__)
446 # define MS_DEF_RSA_SCHANNEL_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
447 'R','S','A',' ','S','C','h','a','n','n','e','l',' ', \
448 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
449 #elif defined(_MSC_VER)
450 # define MS_DEF_RSA_SCHANNEL_PROV_W L"Microsoft RSA SChannel Cryptographic Provider"
452 static const WCHAR MS_DEF_RSA_SCHANNEL_PROV_W
[] = { 'M','i','c','r','o','s','o','f','t',' ',
453 'R','S','A',' ','S','C','h','a','n','n','e','l',' ',
454 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
456 #define MS_DEF_RSA_SCHANNEL_PROV WINELIB_NAME_AW(MS_DEF_RSA_SCHANNEL_PROV_)
458 #define MS_DEF_DSS_PROV_A "Microsoft Base DSS Cryptographic Provider"
459 #if defined(__GNUC__)
460 # define MS_DEF_DSS_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
461 'B','a','s','e',' ','D','S','S',' ', \
462 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
463 #elif defined(_MSC_VER)
464 # define MS_DEF_DSS_PROV_W L"Microsoft Base DSS Cryptographic Provider"
466 static const WCHAR MS_DEF_DSS_PROV_W
[] = { 'M','i','c','r','o','s','o','f','t',' ',
467 'B','a','s','e',' ','D','S','S',' ',
468 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
470 #define MS_DEF_DSS_PROV WINELIB_NAME_AW(MS_DEF_DSS_PROV_)
472 #define MS_DEF_DSS_DH_PROV_A "Microsoft Base DSS and Diffie-Hellman Cryptographic Provider"
473 #if defined(__GNUC__)
474 # define MS_DEF_DSS_DH_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
475 'B','a','s','e',' ','D','S','S',' ','a','n','d',' ', \
476 'D','i','f','f','i','e','-','H','e','l','l','m','a','n',' ', \
477 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
478 #elif defined(_MSC_VER)
479 # define MS_DEF_DSS_DH_PROV_W L"Microsoft Base DSS and Diffie-Hellman Cryptographic Provider"
481 static const WCHAR MS_DEF_DSS_DH_PROV_W
[] = { 'M','i','c','r','o','s','o','f','t',' ',
482 'B','a','s','e',' ','D','S','S',' ','a','n','d',' ',
483 'D','i','f','f','i','e','-','H','e','l','l','m','a','n',' ',
484 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
486 #define MS_DEF_DSS_DH_PROV WINELIB_NAME_AW(MS_DEF_DSS_DH_PROV_)
488 #define MS_ENH_DSS_DH_PROV_A "Microsoft Enhanced DSS and Diffie-Hellman Cryptographic Provider"
489 #if defined(__GNUC__)
490 # define MS_ENH_DSS_DH_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
491 'E','n','h','a','n','c','e','d',' ','D','S','S',' ','a','n','d',' ', \
492 'D','i','f','f','i','e','-','H','e','l','l','m','a','n',' ', \
493 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
494 #elif defined(_MSC_VER)
495 # define MS_ENH_DSS_DH_PROV_W L"Microsoft Enhanced DSS and Diffie-Hellman Cryptographic Provider"
497 static const WCHAR MS_ENH_DSS_DH_PROV_W
[] = { 'M','i','c','r','o','s','o','f','t',' ',
498 'E','n','h','a','n','c','e','d',' ','D','S','S',' ','a','n','d',' ',
499 'D','i','f','f','i','e','-','H','e','l','l','m','a','n',' ',
500 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
502 #define MS_ENH_DSS_DH_PROV WINELIB_NAME_AW(MS_ENH_DSS_DH_PROV_)
504 #define MS_DEF_DH_SCHANNEL_PROV_A "Microsoft DH SChannel Cryptographic Provider"
505 #if defined(__GNUC__)
506 # define MS_DEF_DH_SCHANNEL_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
507 'D','H',' ','S','C','h','a','n','n','e','l',' ', \
508 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
509 #elif defined(_MSC_VER)
510 # define MS_DEF_DH_SCHANNEL_PROV_W L"Microsoft DH SChannel Cryptographic Provider"
512 static const WCHAR MS_DEF_DH_SCHANNEL_PROV_W
[] = { 'M','i','c','r','o','s','o','f','t',' ',
513 'D','H',' ','S','C','h','a','n','n','e','l',' ',
514 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
516 #define MS_DEF_DH_SCHANNEL_PROV WINELIB_NAME_AW(MS_DEF_DH_SCHANNEL_PROV_)
518 #define MS_SCARD_PROV_A "Microsoft Base Smart Card Cryptographic Provider"
519 #if defined(__GNUC__)
520 # define MS_SCARD_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
521 'B','a','s','e',' ','S','m','a','r','t',' ','C','a','r','d',' ', \
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_SCARD_PROV_W L"Microsoft Base Smart Card Cryptographic Provider"
526 static const WCHAR MS_SCARD_PROV_W
[] = { 'M','i','c','r','o','s','o','f','t',' ',
527 'B','a','s','e',' ','S','m','a','r','t',' ','C','a','r','d',' ',
528 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
530 #define MS_SCARD_PROV WINELIB_NAME_AW(MS_SCARD_PROV_)
533 #define AT_KEYEXCHANGE 1
534 #define AT_SIGNATURE 2
537 #define PROV_RSA_FULL 1
538 #define PROV_RSA_SIG 2
540 #define PROV_FORTEZZA 4
541 #define PROV_MS_EXCHANGE 5
543 #define PROV_RSA_SCHANNEL 12
544 #define PROV_DSS_DH 13
545 #define PROV_EC_ECDSA_SIG 14
546 #define PROV_EC_ECNRA_SIG 15
547 #define PROV_EC_ECDSA_FULL 16
548 #define PROV_EC_ECNRA_FULL 17
549 #define PROV_DH_SCHANNEL 18
550 #define PROV_SPYRUS_LYNKS 20
552 #define PROV_INTEL_SEC 22
553 #define PROV_REPLACE_OWF 23
554 #define PROV_RSA_AES 24
558 /* Provider Parameters */
559 #define PP_ENUMALGS 1
560 #define PP_ENUMCONTAINERS 2
564 #define PP_CONTAINER 6
566 #define CRYPT_FIRST 1
569 #define CRYPT_IMPL_HARDWARE 1
570 #define CRYPT_IMPL_SOFTWARE 2
571 #define CRYPT_IMPL_MIXED 3
572 #define CRYPT_IMPL_UNKNOWN 4
574 /* CryptAcquireContext */
575 #define CRYPT_VERIFYCONTEXT 0xF0000000
576 #define CRYPT_NEWKEYSET 0x00000008
577 #define CRYPT_MACHINE_KEYSET 0x00000000
578 #define CRYPT_DELETEKEYSET 0x00000010
579 #define CRYPT_SILENT 0x00000000
581 /* Crypt{Get|Set}Provider */
582 #define CRYPT_MACHINE_DEFAULT 0x00000001
583 #define CRYPT_USER_DEFAULT 0x00000002
584 #define CRYPT_DELETE_DEFAULT 0x00000004
586 /* Crypt{Get/Set}ProvParam */
587 #define PP_CLIENT_HWND 1
588 #define PP_ENUMALGS 1
589 #define PP_ENUMCONTAINERS 2
593 #define PP_CONTAINER 6
594 #define PP_CHANGE_PASSWORD 7
595 #define PP_KEYSET_SEC_DESCR 8
596 #define PP_KEY_TYPE_SUBTYPE 10
597 #define PP_CONTEXT_INFO 11
598 #define PP_KEYEXCHANGE_KEYSIZE 12
599 #define PP_SIGNATURE_KEYSIZE 13
600 #define PP_KEYEXCHANGE_ALG 14
601 #define PP_SIGNATURE_ALG 15
602 #define PP_PROVTYPE 16
603 #define PP_KEYSTORAGE 17
604 #define PP_SYM_KEYSIZE 19
605 #define PP_SESSION_KEYSIZE 20
606 #define PP_UI_PROMPT 21
607 #define PP_ENUMALGS_EX 22
608 #define PP_DELETEKEY 24
609 #define PP_ENUMMANDROOTS 25
610 #define PP_ENUMELECTROOTS 26
611 #define PP_KEYSET_TYPE 27
612 #define PP_ADMIN_PIN 31
613 #define PP_KEYEXCHANGE_PIN 32
614 #define PP_SIGNATURE_PIN 33
615 #define PP_SIG_KEYSIZE_INC 34
616 #define PP_KEYX_KEYSIZE_INC 35
617 #define PP_UNIQUE_CONTAINER 36
618 #define PP_SGC_INFO 37
619 #define PP_USE_HARDWARE_RNG 38
620 #define PP_KEYSPEC 39
621 #define PP_ENUMEX_SIGNING_PROT 40
623 /* CryptSignHash/CryptVerifySignature */
624 #define CRYPT_NOHASHOID 0x00000001
625 #define CRYPT_TYPE2_FORMAT 0x00000002
626 #define CRYPT_X931_FORMAT 0x00000004
629 #define CRYPT_EXPORTABLE 0x00000001
630 #define CRYPT_USER_PROTECTED 0x00000002
631 #define CRYPT_CREATE_SALT 0x00000004
632 #define CRYPT_UPDATE_KEY 0x00000008
633 #define CRYPT_NO_SALT 0x00000010
634 #define CRYPT_PREGEN 0x00000040
635 #define CRYPT_ARCHIVABLE 0x00004000
636 #define CRYPT_SSL2_FALLBACK 0x00000002
637 #define CRYPT_DESTROYKEY 0x00000004
638 #define CRYPT_OAEP 0x00000040
641 #define SIMPLEBLOB 0x1
642 #define PUBLICKEYBLOB 0x6
643 #define PRIVATEKEYBLOB 0x7
644 #define PLAINTEXTKEYBLOB 0x8
645 #define OPAQUEKEYBLOB 0x9
646 #define PUBLICKEYBLOBEX 0xA
647 #define SYMMETRICWRAPKEYBLOB 0xB
649 /* cert store provider types */
650 #define CERT_STORE_PROV_MSG ((LPCSTR)1)
651 #define CERT_STORE_PROV_MEMORY ((LPCSTR)2)
652 #define CERT_STORE_PROV_FILE ((LPCSTR)3)
653 #define CERT_STORE_PROV_REG ((LPCSTR)4)
654 #define CERT_STORE_PROV_PKCS7 ((LPCSTR)5)
655 #define CERT_STORE_PROV_SERIALIZED ((LPCSTR)6)
656 #define CERT_STORE_PROV_FILENAME_A ((LPCSTR)7)
657 #define CERT_STORE_PROV_FILENAME_W ((LPCSTR)8)
658 #define CERT_STORE_PROV_SYSTEM_A ((LPCSTR)9)
659 #define CERT_STORE_PROV_SYSTEM_W ((LPCSTR)10)
660 #define CERT_STORE_PROV_SYSTEM CERT_STORE_PROV_SYSTEM_W
661 #define CERT_STORE_PROV_COLLECTION ((LPCSTR)11)
662 #define CERT_STORE_PROV_SYSTEM_REGISTRY_A ((LPCSTR)12)
663 #define CERT_STORE_PROV_SYSTEM_REGISTRY_W ((LPCSTR)13)
664 #define CERT_STORE_PROV_SYSTEM_REGISTRY CERT_STORE_PROV_SYSTEM_REGISTRY_W
665 #define CERT_STORE_PROV_PHYSICAL_W ((LPCSTR)14)
666 #define CERT_STORE_PROV_PHYSICAL CERT_STORE_PROV_PHYSICAL_W
667 #define CERT_STORE_PROV_SMART_CARD_W ((LPCSTR)15)
668 #define CERT_STORE_PROV_SMART_CARD CERT_STORE_PROV_SMART_CARD_W
669 #define CERT_STORE_PROV_LDAP_W ((LPCSTR)16)
670 #define CERT_STORE_PROV_LDAP CERT_STORE_PROV_LDAP_W
672 #define sz_CERT_STORE_PROV_MEMORY "Memory"
673 #define sz_CERT_STORE_PROV_FILENAME_W "File"
674 #define sz_CERT_STORE_PROV_FILENAME sz_CERT_STORE_PROV_FILENAME_W
675 #define sz_CERT_STORE_PROV_SYSTEM_W "System"
676 #define sz_CERT_STORE_PROV_SYSTEM sz_CERT_STORE_PROV_SYSTEM_W
677 #define sz_CERT_STORE_PROV_PKCS7 "PKCS7"
678 #define sz_CERT_STORE_PROV_SERIALIZED "Serialized"
679 #define sz_CERT_STORE_PROV_COLLECTION "Collection"
680 #define sz_CERT_STORE_PROV_SYSTEM_REGISTRY_W "SystemRegistry"
681 #define sz_CERT_STORE_PROV_SYSTEM_REGISTRY sz_CERT_STORE_PROV_SYSTEM_REGISTRY_W
682 #define sz_CERT_STORE_PROV_PHYSICAL_W "Physical"
683 #define sz_CERT_STORE_PROV_PHYSICAL sz_CERT_STORE_PROV_PHYSICAL_W
684 #define sz_CERT_STORE_PROV_SMART_CARD_W "SmartCard"
685 #define sz_CERT_STORE_PROV_SMART_CARD sz_CERT_STORE_PROV_SMART_CARD_W
686 #define sz_CERT_STORE_PROV_LDAP_W "Ldap"
687 #define sz_CERT_STORE_PROV_LDAP sz_CERT_STORE_PROV_LDAP_W
689 /* types for CertOpenStore dwEncodingType */
690 #define X509_ASN_ENCODING 0x00000001
691 #define X509_NDR_ENCODING 0x00000002
692 #define PKCS_7_ASN_ENCODING 0x00010000
693 #define PKCS_7_NDR_ENCODING 0x00020000
695 /* system store locations */
696 #define CERT_SYSTEM_STORE_LOCATION_MASK 0x00ff0000
697 #define CERT_SYSTEM_STORE_LOCATION_SHIFT 16
699 /* system store location ids */
701 #define CERT_SYSTEM_STORE_CURRENT_USER_ID 1
703 #define CERT_SYSTEM_STORE_LOCAL_MACHINE_ID 2
704 /* hklm\Software\Microsoft\Cryptography\Services */
705 #define CERT_SYSTEM_STORE_CURRENT_SERVICE_ID 4
706 #define CERT_SYSTEM_STORE_SERVICES_ID 5
708 #define CERT_SYSTEM_STORE_USERS_ID 6
709 /* hkcu\Software\Microsoft\Policies\Microsoft\SystemCertificates */
710 #define CERT_SYSTEM_STORE_CURRENT_USER_GROUP_POLICY_ID 7
711 /* hklm\Software\Microsoft\Policies\Microsoft\SystemCertificates */
712 #define CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY_ID 8
713 /* hklm\Software\Microsoft\EnterpriseCertificates */
714 #define CERT_SYSTEM_STORE_LOCAL_MACHINE_ENTERPRISE_ID 9
716 /* system store location values */
717 #define CERT_SYSTEM_STORE_CURRENT_USER \
718 (CERT_SYSTEM_STORE_CURRENT_USER_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
719 #define CERT_SYSTEM_STORE_LOCAL_MACHINE \
720 (CERT_SYSTEM_STORE_LOCAL_MACHINE_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
721 #define CERT_SYSTEM_STORE_CURRENT_SERVICE \
722 (CERT_SYSTEM_STORE_CURRENT_SERVICE_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
723 #define CERT_SYSTEM_STORE_SERVICE \
724 (CERT_SYSTEM_STORE_SERVICES_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
725 #define CERT_SYSTEM_STORE_USERS \
726 (CERT_SYSTEM_STORE_USERS_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
727 #define CERT_SYSTEM_STORE_CURRENT_USER_GROUP_POLICY \
728 (CERT_SYSTEM_STORE_CURRENT_USER_GROUP_POLICY_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
729 #define CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY \
730 (CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
731 #define CERT_SYSTEM_STORE_LOCAL_MACHINE_ENTERPRISE \
732 (CERT_SYSTEM_STORE_LOCAL_MACHINE_ENTERPRISE_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
734 /* flags for CertOpenStore dwFlags */
735 #define CERT_STORE_NO_CRYPT_RELEASE_FLAG 0x00000001
736 #define CERT_STORE_SET_LOCALIZED_NAME_FLAG 0x00000002
737 #define CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG 0x00000004
738 #define CERT_STORE_DELETE_FLAG 0x00000010
739 #define CERT_STORE_UNSAFE_PHYSICAL_FLAG 0x00000020
740 #define CERT_STORE_SHARE_STORE_FLAG 0x00000040
741 #define CERT_STORE_SHARE_CONTEXT_FLAG 0x00000080
742 #define CERT_STORE_MANIFOLD_FLAG 0x00000100
743 #define CERT_STORE_ENUM_ARCHIVED_FLAG 0x00000200
744 #define CERT_STORE_UPDATE_KEYID_FLAG 0x00000400
745 #define CERT_STORE_BACKUP_RESTORE_FLAG 0x00000800
746 #define CERT_STORE_MAXIMUM_ALLOWED_FLAG 0x00001000
747 #define CERT_STORE_CREATE_NEW_FLAG 0x00002000
748 #define CERT_STORE_OPEN_EXISTING_FLAG 0x00004000
749 #define CERT_STORE_READONLY_FLAG 0x00008000
751 /* physical store dwFlags, also used by CertAddStoreToCollection as
754 #define CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG 0x1
755 #define CERT_PHYSICAL_STORE_OPEN_DISABLE_FLAG 0x2
756 #define CERT_PHYSICAL_STORE_REMOVE_OPEN_DISABLE_FLAG 0x4
757 #define CERT_PHYSICAL_STORE_INSERT_COMPUTER_NAME_ENABLE_FLAG 0x8
759 /* dwFlag values for CertEnumPhysicalStore callback */
760 #define CERT_PHYSICAL_STORE_PREDEFINED_ENUM_FLAG 0x1
762 /* predefined store names */
763 #if defined(__GNUC__)
764 # define CERT_PHYSICAL_STORE_DEFAULT_NAME (const WCHAR[])\
765 {'.','D','e','f','a','u','l','t','0'}
766 # define CERT_PHYSICAL_STORE_GROUP_POLICY_NAME (const WCHAR[])\
767 {'.','G','r','o','u','p','P','o','l','i','c','y',0}
768 # define CERT_PHYSICAL_STORE_LOCAL_MACHINE_NAME (const WCHAR[])\
769 {'.','L','o','c','a','l','M','a','c','h','i','n','e',0}
770 # define CERT_PHYSICAL_STORE_DS_USER_CERTIFICATE_NAME (const WCHAR[])\
771 {'.','U','s','e','r','C','e','r','t','i','f','i','c','a','t','e',0}
772 # define CERT_PHYSICAL_STORE_LOCAL_MACHINE_GROUP_POLICY_NAME (const WCHAR[])\
773 {'.','L','o','c','a','l','M','a','c','h','i','n','e','G','r','o','u','p',\
774 'P','o','l','i','c','y',0}
775 # define CERT_PHYSICAL_STORE_ENTERPRISE_NAME (const WCHAR[])\
776 {'.','E','n','t','e','r','p','r','i','s','e',0}
777 # define CERT_PHYSICAL_STORE_AUTH_ROOT_NAME (const WCHAR[])\
778 {'.','A','u','t','h','R','o','o','t',0}
779 #elif defined(_MSC_VER)
780 # define CERT_PHYSICAL_STORE_DEFAULT_NAME \
782 # define CERT_PHYSICAL_STORE_GROUP_POLICY_NAME \
784 # define CERT_PHYSICAL_STORE_LOCAL_MACHINE_NAME \
786 # define CERT_PHYSICAL_STORE_DS_USER_CERTIFICATE_NAME \
788 # define CERT_PHYSICAL_STORE_LOCAL_MACHINE_GROUP_POLICY_NAME \
789 L".LocalMachineGroupPolicy"
790 # define CERT_PHYSICAL_STORE_ENTERPRISE_NAME \
792 # define CERT_PHYSICAL_STORE_AUTH_ROOT_NAME \
795 static const WCHAR CERT_PHYSICAL_STORE_DEFAULT_NAME
[] =
796 {'.','D','e','f','a','u','l','t','0'};
797 static const WCHAR CERT_PHYSICAL_STORE_GROUP_POLICY_NAME
[] =
798 {'.','G','r','o','u','p','P','o','l','i','c','y',0};
799 static const WCHAR CERT_PHYSICAL_STORE_LOCAL_MACHINE_NAME
[] =
800 {'.','L','o','c','a','l','M','a','c','h','i','n','e',0};
801 static const WCHAR CERT_PHYSICAL_STORE_DS_USER_CERTIFICATE_NAME
[] =
802 {'.','U','s','e','r','C','e','r','t','i','f','i','c','a','t','e',0};
803 static const WCHAR CERT_PHYSICAL_STORE_LOCAL_MACHINE_GROUP_POLICY_NAME
[] =
804 {'.','L','o','c','a','l','M','a','c','h','i','n','e','G','r','o','u','p',
805 'P','o','l','i','c','y',0};
806 static const WCHAR CERT_PHYSICAL_STORE_ENTERPRISE_NAME
[] =
807 {'.','E','n','t','e','r','p','r','i','s','e',0};
808 static const WCHAR CERT_PHYSICAL_STORE_AUTH_ROOT_NAME
[] =
809 {'.','A','u','t','h','R','o','o','t',0};
812 /* cert system store flags */
813 #define CERT_SYSTEM_STORE_MASK 0xffff0000
814 #define CERT_SYSTEM_STORE_RELOCATE_FLAG 0x80000000
816 /* CertFindChainInStore dwFindType types */
817 #define CERT_CHAIN_FIND_BY_ISSUER 1
819 /* function declarations */
821 BOOL WINAPI
CryptAcquireContextA(HCRYPTPROV
*phProv
, LPCSTR pszContainer
,
822 LPCSTR pszProvider
, DWORD dwProvType
,
824 BOOL WINAPI
CryptAcquireContextW (HCRYPTPROV
*phProv
, LPCWSTR pszContainer
,
825 LPCWSTR pszProvider
, DWORD dwProvType
, DWORD dwFlags
);
826 #define CryptAcquireContext WINELIB_NAME_AW(CryptAcquireContext)
827 BOOL WINAPI
CryptGenRandom (HCRYPTPROV hProv
, DWORD dwLen
, BYTE
*pbBuffer
);
828 BOOL WINAPI
CryptContextAddRef (HCRYPTPROV hProv
, DWORD
*pdwReserved
, DWORD dwFlags
);
829 BOOL WINAPI
CryptCreateHash (HCRYPTPROV hProv
, ALG_ID Algid
, HCRYPTKEY hKey
,
830 DWORD dwFlags
, HCRYPTHASH
*phHash
);
831 BOOL WINAPI
CryptDecrypt (HCRYPTKEY hKey
, HCRYPTHASH hHash
, BOOL Final
,
832 DWORD dwFlags
, BYTE
*pbData
, DWORD
*pdwDataLen
);
833 BOOL WINAPI
CryptDeriveKey (HCRYPTPROV hProv
, ALG_ID Algid
, HCRYPTHASH hBaseData
,
834 DWORD dwFlags
, HCRYPTKEY
*phKey
);
835 BOOL WINAPI
CryptDestroyHash (HCRYPTHASH hHash
);
836 BOOL WINAPI
CryptDestroyKey (HCRYPTKEY hKey
);
837 BOOL WINAPI
CryptDuplicateKey (HCRYPTKEY hKey
, DWORD
*pdwReserved
, DWORD dwFlags
, HCRYPTKEY
*phKey
);
838 BOOL WINAPI
CryptDuplicateHash (HCRYPTHASH hHash
, DWORD
*pdwReserved
,
839 DWORD dwFlags
, HCRYPTHASH
*phHash
);
840 BOOL WINAPI
CryptEncrypt (HCRYPTKEY hKey
, HCRYPTHASH hHash
, BOOL Final
,
841 DWORD dwFlags
, BYTE
*pbData
, DWORD
*pdwDataLen
, DWORD dwBufLen
);
842 BOOL WINAPI
CryptEnumProvidersA (DWORD dwIndex
, DWORD
*pdwReserved
,
843 DWORD dwFlags
, DWORD
*pdwProvType
, LPSTR pszProvName
, DWORD
*pcbProvName
);
844 BOOL WINAPI
CryptEnumProvidersW (DWORD dwIndex
, DWORD
*pdwReserved
,
845 DWORD dwFlags
, DWORD
*pdwProvType
, LPWSTR pszProvName
, DWORD
*pcbProvName
);
846 #define CryptEnumProviders WINELIB_NAME_AW(CryptEnumProviders)
847 BOOL WINAPI
CryptEnumProviderTypesA (DWORD dwIndex
, DWORD
*pdwReserved
,
848 DWORD dwFlags
, DWORD
*pdwProvType
, LPSTR pszTypeName
, DWORD
*pcbTypeName
);
849 BOOL WINAPI
CryptEnumProviderTypesW (DWORD dwIndex
, DWORD
*pdwReserved
,
850 DWORD dwFlags
, DWORD
*pdwProvType
, LPWSTR pszTypeName
, DWORD
*pcbTypeName
);
851 #define CryptEnumProviderTypes WINELIB_NAME_AW(CryptEnumProviderTypes)
852 BOOL WINAPI
CryptExportKey (HCRYPTKEY hKey
, HCRYPTKEY hExpKey
, DWORD dwBlobType
,
853 DWORD dwFlags
, BYTE
*pbData
, DWORD
*pdwDataLen
);
854 BOOL WINAPI
CryptGenKey (HCRYPTPROV hProv
, ALG_ID Algid
, DWORD dwFlags
, HCRYPTKEY
*phKey
);
855 BOOL WINAPI
CryptGetKeyParam (HCRYPTKEY hKey
, DWORD dwParam
, BYTE
*pbData
,
856 DWORD
*pdwDataLen
, DWORD dwFlags
);
857 BOOL WINAPI
CryptGetHashParam (HCRYPTHASH hHash
, DWORD dwParam
, BYTE
*pbData
,
858 DWORD
*pdwDataLen
, DWORD dwFlags
);
859 BOOL WINAPI
CryptGetProvParam (HCRYPTPROV hProv
, DWORD dwParam
, BYTE
*pbData
,
860 DWORD
*pdwDataLen
, DWORD dwFlags
);
861 BOOL WINAPI
CryptGetDefaultProviderA (DWORD dwProvType
, DWORD
*pdwReserved
,
862 DWORD dwFlags
, LPSTR pszProvName
, DWORD
*pcbProvName
);
863 BOOL WINAPI
CryptGetDefaultProviderW (DWORD dwProvType
, DWORD
*pdwReserved
,
864 DWORD dwFlags
, LPWSTR pszProvName
, DWORD
*pcbProvName
);
865 #define CryptGetDefaultProvider WINELIB_NAME_AW(CryptGetDefaultProvider)
866 BOOL WINAPI
CryptGetUserKey (HCRYPTPROV hProv
, DWORD dwKeySpec
, HCRYPTKEY
*phUserKey
);
867 BOOL WINAPI
CryptHashData (HCRYPTHASH hHash
, BYTE
*pbData
, DWORD dwDataLen
, DWORD dwFlags
);
868 BOOL WINAPI
CryptHashSessionKey (HCRYPTHASH hHash
, HCRYPTKEY hKey
, DWORD dwFlags
);
869 BOOL WINAPI
CryptImportKey (HCRYPTPROV hProv
, BYTE
*pbData
, DWORD dwDataLen
,
870 HCRYPTKEY hPubKey
, DWORD dwFlags
, HCRYPTKEY
*phKey
);
871 BOOL WINAPI
CryptRegisterOIDFunction(DWORD
,LPCSTR
,LPCSTR
,LPCWSTR
,LPCSTR
);
873 BOOL WINAPI
CryptReleaseContext (HCRYPTPROV hProv
, DWORD dwFlags
);
874 BOOL WINAPI
CryptSignHashA (HCRYPTHASH hHash
, DWORD dwKeySpec
, LPCSTR sDescription
,
875 DWORD dwFlags
, BYTE
*pbSignature
, DWORD
*pdwSigLen
);
876 BOOL WINAPI
CryptSignHashW (HCRYPTHASH hHash
, DWORD dwKeySpec
, LPCWSTR sDescription
,
877 DWORD dwFlags
, BYTE
*pbSignature
, DWORD
*pdwSigLen
);
878 #define CryptSignHash WINELIB_NAME_AW(CryptSignHash)
879 BOOL WINAPI
CryptSetHashParam (HCRYPTHASH hHash
, DWORD dwParam
, BYTE
*pbData
, DWORD dwFlags
);
880 BOOL WINAPI
CryptSetKeyParam (HCRYPTKEY hKey
, DWORD dwParam
, BYTE
*pbData
, DWORD dwFlags
);
881 BOOL WINAPI
CryptSetProviderA (LPCSTR pszProvName
, DWORD dwProvType
);
882 BOOL WINAPI
CryptSetProviderW (LPCWSTR pszProvName
, DWORD dwProvType
);
883 #define CryptSetProvider WINELIB_NAME_AW(CryptSetProvider)
884 BOOL WINAPI
CryptSetProviderExA (LPCSTR pszProvName
, DWORD dwProvType
, DWORD
*pdwReserved
, DWORD dwFlags
);
885 BOOL WINAPI
CryptSetProviderExW (LPCWSTR pszProvName
, DWORD dwProvType
, DWORD
*pdwReserved
, DWORD dwFlags
);
886 #define CryptSetProviderEx WINELIB_NAME_AW(CryptSetProviderEx)
887 BOOL WINAPI
CryptSetProvParam (HCRYPTPROV hProv
, DWORD dwParam
, BYTE
*pbData
, DWORD dwFlags
);
888 BOOL WINAPI
CryptVerifySignatureA (HCRYPTHASH hHash
, BYTE
*pbSignature
, DWORD dwSigLen
,
889 HCRYPTKEY hPubKey
, LPCSTR sDescription
, DWORD dwFlags
);
890 BOOL WINAPI
CryptVerifySignatureW (HCRYPTHASH hHash
, BYTE
*pbSignature
, DWORD dwSigLen
,
891 HCRYPTKEY hPubKey
, LPCWSTR sDescription
, DWORD dwFlags
);
892 #define CryptVerifySignature WINELIB_NAME_AW(CryptVerifySignature)
894 /* cert store functions */
895 HCERTSTORE WINAPI
CertOpenStore(LPCSTR lpszStoreProvider
, DWORD dwEncodingType
,
896 HCRYPTPROV hCryptProv
, DWORD dwFlags
, const void *pvPara
);
898 HCERTSTORE WINAPI
CertOpenSystemStoreA(HCRYPTPROV hProv
,
899 LPCSTR szSubSystemProtocol
);
900 HCERTSTORE WINAPI
CertOpenSystemStoreW(HCRYPTPROV hProv
,
901 LPCWSTR szSubSystemProtocol
);
902 #define CertOpenSystemStore WINELIB_NAME_AW(CertOpenSystemStore)
904 PCCERT_CONTEXT WINAPI
CertEnumCertificatesInStore(HCERTSTORE hCertStore
, PCCERT_CONTEXT pPrev
);
906 BOOL WINAPI
CertEnumSystemStoreLocation(DWORD dwFlags
, void *pvArg
,
907 PFN_CERT_ENUM_SYSTEM_STORE_LOCATION pfnEnum
);
909 BOOL WINAPI
CertEnumSystemStore(DWORD dwFlags
, void *pvSystemStoreLocationPara
,
910 void *pvArg
, PFN_CERT_ENUM_SYSTEM_STORE pfnEnum
);
912 BOOL WINAPI
CertEnumPhysicalStore(const void *pvSystemStore
, DWORD dwFlags
,
913 void *pvArg
, PFN_CERT_ENUM_PHYSICAL_STORE pfnEnum
);
915 BOOL WINAPI
CertSaveStore(HCERTSTORE hCertStore
, DWORD dwMsgAndCertEncodingType
,
916 DWORD dwSaveAs
, DWORD dwSaveTo
, void* pvSaveToPara
, DWORD dwFlags
);
918 PCCRL_CONTEXT WINAPI
CertCreateCRLContext( DWORD dwCertEncodingType
,
919 const BYTE
* pbCrlEncoded
, DWORD cbCrlEncoded
);
921 BOOL WINAPI
CertAddStoreToCollection(HCERTSTORE hCollectionStore
,
922 HCERTSTORE hSiblingStore
, DWORD dwUpdateFlags
, DWORD dwPriority
);
924 void WINAPI
CertRemoveStoreFromCollection(HCERTSTORE hCollectionStore
,
925 HCERTSTORE hSiblingStore
);
927 PCCERT_CHAIN_CONTEXT WINAPI
CertFindChainInStore(HCERTSTORE hCertStore
,
928 DWORD dwCertEncodingType
, DWORD dwFindFlags
, DWORD dwFindType
,
929 const void *pvFindPara
, PCCERT_CHAIN_CONTEXT pPrevChainContext
);
931 BOOL WINAPI
CertVerifyCertificateChainPolicy(LPCSTR szPolicyOID
,
932 PCCERT_CHAIN_CONTEXT pChainContext
, PCERT_CHAIN_POLICY_PARA pPolicyPara
,
933 PCERT_CHAIN_POLICY_STATUS pPolicyStatus
);
935 BOOL WINAPI
CertCloseStore( HCERTSTORE hCertStore
, DWORD dwFlags
);
937 BOOL WINAPI
CertFreeCertificateContext( PCCERT_CONTEXT pCertContext
);