xref: /reactos/sdk/include/psdk/wincrypt.h (revision fb5d5ecd)
1 /*
2  * Copyright (C) 2002 Travis Michielsen
3  * Copyright (C) 2004-2005 Juan Lang
4  * Copyright (C) 2007 Vijay Kiran Kamuju
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20 
21 #ifndef __WINE_WINCRYPT_H
22 #define __WINE_WINCRYPT_H
23 
24 #include <specstrings.h>
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 #ifdef _MSC_VER
31 #pragma warning(push)
32 #pragma warning(disable:4201)
33 #endif
34 
35 #include <bcrypt.h>
36 /* FIXME: #include <ncrypt.h> */
37 
38 #ifdef _ADVAPI32_
39 # define WINADVAPI
40 #else
41 # define WINADVAPI DECLSPEC_IMPORT
42 #endif
43 
44 /* some typedefs for function parameters */
45 typedef unsigned int ALG_ID;
46 typedef ULONG_PTR HCRYPTPROV;
47 typedef ULONG_PTR HCRYPTPROV_OR_NCRYPT_KEY_HANDLE;
48 typedef ULONG_PTR HCRYPTPROV_LEGACY;
49 typedef ULONG_PTR HCRYPTKEY;
50 typedef ULONG_PTR HCRYPTHASH;
51 typedef void *HCERTSTORE;
52 typedef void *HCRYPTMSG;
53 typedef void *HCERTSTOREPROV;
54 typedef void *HCRYPTOIDFUNCSET;
55 typedef void *HCRYPTOIDFUNCADDR;
56 typedef void *HCRYPTDEFAULTCONTEXT;
57 
58 /* CSP Structs */
59 
60 typedef struct _PROV_ENUMALGS {
61   ALG_ID aiAlgid;
62   DWORD  dwBitLen;
63   DWORD  dwNameLen;
64   CHAR   szName[20];
65 } PROV_ENUMALGS;
66 
67 typedef struct _PROV_ENUMALGS_EX {
68   ALG_ID aiAlgid;
69   DWORD  dwDefaultLen;
70   DWORD  dwMinLen;
71   DWORD  dwMaxLen;
72   DWORD  dwProtocols;
73   DWORD  dwNameLen;
74   CHAR   szName[20];
75   DWORD  dwLongNameLen;
76   CHAR   szLongName[40];
77 } PROV_ENUMALGS_EX;
78 
79 #define SCHANNEL_MAC_KEY 0
80 #define SCHANNEL_ENC_KEY 1
81 
82 typedef struct _SCHANNEL_ALG {
83   DWORD  dwUse;
84   ALG_ID Algid;
85   DWORD  cBits;
86   DWORD  dwFlags;
87   DWORD  dwReserved;
88 } SCHANNEL_ALG, *PSCHANNEL_ALG;
89 
90 
91 #define CRYPT_IPSEC_HMAC_KEY 0x0100
92 
93 typedef struct _HMAC_INFO {
94   ALG_ID HashAlgid;
95   BYTE*  pbInnerString;
96   DWORD  cbInnerString;
97   BYTE*  pbOuterString;
98   DWORD  cbOuterString;
99 } HMAC_INFO, *PHMAC_INFO;
100 
101 typedef struct _CRYPTOAPI_BLOB {
102   DWORD    cbData;
103   BYTE*    pbData;
104 } CRYPT_INTEGER_BLOB,  *PCRYPT_INTEGER_BLOB,
105   CRYPT_UINT_BLOB,     *PCRYPT_UINT_BLOB,
106   CRYPT_OBJID_BLOB,    *PCRYPT_OBJID_BLOB,
107   CERT_NAME_BLOB,      *PCERT_NAME_BLOB,
108   CERT_RDN_VALUE_BLOB, *PCERT_RDN_VALUE_BLOB,
109   CERT_BLOB,           *PCERT_BLOB,
110   CRL_BLOB,            *PCRL_BLOB,
111   DATA_BLOB,           *PDATA_BLOB,
112   CRYPT_DATA_BLOB,     *PCRYPT_DATA_BLOB,
113   CRYPT_HASH_BLOB,     *PCRYPT_HASH_BLOB,
114   CRYPT_DIGEST_BLOB,   *PCRYPT_DIGEST_BLOB,
115   CRYPT_DER_BLOB,      *PCRYPT_DER_BLOB,
116   CRYPT_ATTR_BLOB,     *PCRYPT_ATTR_BLOB;
117 
118 typedef struct _CRYPTPROTECT_PROMPTSTRUCT{
119   DWORD   cbSize;
120   DWORD   dwPromptFlags;
121   HWND    hwndApp;
122   LPCWSTR szPrompt;
123 } CRYPTPROTECT_PROMPTSTRUCT, *PCRYPTPROTECT_PROMPTSTRUCT;
124 
125 typedef struct _CRYPT_ALGORITHM_IDENTIFIER {
126   LPSTR            pszObjId;
127   CRYPT_OBJID_BLOB Parameters;
128 } CRYPT_ALGORITHM_IDENTIFIER, *PCRYPT_ALGORITHM_IDENTIFIER;
129 
130 typedef struct _CRYPT_ATTRIBUTE_TYPE_VALUE {
131   LPSTR               pszObjId;
132   CRYPT_OBJID_BLOB    Value;
133 } CRYPT_ATTRIBUTE_TYPE_VALUE, *PCRYPT_ATTRIBUTE_TYPE_VALUE;
134 
135 typedef struct _PUBLICKEYSTRUC {
136     BYTE   bType;
137     BYTE   bVersion;
138     WORD   reserved;
139     ALG_ID aiKeyAlg;
140 } BLOBHEADER, PUBLICKEYSTRUC;
141 
142 typedef struct _RSAPUBKEY {
143     DWORD   magic;
144     DWORD   bitlen;
145     DWORD   pubexp;
146 } RSAPUBKEY;
147 
148 typedef struct _PUBKEY {
149     DWORD   magic;
150     DWORD   bitlen;
151 } DHPUBKEY, DSSPUBKEY, KEAPUBKEY, TEKPUBKEY;
152 
153 typedef struct _DSSSEED {
154     DWORD   counter;
155     BYTE    seed[20];
156 } DSSSEED;
157 
158 typedef struct _PUBKEYVER3 {
159     DWORD   magic;
160     DWORD   bitlenP;
161     DWORD   bitlenQ;
162     DWORD   bitlenJ;
163     DSSSEED DSSSeed;
164 } DHPUBKEY_VER3, DSSPUBKEY_VER3;
165 
166 typedef struct _PRIVKEYVER3 {
167     DWORD   magic;
168     DWORD   bitlenP;
169     DWORD   bitlenQ;
170     DWORD   bitlenJ;
171     DWORD   bitlenX;
172     DSSSEED DSSSeed;
173 } DHPRIVKEY_VER3, DSSPRIVKEY_VER3;
174 
175 typedef struct _KEY_TYPE_SUBTYPE {
176     DWORD   dwKeySpec;
177     GUID    Type;
178     GUID    SubType;
179 } KEY_TYPE_SUBTYPE, *PKEY_TYPE_SUBTYPE;
180 
181 typedef struct _CERT_FORTEZZA_DATA_PROP {
182     unsigned char   SerialNumber[8];
183     int             CertIndex;
184     unsigned char   CertLabel[36];
185 } CERT_FORTEZZA_DATA_PROP;
186 
187 typedef struct _CMS_DH_KEY_INFO {
188     DWORD             dwVersion;
189     ALG_ID            Algid;
190     LPSTR             pszContentEncObjId;
191     CRYPT_DATA_BLOB   PubInfo;
192     void              *pReserved;
193 } CMS_DH_KEY_INFO, *PCMS_DH_KEY_INFO;
194 
195 typedef struct _CRYPT_BIT_BLOB {
196     DWORD cbData;
197     BYTE  *pbData;
198     DWORD cUnusedBits;
199 } CRYPT_BIT_BLOB, *PCRYPT_BIT_BLOB;
200 
201 typedef struct _CRYPT_KEY_PROV_PARAM {
202     DWORD dwParam;
203     BYTE *pbData;
204     DWORD cbData;
205     DWORD dwFlags;
206 } CRYPT_KEY_PROV_PARAM, *PCRYPT_KEY_PROV_PARAM;
207 
208 typedef struct _CRYPT_KEY_PROV_INFO {
209     LPWSTR                pwszContainerName;
210     LPWSTR                pwszProvName;
211     DWORD                 dwProvType;
212     DWORD                 dwFlags;
213     DWORD                 cProvParam;
214     PCRYPT_KEY_PROV_PARAM rgProvParam;
215     DWORD                 dwKeySpec;
216 } CRYPT_KEY_PROV_INFO, *PCRYPT_KEY_PROV_INFO;
217 
218 typedef struct _CERT_KEY_CONTEXT {
219     DWORD      cbSize;
220     HCRYPTPROV hCryptProv;
221     DWORD      dwKeySpec;
222 } CERT_KEY_CONTEXT, *PCERT_KEY_CONTEXT;
223 
224 typedef struct _CERT_PUBLIC_KEY_INFO {
225     CRYPT_ALGORITHM_IDENTIFIER Algorithm;
226     CRYPT_BIT_BLOB             PublicKey;
227 } CERT_PUBLIC_KEY_INFO, *PCERT_PUBLIC_KEY_INFO;
228 
229 typedef struct _CERT_EXTENSION {
230     LPSTR               pszObjId;
231     BOOL                fCritical;
232     CRYPT_OBJID_BLOB    Value;
233 } CERT_EXTENSION, *PCERT_EXTENSION;
234 
235 typedef struct _CERT_EXTENSIONS {
236     DWORD           cExtension;
237     PCERT_EXTENSION rgExtension;
238 } CERT_EXTENSIONS, *PCERT_EXTENSIONS;
239 
240 typedef struct _CERT_INFO {
241     DWORD                      dwVersion;
242     CRYPT_INTEGER_BLOB         SerialNumber;
243     CRYPT_ALGORITHM_IDENTIFIER SignatureAlgorithm;
244     CERT_NAME_BLOB             Issuer;
245     FILETIME                   NotBefore;
246     FILETIME                   NotAfter;
247     CERT_NAME_BLOB             Subject;
248     CERT_PUBLIC_KEY_INFO       SubjectPublicKeyInfo;
249     CRYPT_BIT_BLOB             IssuerUniqueId;
250     CRYPT_BIT_BLOB             SubjectUniqueId;
251     DWORD                      cExtension;
252     PCERT_EXTENSION            rgExtension;
253 } CERT_INFO, *PCERT_INFO;
254 
255 typedef struct _CERT_RDN_ATTR {
256     LPSTR               pszObjId;
257     DWORD               dwValueType;
258     CERT_RDN_VALUE_BLOB Value;
259 } CERT_RDN_ATTR, *PCERT_RDN_ATTR;
260 
261 typedef struct _CERT_RDN {
262     DWORD          cRDNAttr;
263     PCERT_RDN_ATTR rgRDNAttr;
264 } CERT_RDN, *PCERT_RDN;
265 
266 typedef struct _CERT_NAME_INFO {
267     DWORD     cRDN;
268     PCERT_RDN rgRDN;
269 } CERT_NAME_INFO, *PCERT_NAME_INFO;
270 
271 typedef struct _CERT_NAME_VALUE {
272     DWORD               dwValueType;
273     CERT_RDN_VALUE_BLOB Value;
274 } CERT_NAME_VALUE, *PCERT_NAME_VALUE;
275 
276 typedef struct _CERT_ENCRYPTED_PRIVATE_KEY_INFO {
277     CRYPT_ALGORITHM_IDENTIFIER EncryptionAlgorithm;
278     CRYPT_DATA_BLOB            EncryptedPrivateKey;
279 } CERT_ENCRYPTED_PRIVATE_KEY_INFO, *PCERT_ENCRYPTED_PRIVATE_KEY_INFO;
280 
281 typedef struct _CERT_AUTHORITY_KEY_ID_INFO {
282     CRYPT_DATA_BLOB    KeyId;
283     CERT_NAME_BLOB     CertIssuer;
284     CRYPT_INTEGER_BLOB CertSerialNumber;
285 } CERT_AUTHORITY_KEY_ID_INFO, *PCERT_AUTHORITY_KEY_ID_INFO;
286 
287 typedef struct _CERT_PRIVATE_KEY_VALIDITY {
288     FILETIME NotBefore;
289     FILETIME NotAfter;
290 } CERT_PRIVATE_KEY_VALIDITY, *PCERT_PRIVATE_KEY_VALIDITY;
291 
292 typedef struct _CERT_KEY_ATTRIBUTES_INFO {
293     CRYPT_DATA_BLOB            KeyId;
294     CRYPT_BIT_BLOB             IntendedKeyUsage;
295     PCERT_PRIVATE_KEY_VALIDITY pPrivateKeyUsagePeriod;
296 } CERT_KEY_ATTRIBUTES_INFO, *PCERT_KEY_ATTRIBUTES_INFO;
297 
298 typedef struct _CERT_ECC_SIGNATURE {
299     CRYPT_UINT_BLOB r;
300     CRYPT_UINT_BLOB s;
301 } CERT_ECC_SIGNATURE, *PCERT_ECC_SIGNATURE;
302 
303 /* byte 0 */
304 #define CERT_DIGITAL_SIGNATURE_KEY_USAGE 0x80
305 #define CERT_NON_REPUDIATION_KEY_USAGE   0x40
306 #define CERT_KEY_ENCIPHERMENT_KEY_USAGE  0x20
307 #define CERT_DATA_ENCIPHERMENT_KEY_USAGE 0x10
308 #define CERT_KEY_AGREEMENT_KEY_USAGE     0x08
309 #define CERT_KEY_CERT_SIGN_KEY_USAGE     0x04
310 #define CERT_OFFLINE_CRL_SIGN_KEY_USAGE  0x02
311 #define CERT_CRL_SIGN_KEY_USAGE          0x02
312 #define CERT_ENCIPHER_ONLY_KEY_USAGE     0x01
313 /* byte 1 */
314 #define CERT_DECIPHER_ONLY_KEY_USAGE     0x80
315 
316 typedef struct _CERT_POLICY_ID {
317     DWORD  cCertPolicyElementId;
318     LPSTR *rgbszCertPolicyElementId;
319 } CERT_POLICY_ID, *PCERT_POLICY_ID;
320 
321 typedef struct _CERT_KEY_USAGE_RESTRICTION_INFO {
322     DWORD           cCertPolicyId;
323     PCERT_POLICY_ID rgCertPolicyId;
324     CRYPT_BIT_BLOB  RestrictedKeyUsage;
325 } CERT_KEY_USAGE_RESTRICTION_INFO, *PCERT_KEY_USAGE_RESTRICTION_INFO;
326 
327 typedef struct _CERT_OTHER_NAME {
328     LPSTR            pszObjId;
329     CRYPT_OBJID_BLOB Value;
330 } CERT_OTHER_NAME, *PCERT_OTHER_NAME;
331 
332 typedef struct _CERT_ALT_NAME_ENTRY {
333     DWORD dwAltNameChoice;
334     union {
335         PCERT_OTHER_NAME pOtherName;
336         LPWSTR           pwszRfc822Name;
337         LPWSTR           pwszDNSName;
338         CERT_NAME_BLOB   DirectoryName;
339         LPWSTR           pwszURL;
340         CRYPT_DATA_BLOB  IPAddress;
341         LPSTR            pszRegisteredID;
342     } DUMMYUNIONNAME;
343 } CERT_ALT_NAME_ENTRY, *PCERT_ALT_NAME_ENTRY;
344 
345 #define CERT_ALT_NAME_OTHER_NAME     1
346 #define CERT_ALT_NAME_RFC822_NAME    2
347 #define CERT_ALT_NAME_DNS_NAME       3
348 #define CERT_ALT_NAME_X400_ADDRESS   4
349 #define CERT_ALT_NAME_DIRECTORY_NAME 5
350 #define CERT_ALT_NAME_EDI_PARTY_NAME 6
351 #define CERT_ALT_NAME_URL            7
352 #define CERT_ALT_NAME_IP_ADDRESS     8
353 #define CERT_ALT_NAME_REGISTERED_ID  9
354 
355 typedef struct _CERT_ALT_NAME_INFO {
356     DWORD                cAltEntry;
357     PCERT_ALT_NAME_ENTRY rgAltEntry;
358 } CERT_ALT_NAME_INFO, *PCERT_ALT_NAME_INFO;
359 
360 #define CERT_ALT_NAME_ENTRY_ERR_INDEX_MASK  0xff
361 #define CERT_ALT_NAME_ENTRY_ERR_INDEX_SHIFT 16
362 #define CERT_ALT_NAME_VALUE_ERR_INDEX_MASK  0x0000ffff
363 #define CERT_ALT_NAME_VALUE_ERR_INDEX_SHIFT 0
364 #define GET_CERT_ALT_NAME_ENTRY_ERR_INDEX(x) \
365  (((x) >> CERT_ALT_NAME_ENTRY_ERR_INDEX_SHIFT) & \
366   CERT_ALT_NAME_ENTRY_ERR_INDEX_MASK)
367 #define GET_CERT_ALT_NAME_VALUE_ERR_INDEX(x) \
368  ((x) & CERT_ALT_NAME_VALUE_ERR_INDEX_MASK)
369 
370 typedef struct _CERT_BASIC_CONSTRAINTS_INFO {
371     CRYPT_BIT_BLOB  SubjectType;
372     BOOL            fPathLenConstraint;
373     DWORD           dwPathLenConstraint;
374     DWORD           cSubtreesConstraint;
375     CERT_NAME_BLOB *rgSubtreesConstraint;
376 } CERT_BASIC_CONSTRAINTS_INFO, *PCERT_BASIC_CONSTRAINTS_INFO;
377 
378 #define CERT_CA_SUBJECT_FLAG         0x80
379 #define CERT_END_ENTITY_SUBJECT_FLAG 0x40
380 
381 typedef struct _CERT_BASIC_CONSTRAINTS2_INFO {
382     BOOL  fCA;
383     BOOL  fPathLenConstraint;
384     DWORD dwPathLenConstraint;
385 } CERT_BASIC_CONSTRAINTS2_INFO, *PCERT_BASIC_CONSTRAINTS2_INFO;
386 
387 typedef struct _CERT_POLICY_QUALIFIER_INFO {
388     LPSTR            pszPolicyQualifierId;
389     CRYPT_OBJID_BLOB Qualifier;
390 } CERT_POLICY_QUALIFIER_INFO, *PCERT_POLICY_QUALIFIER_INFO;
391 
392 typedef struct _CERT_POLICY_INFO {
393     LPSTR                       pszPolicyIdentifier;
394     DWORD                       cPolicyQualifier;
395     CERT_POLICY_QUALIFIER_INFO *rgPolicyQualifier;
396 } CERT_POLICY_INFO, *PCERT_POLICY_INFO;
397 
398 typedef struct _CERT_POLICIES_INFO {
399     DWORD             cPolicyInfo;
400     CERT_POLICY_INFO *rgPolicyInfo;
401 } CERT_POLICIES_INFO, *PCERT_POLICIES_INFO;
402 
403 typedef struct _CERT_POLICY_QUALIFIER_NOTICE_REFERENCE {
404     LPSTR pszOrganization;
405     DWORD cNoticeNumbers;
406     int  *rgNoticeNumbers;
407 } CERT_POLICY_QUALIFIER_NOTICE_REFERENCE,
408  *PCERT_POLICY_QUALIFIER_NOTICE_REFERENCE;
409 
410 typedef struct _CERT_POLICY_QUALIFIER_USER_NOTICE {
411     CERT_POLICY_QUALIFIER_NOTICE_REFERENCE *pNoticeReference;
412     LPWSTR                                  pszDisplayText;
413 } CERT_POLICY_QUALIFIER_USER_NOTICE, *PCERT_POLICY_QUALIFIER_USER_NOTICE;
414 
415 typedef struct _CPS_URLS {
416     LPWSTR                      pszURL;
417     CRYPT_ALGORITHM_IDENTIFIER *pAlgorithm;
418     CRYPT_DATA_BLOB            *pDigest;
419 } CPS_URLS, *PCPS_URLS;
420 
421 typedef struct _CERT_POLICY95_QUALIFIER1 {
422     LPWSTR    pszPracticesReference;
423     LPSTR     pszNoticeIdentifier;
424     LPSTR     pszNSINoticeIdentifier;
425     DWORD     cCPSURLs;
426     CPS_URLS *rgCPSURLs;
427 } CERT_POLICY95_QUALIFIER1, *PCERT_POLICY95_QUALIFIER1;
428 
429 typedef struct _CERT_POLICY_MAPPING {
430     LPSTR pszIssuerDomainPolicy;
431     LPSTR pszSubjectDomainPolicy;
432 } CERT_POLICY_MAPPING, *PCERT_POLICY_MAPPING;
433 
434 typedef struct _CERT_POLICY_MAPPINGS_INFO {
435     DWORD                cPolicyMapping;
436     PCERT_POLICY_MAPPING rgPolicyMapping;
437 } CERT_POLICY_MAPPINGS_INFO, *PCERT_POLICY_MAPPINGS_INFO;
438 
439 typedef struct _CERT_POLICY_CONSTRAINTS_INFO {
440     BOOL  fRequireExplicitPolicy;
441     DWORD dwRequireExplicitPolicySkipCerts;
442     BOOL  fInhibitPolicyMapping;
443     DWORD dwInhibitPolicyMappingSkipCerts;
444 } CERT_POLICY_CONSTRAINTS_INFO, *PCERT_POLICY_CONSTRAINTS_INFO;
445 
446 typedef struct _CRYPT_CONTENT_INFO_SEQUENCE_OF_ANY {
447     LPSTR           pszObjId;
448     DWORD           cValue;
449     PCRYPT_DER_BLOB rgValue;
450 } CRYPT_CONTENT_INFO_SEQUENCE_OF_ANY, *PCRYPT_CONTENT_INFO_SEQUENCE_OF_ANY;
451 
452 typedef struct _CRYPT_CONTENT_INFO {
453     LPSTR          pszObjId;
454     CRYPT_DER_BLOB Content;
455 } CRYPT_CONTENT_INFO, *PCRYPT_CONTENT_INFO;
456 
457 typedef struct _CRYPT_SEQUENCE_OF_ANY {
458     DWORD           cValue;
459     PCRYPT_DER_BLOB rgValue;
460 } CRYPT_SEQUENCE_OF_ANY, *PCRYPT_SEQUENCE_OF_ANY;
461 
462 typedef struct _CERT_AUTHORITY_KEY_ID2_INFO {
463     CRYPT_DATA_BLOB    KeyId;
464     CERT_ALT_NAME_INFO AuthorityCertIssuer;
465     CRYPT_INTEGER_BLOB AuthorityCertSerialNumber;
466 } CERT_AUTHORITY_KEY_ID2_INFO, *PCERT_AUTHORITY_KEY_ID2_INFO;
467 
468 typedef struct _CERT_ACCESS_DESCRIPTION {
469     LPSTR               pszAccessMethod;
470     CERT_ALT_NAME_ENTRY AccessLocation;
471 } CERT_ACCESS_DESCRIPTION, *PCERT_ACCESS_DESCRIPTION;
472 
473 typedef struct _CERT_AUTHORITY_INFO_ACCESS {
474     DWORD                    cAccDescr;
475     PCERT_ACCESS_DESCRIPTION rgAccDescr;
476 } CERT_AUTHORITY_INFO_ACCESS, *PCERT_AUTHORITY_INFO_ACCESS;
477 
478 typedef struct _CERT_CONTEXT {
479     DWORD      dwCertEncodingType;
480     BYTE       *pbCertEncoded;
481     DWORD      cbCertEncoded;
482     PCERT_INFO pCertInfo;
483     HCERTSTORE hCertStore;
484 } CERT_CONTEXT, *PCERT_CONTEXT;
485 typedef const CERT_CONTEXT *PCCERT_CONTEXT;
486 
487 typedef struct _CRL_ENTRY {
488     CRYPT_INTEGER_BLOB SerialNumber;
489     FILETIME           RevocationDate;
490     DWORD              cExtension;
491     PCERT_EXTENSION    rgExtension;
492 } CRL_ENTRY, *PCRL_ENTRY;
493 
494 typedef struct _CRL_INFO {
495     DWORD           dwVersion;
496     CRYPT_ALGORITHM_IDENTIFIER SignatureAlgorithm;
497     CERT_NAME_BLOB  Issuer;
498     FILETIME        ThisUpdate;
499     FILETIME        NextUpdate;
500     DWORD           cCRLEntry;
501     PCRL_ENTRY      rgCRLEntry;
502     DWORD           cExtension;
503     PCERT_EXTENSION rgExtension;
504 } CRL_INFO, *PCRL_INFO;
505 
506 typedef struct _CRL_DIST_POINT_NAME {
507     DWORD dwDistPointNameChoice;
508     union {
509         CERT_ALT_NAME_INFO FullName;
510     } DUMMYUNIONNAME;
511 } CRL_DIST_POINT_NAME, *PCRL_DIST_POINT_NAME;
512 
513 #define CRL_DIST_POINT_NO_NAME         0
514 #define CRL_DIST_POINT_FULL_NAME       1
515 #define CRL_DIST_POINT_ISSUER_RDN_NAME 2
516 
517 typedef struct _CRL_DIST_POINT {
518     CRL_DIST_POINT_NAME DistPointName;
519     CRYPT_BIT_BLOB      ReasonFlags;
520     CERT_ALT_NAME_INFO  CRLIssuer;
521 } CRL_DIST_POINT, *PCRL_DIST_POINT;
522 
523 #define CRL_REASON_UNUSED_FLAG                 0x80
524 #define CRL_REASON_KEY_COMPROMISE_FLAG         0x40
525 #define CRL_REASON_CA_COMPROMISE_FLAG          0x20
526 #define CRL_REASON_AFFILIATION_CHANGED_FLAG    0x10
527 #define CRL_REASON_SUPERSEDED_FLAG             0x08
528 #define CRL_REASON_CESSATION_OF_OPERATION_FLAG 0x04
529 #define CRL_REASON_CERTIFICATE_HOLD_FLAG       0x02
530 
531 typedef struct _CRL_DIST_POINTS_INFO {
532     DWORD           cDistPoint;
533     PCRL_DIST_POINT rgDistPoint;
534 } CRL_DIST_POINTS_INFO, *PCRL_DIST_POINTS_INFO;
535 
536 #define CRL_DIST_POINT_ERR_INDEX_MASK  0x7f
537 #define CRL_DIST_POINT_ERR_INDEX_SHIFT 24
538 #define GET_CRL_DIST_POINT_ERR_INDEX(x) \
539  (((x) >> CRL_DIST_POINT_ERR_INDEX_SHIFT) & CRL_DIST_POINT_ERR_INDEX_MASK)
540 
541 #define CRL_DIST_POINT_ERR_CRL_ISSUER_BIT 0x80000000L
542 #define IS_CRL_DIST_POINT_ERR_CRL_ISSUER(x) \
543  ((x) & CRL_DIST_POINT_ERR_CRL_ISSUER_BIT)
544 
545 typedef struct _CROSS_CERT_DIST_POINTS_INFO {
546     DWORD               dwSyncDeltaTime;
547     DWORD               cDistPoint;
548     PCERT_ALT_NAME_INFO rgDistPoint;
549 } CROSS_CERT_DIST_POINTS_INFO, *PCROSS_CERT_DIST_POINTS_INFO;
550 
551 #define CROSS_CERT_DIST_POINT_ERR_INDEX_MASK  0xff
552 #define CROSS_CERT_DIST_POINT_ERR_INDEX_SHIFT 24
553 #define GET_CROSS_CERT_DIST_POINT_ERR_INDEX(x) \
554  (((x) >> CROSS_CERT_DIST_POINT_ERR_INDEX_SHIFT) & \
555  CROSS_CERT_DIST_POINT_ERR_INDEX_MASK)
556 
557 typedef struct _CERT_PAIR {
558     CERT_BLOB Forward;
559     CERT_BLOB Reverse;
560 } CERT_PAIR, *PCERT_PAIR;
561 
562 typedef struct _CRL_ISSUING_DIST_POINT {
563     CRL_DIST_POINT_NAME DistPointName;
564     BOOL                fOnlyContainsUserCerts;
565     BOOL                fOnlyContainsCACerts;
566     CRYPT_BIT_BLOB      OnlySomeReasonFlags;
567     BOOL                fIndirectCRL;
568 } CRL_ISSUING_DIST_POINT, *PCRL_ISSUING_DIST_POINT;
569 
570 typedef struct _CERT_GENERAL_SUBTREE {
571     CERT_ALT_NAME_ENTRY Base;
572     DWORD               dwMinimum;
573     BOOL                fMaximum;
574     DWORD               dwMaximum;
575 } CERT_GENERAL_SUBTREE, *PCERT_GENERAL_SUBTREE;
576 
577 typedef struct _CERT_NAME_CONSTRAINTS_INFO {
578     DWORD                 cPermittedSubtree;
579     PCERT_GENERAL_SUBTREE rgPermittedSubtree;
580     DWORD                 cExcludedSubtree;
581     PCERT_GENERAL_SUBTREE rgExcludedSubtree;
582 } CERT_NAME_CONSTRAINTS_INFO, *PCERT_NAME_CONSTRAINTS_INFO;
583 
584 #define CERT_EXCLUDED_SUBTREE_BIT 0x80000000L
585 #define IS_CERT_EXCLUDED_SUBTREE(x) ((x) & CERT_EXCLUDED_SUBTREE_BIT)
586 
587 typedef struct _CRYPT_ATTRIBUTE {
588     LPSTR            pszObjId;
589     DWORD            cValue;
590     PCRYPT_DATA_BLOB rgValue;
591 } CRYPT_ATTRIBUTE, *PCRYPT_ATTRIBUTE;
592 
593 typedef struct _CRYPT_ATTRIBUTES {
594     DWORD            cAttr;
595     PCRYPT_ATTRIBUTE rgAttr;
596 } CRYPT_ATTRIBUTES, *PCRYPT_ATTRIBUTES;
597 
598 typedef struct _CERT_REQUEST_INFO {
599     DWORD                dwVersion;
600     CERT_NAME_BLOB       Subject;
601     CERT_PUBLIC_KEY_INFO SubjectPublicKeyInfo;
602     DWORD                cAttribute;
603     PCRYPT_ATTRIBUTE     rgAttribute;
604 } CERT_REQUEST_INFO, *PCERT_REQUEST_INFO;
605 
606 typedef struct _CERT_KEYGEN_REQUEST_INFO {
607     DWORD                dwVersion;
608     CERT_PUBLIC_KEY_INFO SubjectPublicKeyInfo;
609     LPWSTR               pwszChallengeString;
610 } CERT_KEYGEN_REQUEST_INFO, *PCERT_KEYGEN_REQUEST_INFO;
611 
612 typedef struct _CERT_SIGNED_CONTENT_INFO {
613     CRYPT_DER_BLOB             ToBeSigned;
614     CRYPT_ALGORITHM_IDENTIFIER SignatureAlgorithm;
615     CRYPT_BIT_BLOB             Signature;
616 } CERT_SIGNED_CONTENT_INFO, *PCERT_SIGNED_CONTENT_INFO;
617 
618 typedef struct _CRL_CONTEXT {
619     DWORD      dwCertEncodingType;
620     BYTE      *pbCrlEncoded;
621     DWORD      cbCrlEncoded;
622     PCRL_INFO  pCrlInfo;
623     HCERTSTORE hCertStore;
624 } CRL_CONTEXT, *PCRL_CONTEXT;
625 typedef const CRL_CONTEXT *PCCRL_CONTEXT;
626 
627 #define SORTED_CTL_EXT_FLAGS_OFFSET                (0*4)
628 #define SORTED_CTL_EXT_COUNT_OFFSET                (1*4)
629 #define SORTED_CTL_EXT_MAX_COLLISION_OFFSET        (2*4)
630 #define SORTED_CTL_EXT_HASH_BUCKET_OFFSET          (3*4)
631 
632 #define SORTED_CTL_EXT_HASHED_SUBJECT_IDENTIFIER_FLAG    0x1
633 
634 typedef struct _CERT_DSS_PARAMETERS {
635     CRYPT_UINT_BLOB    p;
636     CRYPT_UINT_BLOB    q;
637     CRYPT_UINT_BLOB    g;
638 } CERT_DSS_PARAMETERS, *PCERT_DSS_PARAMETERS;
639 
640 #define CERT_DSS_R_LEN            20
641 #define CERT_DSS_S_LEN            20
642 #define CERT_DSS_SIGNATURE_LEN    (CERT_DSS_R_LEN + CERT_DSS_S_LEN)
643 
644 #define CERT_MAX_ENCODED_DSS_SIGNATURE_LEN    (2 + 2*(2 + 20 +1))
645 
646 typedef struct _CERT_DH_PARAMETERS {
647     CRYPT_UINT_BLOB    p;
648     CRYPT_UINT_BLOB    g;
649 } CERT_DH_PARAMETERS, *PCERT_DH_PARAMETERS;
650 
651 typedef struct _CERT_X942_DH_VALIDATION_PARAMS {
652     CRYPT_BIT_BLOB     seed;
653     DWORD              pgenCounter;
654 } CERT_X942_DH_VALIDATION_PARAMS, *PCERT_X942_DH_VALIDATION_PARAMS;
655 
656 typedef struct _CERT_X942_DH_PARAMETERS {
657     CRYPT_UINT_BLOB                    p;
658     CRYPT_UINT_BLOB                    g;
659     CRYPT_UINT_BLOB                    q;
660     CRYPT_UINT_BLOB                    j;
661     PCERT_X942_DH_VALIDATION_PARAMS    pValidationParams;
662 } CERT_X942_DH_PARAMETERS, *PCERT_X942_DH_PARAMETERS;
663 
664 #define CRYPT_X942_COUNTER_BYTE_LENGTH        4
665 #define CRYPT_X942_KEY_LENGTH_BYTE_LENGTH     4
666 #define CRYPT_X942_PUB_INFO_BYTE_LENGTH       (512/8)
667 
668 typedef struct _CRYPT_X942_OTHER_INFO {
669     LPSTR              pszContentEncryptionObjId;
670     BYTE               rgbCounter[CRYPT_X942_COUNTER_BYTE_LENGTH];
671     BYTE               rgbKeyLength[CRYPT_X942_KEY_LENGTH_BYTE_LENGTH];
672     CRYPT_DATA_BLOB    PubInfo;
673 } CRYPT_X942_OTHER_INFO, *PCRYPT_X942_OTHER_INFO;
674 
675 typedef struct _CRYPT_RC2_CBC_PARAMETERS {
676     DWORD    dwVersion;
677     BOOL     fIV;
678     BYTE     rgbIV[4];
679 } CRYPT_RC2_CBC_PARAMETERS, *PCRYPT_RC2_CBC_PARAMETERS;
680 
681 #define CRYPT_RC2_40BIT_VERSION    160
682 #define CRYPT_RC2_56BIT_VERSION    52
683 #define CRYPT_RC2_64BIT_VERSION    120
684 #define CRYPT_RC2_128BIT_VERSION   58
685 
686 typedef struct _CRYPT_SMIME_CAPABILITY {
687     LPSTR               pszObjId;
688     CRYPT_OBJID_BLOB    Parameters;
689 } CRYPT_SMIME_CAPABILITY, *PCRYPT_SMIME_CAPABILITY;
690 
691 typedef struct _CRYPT_SMIME_CAPABILITIES {
692     DWORD                   cCapability;
693     PCRYPT_SMIME_CAPABILITY rgCapability;
694 } CRYPT_SMIME_CAPABILITIES, *PCRYPT_SMIME_CAPABILITIES;
695 
696 typedef struct _VTableProvStruc {
697     DWORD    Version;
698 #ifdef WINE_STRICT_PROTOTYPES
699     BOOL     (WINAPI *FuncVerifyImage)(LPCSTR,BYTE*);
700     void     (WINAPI *FuncReturnhWnd)(HWND*);
701 #else
702     FARPROC  FuncVerifyImage;
703     FARPROC  FuncReturnhWnd;
704 #endif
705     DWORD    dwProvType;
706     BYTE    *pbContextInfo;
707     DWORD    cbContextInfo;
708     LPSTR    pszProvName;
709 } VTableProvStruc, *PVTableProvStruc;
710 
711 typedef struct _CERT_PRIVATE_KEY_INFO {
712     DWORD                      Version;
713     CRYPT_ALGORITHM_IDENTIFIER Algorithm;
714     CRYPT_DER_BLOB             PrivateKey;
715     PCRYPT_ATTRIBUTES          pAttributes;
716 } CERT_PRIVATE_KEY_INFO, *PCERT_PRIVATE_KEY_INFO;
717 
718 typedef struct _CTL_USAGE {
719     DWORD  cUsageIdentifier;
720     LPSTR *rgpszUsageIdentifier;
721 } CTL_USAGE, *PCTL_USAGE, CERT_ENHKEY_USAGE, *PCERT_ENHKEY_USAGE;
722 
723 typedef struct _CTL_ENTRY {
724     CRYPT_DATA_BLOB  SubjectIdentifier;
725     DWORD            cAttribute;
726     PCRYPT_ATTRIBUTE rgAttribute;
727 } CTL_ENTRY, *PCTL_ENTRY;
728 
729 typedef struct _CTL_INFO {
730     DWORD                      dwVersion;
731     CTL_USAGE                  SubjectUsage;
732     CRYPT_DATA_BLOB            ListIdentifier;
733     CRYPT_INTEGER_BLOB         SequenceNumber;
734     FILETIME                   ThisUpdate;
735     FILETIME                   NextUpdate;
736     CRYPT_ALGORITHM_IDENTIFIER SubjectAlgorithm;
737     DWORD                      cCTLEntry;
738     PCTL_ENTRY                 rgCTLEntry;
739     DWORD                      cExtension;
740     PCERT_EXTENSION            rgExtension;
741 } CTL_INFO, *PCTL_INFO;
742 
743 typedef struct _CTL_CONTEXT {
744     DWORD      dwMsgAndCertEncodingType;
745     BYTE      *pbCtlEncoded;
746     DWORD      cbCtlEncoded;
747     PCTL_INFO  pCtlInfo;
748     HCERTSTORE hCertStore;
749     HCRYPTMSG  hCryptMsg;
750     BYTE      *pbCtlContext;
751     DWORD      cbCtlContext;
752 } CTL_CONTEXT, *PCTL_CONTEXT;
753 typedef const CTL_CONTEXT *PCCTL_CONTEXT;
754 
755 typedef struct _CRYPT_TIME_STAMP_REQUEST_INFO {
756     LPSTR            pszTimeStampAlgorithm;
757     LPSTR            pszContentType;
758     CRYPT_OBJID_BLOB Content;
759     DWORD            cAttribute;
760     PCRYPT_ATTRIBUTE rgAttribute;
761 } CRYPT_TIME_STAMP_REQUEST_INFO, *PCRYPT_TIME_STAMP_REQUEST_INFO;
762 
763 typedef struct _CRYPT_ENROLLMENT_NAME_VALUE_PAIR {
764     LPWSTR pwszName;
765     LPWSTR pwszValue;
766 } CRYPT_ENROLLMENT_NAME_VALUE_PAIR, *PCRYPT_ENROLLMENT_NAME_VALUE_PAIR;
767 
768 typedef struct _CMSG_SIGNER_INFO {
769     DWORD                      dwVersion;
770     CERT_NAME_BLOB             Issuer;
771     CRYPT_INTEGER_BLOB         SerialNumber;
772     CRYPT_ALGORITHM_IDENTIFIER HashAlgorithm;
773     CRYPT_ALGORITHM_IDENTIFIER HashEncryptionAlgorithm;
774     CRYPT_DATA_BLOB            EncryptedHash;
775     CRYPT_ATTRIBUTES           AuthAttrs;
776     CRYPT_ATTRIBUTES           UnauthAttrs;
777 } CMSG_SIGNER_INFO, *PCMSG_SIGNER_INFO;
778 
779 #define CMSG_VERIFY_SIGNER_PUBKEY 1
780 #define CMSG_VERIFY_SIGNER_CERT   2
781 #define CMSG_VERIFY_SIGNER_CHAIN  3
782 #define CMSG_VERIFY_SIGNER_NULL   4
783 
784 typedef struct _CERT_REVOCATION_CRL_INFO {
785     DWORD         cbSize;
786     PCCRL_CONTEXT pBaseCrlContext;
787     PCCRL_CONTEXT pDeltaCrlContext;
788     PCRL_ENTRY    pCrlEntry;
789     BOOL          fDeltaCrlEntry;
790 } CERT_REVOCATION_CRL_INFO, *PCERT_REVOCATION_CRL_INFO;
791 
792 typedef struct _CERT_REVOCATION_INFO {
793     DWORD                     cbSize;
794     DWORD                     dwRevocationResult;
795     LPCSTR                    pszRevocationOid;
796     LPVOID                    pvOidSpecificInfo;
797     BOOL                      fHasFreshnessTime;
798     DWORD                     dwFreshnessTime;
799     PCERT_REVOCATION_CRL_INFO pCrlInfo;
800 } CERT_REVOCATION_INFO, *PCERT_REVOCATION_INFO;
801 
802 typedef struct _CERT_REVOCATION_PARA {
803     DWORD                     cbSize;
804     PCCERT_CONTEXT            pIssuerCert;
805     DWORD                     cCertStore;
806     HCERTSTORE               *rgCertStore;
807     HCERTSTORE                hCrlStore;
808     LPFILETIME                pftTimeToUse;
809 #ifdef CERT_REVOCATION_PARA_HAS_EXTRA_FIELDS
810     DWORD                     dwUrlRetrievalTimeout;
811     BOOL                      fCheckFreshnessTime;
812     DWORD                     dwFreshnessTime;
813     LPFILETIME                pftCurrentTime;
814     PCERT_REVOCATION_CRL_INFO pCrlInfo;
815 #endif
816 } CERT_REVOCATION_PARA, *PCERT_REVOCATION_PARA;
817 
818 #define CERT_CONTEXT_REVOCATION_TYPE 1
819 #define CERT_VERIFY_REV_CHAIN_FLAG                0x00000001
820 #define CERT_VERIFY_CACHE_ONLY_BASED_REVOCATION   0x00000002
821 #define CERT_VERIFY_REV_ACCUMULATIVE_TIMEOUT_FLAG 0x00000004
822 
823 typedef struct _CTL_VERIFY_USAGE_PARA {
824     DWORD           cbSize;
825     CRYPT_DATA_BLOB ListIdentifier;
826     DWORD           cCtlStore;
827     HCERTSTORE     *rghCtlStore;
828     DWORD           cSignerStore;
829     HCERTSTORE     *rghSignerStore;
830 } CTL_VERIFY_USAGE_PARA, *PCTL_VERIFY_USAGE_PARA;
831 
832 typedef struct _CTL_VERIFY_USAGE_STATUS {
833     DWORD           cbSize;
834     DWORD           dwError;
835     DWORD           dwFlags;
836     PCCTL_CONTEXT  *ppCtl;
837     DWORD           dwCtlEntryIndex;
838     PCCERT_CONTEXT *ppSigner;
839     DWORD           dwSignerIndex;
840 } CTL_VERIFY_USAGE_STATUS, *PCTL_VERIFY_USAGE_STATUS;
841 
842 #define CERT_VERIFY_INHIBIT_CTL_UPDATE_FLAG 0x1
843 #define CERT_VERIFY_TRUSTED_SIGNERS_FLAG    0x2
844 #define CERT_VERIFY_NO_TIME_CHECK_FLAG      0x4
845 #define CERT_VERIFY_ALLOW_MORE_USAGE_FLAG   0x8
846 #define CERT_VERIFY_UPDATED_CTL_FLAG        0x1
847 
848 typedef struct _CERT_CHAIN {
849     DWORD               cCerts;
850     PCERT_BLOB          certs;
851     CRYPT_KEY_PROV_INFO keyLocatorInfo;
852 } CERT_CHAIN, *PCERT_CHAIN;
853 
854 typedef struct _CERT_REVOCATION_STATUS {
855     DWORD cbSize;
856     DWORD dwIndex;
857     DWORD dwError;
858     DWORD dwReason;
859     BOOL  fHasFreshnessTime;
860     DWORD dwFreshnessTime;
861 } CERT_REVOCATION_STATUS, *PCERT_REVOCATION_STATUS;
862 
863 typedef struct _CERT_TRUST_LIST_INFO {
864     DWORD         cbSize;
865     PCTL_ENTRY    pCtlEntry;
866     PCCTL_CONTEXT pCtlContext;
867 } CERT_TRUST_LIST_INFO, *PCERT_TRUST_LIST_INFO;
868 
869 #define CERT_TRUST_NO_ERROR                          0x00000000
870 #define CERT_TRUST_IS_NOT_TIME_VALID                 0x00000001
871 #define CERT_TRUST_IS_NOT_TIME_NESTED                0x00000002
872 #define CERT_TRUST_IS_REVOKED                        0x00000004
873 #define CERT_TRUST_IS_NOT_SIGNATURE_VALID            0x00000008
874 #define CERT_TRUST_IS_NOT_VALID_FOR_USAGE            0x00000010
875 #define CERT_TRUST_IS_UNTRUSTED_ROOT                 0x00000020
876 #define CERT_TRUST_REVOCATION_STATUS_UNKNOWN         0x00000040
877 #define CERT_TRUST_IS_CYCLIC                         0x00000080
878 #define CERT_TRUST_INVALID_EXTENSION                 0x00000100
879 #define CERT_TRUST_INVALID_POLICY_CONSTRAINTS        0x00000200
880 #define CERT_TRUST_INVALID_BASIC_CONSTRAINTS         0x00000400
881 #define CERT_TRUST_INVALID_NAME_CONSTRAINTS          0x00000800
882 #define CERT_TRUST_HAS_NOT_SUPPORTED_NAME_CONSTRAINT 0x00001000
883 #define CERT_TRUST_HAS_NOT_DEFINED_NAME_CONSTRAINT   0x00002000
884 #define CERT_TRUST_HAS_NOT_PERMITTED_NAME_CONSTRAINT 0x00004000
885 #define CERT_TRUST_HAS_EXCLUDED_NAME_CONSTRAINT      0x00008000
886 #define CERT_TRUST_IS_OFFLINE_REVOCATION             0x01000000
887 #define CERT_TRUST_NO_ISSUANCE_CHAIN_POLICY          0x02000000
888 #define CERT_TRUST_IS_EXPLICIT_DISTRUST              0x04000000
889 #define CERT_TRUST_HAS_NOT_SUPPORTED_CRITICAL_EXT    0x08000000
890 
891 #define CERT_TRUST_IS_PARTIAL_CHAIN                  0x00010000
892 #define CERT_TRUST_CTL_IS_NOT_TIME_VALID             0x00020000
893 #define CERT_TRUST_CTL_IS_NOT_SIGNATURE_VALID        0x00040000
894 #define CERT_TRUST_CTL_IS_NOT_VALID_FOR_USAGE        0x00080000
895 
896 #define CERT_TRUST_HAS_EXACT_MATCH_ISSUER            0x00000001
897 #define CERT_TRUST_HAS_KEY_MATCH_ISSUER              0x00000002
898 #define CERT_TRUST_HAS_NAME_MATCH_ISSUER             0x00000004
899 #define CERT_TRUST_IS_SELF_SIGNED                    0x00000008
900 
901 #define CERT_TRUST_HAS_PREFERRED_ISSUER              0x00000100
902 #define CERT_TRUST_HAS_ISSUANCE_CHAIN_POLICY         0x00000200
903 #define CERT_TRUST_HAS_VALID_NAME_CONSTRAINTS        0x00000400
904 #define CERT_TRUST_IS_PEER_TRUSTED                   0x00000800
905 #define CERT_TRUST_HAS_CRL_VALIDITY_EXTENDED         0x00001000
906 
907 #define CERT_TRUST_IS_COMPLEX_CHAIN                  0x00010000
908 
909 typedef struct _CERT_TRUST_STATUS {
910     DWORD dwErrorStatus;
911     DWORD dwInfoStatus;
912 } CERT_TRUST_STATUS, *PCERT_TRUST_STATUS;
913 
914 typedef struct _CERT_CHAIN_ELEMENT {
915     DWORD                 cbSize;
916     PCCERT_CONTEXT        pCertContext;
917     CERT_TRUST_STATUS     TrustStatus;
918     PCERT_REVOCATION_INFO pRevocationInfo;
919     PCERT_ENHKEY_USAGE    pIssuanceUsage;
920     PCERT_ENHKEY_USAGE    pApplicationUsage;
921     LPCWSTR               pwszExtendedErrorInfo;
922 } CERT_CHAIN_ELEMENT, *PCERT_CHAIN_ELEMENT;
923 
924 typedef struct _CERT_SIMPLE_CHAIN {
925     DWORD                 cbSize;
926     CERT_TRUST_STATUS     TrustStatus;
927     DWORD                 cElement;
928     PCERT_CHAIN_ELEMENT  *rgpElement;
929     PCERT_TRUST_LIST_INFO pTrustListInfo;
930     BOOL                  fHasRevocationFreshnessTime;
931     DWORD                 dwRevocationFreshnessTime;
932 } CERT_SIMPLE_CHAIN, *PCERT_SIMPLE_CHAIN;
933 
934 typedef struct _CERT_CHAIN_CONTEXT CERT_CHAIN_CONTEXT, *PCERT_CHAIN_CONTEXT;
935 typedef const CERT_CHAIN_CONTEXT *PCCERT_CHAIN_CONTEXT;
936 
937 struct _CERT_CHAIN_CONTEXT {
938     DWORD                 cbSize;
939     CERT_TRUST_STATUS     TrustStatus;
940     DWORD                 cChain;
941     PCERT_SIMPLE_CHAIN   *rgpChain;
942     DWORD                 cLowerQualityChainContext;
943     PCCERT_CHAIN_CONTEXT *rgpLowerQualityChainContext;
944     BOOL                  fHasRevocationFreshnessTime;
945     DWORD                 dwRevocationFreshnessTime;
946 };
947 
948 typedef struct _CERT_CHAIN_POLICY_PARA {
949     DWORD cbSize;
950     DWORD dwFlags;
951     void *pvExtraPolicyPara;
952 } CERT_CHAIN_POLICY_PARA, *PCERT_CHAIN_POLICY_PARA;
953 
954 typedef struct _CERT_CHAIN_POLICY_STATUS {
955     DWORD cbSize;
956     DWORD dwError;
957     LONG  lChainIndex;
958     LONG  lElementIndex;
959     void *pvExtraPolicyStatus;
960 } CERT_CHAIN_POLICY_STATUS, *PCERT_CHAIN_POLICY_STATUS;
961 
962 #define CERT_CHAIN_POLICY_BASE              ((LPCSTR)1)
963 #define CERT_CHAIN_POLICY_AUTHENTICODE      ((LPCSTR)2)
964 #define CERT_CHAIN_POLICY_AUTHENTICODE_TS   ((LPCSTR)3)
965 #define CERT_CHAIN_POLICY_SSL               ((LPCSTR)4)
966 #define CERT_CHAIN_POLICY_BASIC_CONSTRAINTS ((LPCSTR)5)
967 #define CERT_CHAIN_POLICY_NT_AUTH           ((LPCSTR)6)
968 #define CERT_CHAIN_POLICY_MICROSOFT_ROOT    ((LPCSTR)7)
969 
970 #define CERT_CHAIN_POLICY_IGNORE_NOT_TIME_VALID_FLAG            0x00000001
971 #define CERT_CHAIN_POLICY_IGNORE_CTL_NOT_TIME_VALID_FLAG        0x00000002
972 #define CERT_CHAIN_POLICY_IGNORE_NOT_TIME_NESTED_FLAG           0x00000004
973 #define CERT_CHAIN_POLICY_IGNORE_INVALID_BASIC_CONSTRAINTS_FLAG 0x00000008
974 
975 #define CERT_CHAIN_POLICY_IGNORE_ALL_NOT_TIME_VALID_FLAGS ( \
976  CERT_CHAIN_POLICY_IGNORE_NOT_TIME_VALID_FLAG \
977  CERT_CHAIN_POLICY_IGNORE_CTL_NOT_TIME_VALID_FLAG \
978  CERT_CHAIN_POLICY_IGNORE_NOT_TIME_NESTED_FLAG )
979 
980 #define CERT_CHAIN_POLICY_ALLOW_UNKNOWN_CA_FLAG                 0x00000010
981 #define CERT_CHAIN_POLICY_IGNORE_WRONG_USAGE_FLAG               0x00000020
982 #define CERT_CHAIN_POLICY_IGNORE_INVALID_NAME_FLAG              0x00000040
983 #define CERT_CHAIN_POLICY_IGNORE_INVALID_POLICY_FLAG            0x00000080
984 
985 #define CERT_CHAIN_POLICY_IGNORE_END_REV_UNKNOWN_FLAG           0x00000100
986 #define CERT_CHAIN_POLICY_IGNORE_CTL_SIGNER_REV_UNKNOWN_FLAG    0x00000200
987 #define CERT_CHAIN_POLICY_IGNORE_CA_REV_UNKNOWN_FLAG            0x00000400
988 #define CERT_CHAIN_POLICY_IGNORE_ROOT_REV_UNKNOWN_FLAG          0x00000800
989 
990 #define CERT_CHAIN_POLICY_IGNORE_ALL_REV_UNKNOWN_FLAGS ( \
991  CERT_CHAIN_POLICY_IGNORE_END_REV_UNKNOWN_FLAG \
992  CERT_CHAIN_POLICY_IGNORE_CTL_SIGNER_REV_UNKNOWN_FLAG \
993  CERT_CHAIN_POLICY_IGNORE_CA_REV_UNKNOWN_FLAG \
994  CERT_CHAIN_POLICY_IGNORE_ROOT_REV_UNKNOWN_FLAG )
995 
996 #define CERT_CHAIN_POLICY_IGNORE_PEER_TRUST_FLAG                 0x00001000
997 #define CERT_CHAIN_POLICY_IGNORE_NOT_SUPPORTED_CRITICAL_EXT_FLAG 0x00002000
998 #define CERT_CHAIN_POLICY_TRUST_TESTROOT_FLAG                    0x00004000
999 #define CERT_CHAIN_POLICY_ALLOW_TESTROOT_FLAG                    0x00008000
1000 #define MICROSOFT_ROOT_CERT_CHAIN_POLICY_ENABLE_TEST_ROOT_FLAG   0x00010000
1001 
1002 typedef struct _AUTHENTICODE_EXTRA_CERT_CHAIN_POLICY_PARA {
1003     DWORD             cbSize;
1004     DWORD             dwRegPolicySettings;
1005     PCMSG_SIGNER_INFO pSignerInfo;
1006 } AUTHENTICODE_EXTRA_CERT_CHAIN_POLICY_PARA,
1007  *PAUTHENTICODE_EXTRA_CERT_CHAIN_POLICY_PARA;
1008 
1009 typedef struct _AUTHENTICODE_EXTRA_CERT_CHAIN_POLICY_STATUS {
1010     DWORD cbSize;
1011     BOOL  fCommercial;
1012 } AUTHENTICODE_EXTRA_CERT_CHAIN_POLICY_STATUS,
1013  *PAUTHENTICODE_EXTRA_CERT_CHAIN_POLICY_STATUS;
1014 
1015 typedef struct _AUTHENTICODE_TS_EXTRA_CERT_CHAIN_POLICY_PARA {
1016     DWORD cbSize;
1017     DWORD dwRegPolicySettings;
1018     BOOL  fCommercial;
1019 } AUTHENTICODE_TS_EXTRA_CERT_CHAIN_POLICY_PARA,
1020  *PAUTHENTICODE_TS_EXTRA_CERT_CHAIN_POLICY_PARA;
1021 
1022 typedef struct _HTTPSPolicyCallbackData {
1023     union {
1024         DWORD cbStruct;
1025         DWORD cbSize;
1026     } DUMMYUNIONNAME;
1027     DWORD  dwAuthType;
1028     DWORD  fdwChecks;
1029     WCHAR *pwszServerName;
1030 } HTTPSPolicyCallbackData, *PHTTPSPolicyCallbackData,
1031  SSL_EXTRA_CERT_CHAIN_POLICY_PARA, *PSSL_EXTRA_CERT_CHAIN_POLICY_PARA;
1032 
1033 /* Values for HTTPSPolicyCallbackData's dwAuthType */
1034 #define AUTHTYPE_CLIENT 1
1035 #define AUTHTYPE_SERVER 2
1036 /* Values for HTTPSPolicyCallbackData's fdwChecks are defined in wininet.h */
1037 
1038 #define BASIC_CONSTRAINTS_CERT_CHAIN_POLICY_CA_FLAG         0x80000000
1039 #define BASIC_CONSTRAINTS_CERT_CHAIN_POLICY_END_ENTITY_FLAG 0x40000000
1040 
1041 #define MICROSOFT_ROOT_CERT_CHAIN_POLICY_ENABLE_TEST_ROOT_FLAG 0x00010000
1042 
1043 #define USAGE_MATCH_TYPE_AND 0x00000000
1044 #define USAGE_MATCH_TYPE_OR  0x00000001
1045 
1046 typedef struct _CERT_USAGE_MATCH {
1047     DWORD             dwType;
1048     CERT_ENHKEY_USAGE Usage;
1049 } CERT_USAGE_MATCH, *PCERT_USAGE_MATCH;
1050 
1051 typedef struct _CTL_USAGE_MATCH {
1052     DWORD     dwType;
1053     CTL_USAGE Usage;
1054 } CTL_USAGE_MATCH, *PCTL_USAGE_MATCH;
1055 
1056 #define CERT_CHAIN_REVOCATION_CHECK_END_CERT           0x10000000
1057 #define CERT_CHAIN_REVOCATION_CHECK_CHAIN              0x20000000
1058 #define CERT_CHAIN_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT 0x40000000
1059 #define CERT_CHAIN_REVOCATION_CHECK_CACHE_ONLY         0x80000000
1060 
1061 #define CERT_CHAIN_REVOCATION_ACCUMULATIVE_TIMEOUT     0x08000000
1062 
1063 #define CERT_CHAIN_DISABLE_PASS1_QUALITY_FILTERING     0x00000040
1064 #define CERT_CHAIN_RETURN_LOWER_QUALITY_CONTEXTS       0x00000080
1065 #define CERT_CHAIN_DISABLE_AUTH_ROOT_AUTO_UPDATE       0x00000100
1066 #define CERT_CHAIN_TIMESTAMP_TIME                      0x00000200
1067 
1068 typedef struct _CERT_CHAIN_PARA {
1069     DWORD            cbSize;
1070     CERT_USAGE_MATCH RequestedUsage;
1071 #ifdef CERT_CHAIN_PARA_HAS_EXTRA_FIELDS
1072     CERT_USAGE_MATCH RequestedIssuancePolicy;
1073     DWORD            dwUrlRetrievalTimeout;
1074     BOOL             fCheckRevocationFreshnessTime;
1075     DWORD            dwRevocationFreshnessTime;
1076     LPFILETIME       pftCacheResync;
1077 #endif
1078 } CERT_CHAIN_PARA, *PCERT_CHAIN_PARA;
1079 
1080 typedef struct _CERT_SYSTEM_STORE_INFO {
1081     DWORD cbSize;
1082 } CERT_SYSTEM_STORE_INFO, *PCERT_SYSTEM_STORE_INFO;
1083 
1084 typedef struct _CERT_PHYSICAL_STORE_INFO {
1085     DWORD           cbSize;
1086     LPSTR           pszOpenStoreProvider;
1087     DWORD           dwOpenEncodingType;
1088     DWORD           dwOpenFlags;
1089     CRYPT_DATA_BLOB OpenParameters;
1090     DWORD           dwFlags;
1091     DWORD           dwPriority;
1092 } CERT_PHYSICAL_STORE_INFO, *PCERT_PHYSICAL_STORE_INFO;
1093 
1094 typedef struct _CERT_SYSTEM_STORE_RELOCATE_PARA {
1095     union {
1096         HKEY  hKeyBase;
1097         VOID *pvBase;
1098     } DUMMYUNIONNAME;
1099     union {
1100         void   *pvSystemStore;
1101         LPCSTR  pszSystemStore;
1102         LPCWSTR pwszSystemStore;
1103     } DUMMYUNIONNAME2;
1104 } CERT_SYSTEM_STORE_RELOCATE_PARA, *PCERT_SYSTEM_STORE_RELOCATE_PARA;
1105 
1106 typedef BOOL
1107 (WINAPI *PFN_CERT_ENUM_SYSTEM_STORE_LOCATION)(
1108   _In_ LPCWSTR pwszStoreLocation,
1109   _In_ DWORD dwFlags,
1110   _Reserved_ void *pvReserved,
1111   _Inout_opt_ void *pvArg);
1112 
1113 typedef BOOL
1114 (WINAPI *PFN_CERT_ENUM_SYSTEM_STORE)(
1115   _In_ const void *pvSystemStore,
1116   _In_ DWORD dwFlags,
1117   _In_ PCERT_SYSTEM_STORE_INFO pStoreInfo,
1118   _Reserved_ void *pvReserved,
1119   _Inout_opt_ void *pvArg);
1120 
1121 typedef BOOL
1122 (WINAPI *PFN_CERT_ENUM_PHYSICAL_STORE)(
1123   _In_ const void *pvSystemStore,
1124   _In_ DWORD dwFlags,
1125   _In_ LPCWSTR pwszStoreName,
1126   _In_ PCERT_PHYSICAL_STORE_INFO pStoreInfo,
1127   _Reserved_ void *pvReserved,
1128   _Inout_opt_ void *pvArg);
1129 
1130 /* Encode/decode object */
1131 typedef LPVOID (__WINE_ALLOC_SIZE(1) WINAPI *PFN_CRYPT_ALLOC)(_In_ size_t cbsize);
1132 typedef VOID(WINAPI *PFN_CRYPT_FREE)(_In_ LPVOID pv);
1133 
1134 typedef struct _CRYPT_ENCODE_PARA {
1135     DWORD           cbSize;
1136     PFN_CRYPT_ALLOC pfnAlloc;
1137     PFN_CRYPT_FREE  pfnFree;
1138 } CRYPT_ENCODE_PARA, *PCRYPT_ENCODE_PARA;
1139 
1140 typedef struct _CRYPT_DECODE_PARA {
1141     DWORD           cbSize;
1142     PFN_CRYPT_ALLOC pfnAlloc;
1143     PFN_CRYPT_FREE  pfnFree;
1144 } CRYPT_DECODE_PARA, *PCRYPT_DECODE_PARA;
1145 
1146 typedef struct _CERT_STORE_PROV_INFO {
1147     DWORD             cbSize;
1148     DWORD             cStoreProvFunc;
1149     void            **rgpvStoreProvFunc;
1150     HCERTSTOREPROV    hStoreProv;
1151     DWORD             dwStoreProvFlags;
1152     HCRYPTOIDFUNCADDR hStoreProvFuncAddr2;
1153 } CERT_STORE_PROV_INFO, *PCERT_STORE_PROV_INFO;
1154 
1155 typedef BOOL
1156 (WINAPI *PFN_CERT_DLL_OPEN_STORE_PROV_FUNC)(
1157   _In_ LPCSTR lpszStoreProvider,
1158   _In_ DWORD dwEncodingType,
1159   _In_opt_ HCRYPTPROV_LEGACY hCryptProv,
1160   _In_ DWORD dwFlags,
1161   _In_opt_ const void *pvPara,
1162   _In_ HCERTSTORE hCertStore,
1163   _Inout_ PCERT_STORE_PROV_INFO pStoreProvInfo);
1164 
1165 typedef void
1166 (WINAPI *PFN_CERT_STORE_PROV_CLOSE)(
1167   _Inout_opt_ HCERTSTOREPROV hStoreProv,
1168   _In_ DWORD dwFlags);
1169 
1170 typedef
1171 _Success_(return != 0)
1172 BOOL
1173 (WINAPI *PFN_CERT_STORE_PROV_READ_CERT)(
1174   _Inout_ HCERTSTOREPROV hStoreProv,
1175   _In_ PCCERT_CONTEXT pStoreCertContext,
1176   _In_ DWORD dwFlags,
1177   _Outptr_ PCCERT_CONTEXT *ppProvCertContext);
1178 
1179 typedef BOOL
1180 (WINAPI *PFN_CERT_STORE_PROV_WRITE_CERT)(
1181   _Inout_ HCERTSTOREPROV hStoreProv,
1182   _In_ PCCERT_CONTEXT pCertContext,
1183   _In_ DWORD dwFlags);
1184 
1185 typedef BOOL
1186 (WINAPI *PFN_CERT_STORE_PROV_DELETE_CERT)(
1187   _Inout_ HCERTSTOREPROV hStoreProv,
1188   _In_ PCCERT_CONTEXT pCertContext,
1189   _In_ DWORD dwFlags);
1190 
1191 typedef BOOL
1192 (WINAPI *PFN_CERT_STORE_PROV_SET_CERT_PROPERTY)(
1193   _Inout_ HCERTSTOREPROV hStoreProv,
1194   _In_ PCCERT_CONTEXT pCertContext,
1195   _In_ DWORD dwPropId,
1196   _In_ DWORD dwFlags,
1197   _In_opt_ const void *pvData);
1198 
1199 typedef
1200 _Success_(return != 0)
1201 BOOL
1202 (WINAPI *PFN_CERT_STORE_PROV_READ_CRL)(
1203   _Inout_ HCERTSTOREPROV hStoreProv,
1204   _In_ PCCRL_CONTEXT pStoreCrlContext,
1205   _In_ DWORD dwFlags,
1206   _Outptr_ PCCRL_CONTEXT *ppProvCrlContext);
1207 
1208 typedef BOOL
1209 (WINAPI *PFN_CERT_STORE_PROV_WRITE_CRL)(
1210   _Inout_ HCERTSTOREPROV hStoreProv,
1211   _In_ PCCRL_CONTEXT pCrlContext,
1212   _In_ DWORD dwFlags);
1213 
1214 typedef BOOL
1215 (WINAPI *PFN_CERT_STORE_PROV_DELETE_CRL)(
1216   _Inout_ HCERTSTOREPROV hStoreProv,
1217   _In_ PCCRL_CONTEXT pCrlContext,
1218   _In_ DWORD dwFlags);
1219 
1220 typedef BOOL
1221 (WINAPI *PFN_CERT_STORE_PROV_SET_CRL_PROPERTY)(
1222   _Inout_ HCERTSTOREPROV hStoreProv,
1223   _In_ PCCRL_CONTEXT pCrlContext,
1224   _In_ DWORD dwPropId,
1225   _In_ DWORD dwFlags,
1226   _In_opt_ const void *pvData);
1227 
1228 typedef
1229 _Success_(return != 0)
1230 BOOL
1231 (WINAPI *PFN_CERT_STORE_PROV_READ_CTL)(
1232   _Inout_ HCERTSTOREPROV hStoreProv,
1233   _In_ PCCTL_CONTEXT pStoreCtlContext,
1234   _In_ DWORD dwFlags,
1235   _Outptr_ PCCTL_CONTEXT *ppProvCtlContext);
1236 
1237 typedef BOOL
1238 (WINAPI *PFN_CERT_STORE_PROV_WRITE_CTL)(
1239   _Inout_ HCERTSTOREPROV hStoreProv,
1240   _In_ PCCTL_CONTEXT pCtlContext,
1241   _In_ DWORD dwFlags);
1242 
1243 typedef BOOL
1244 (WINAPI *PFN_CERT_STORE_PROV_DELETE_CTL)(
1245   _Inout_ HCERTSTOREPROV hStoreProv,
1246   _In_ PCCTL_CONTEXT pCtlContext,
1247   _In_ DWORD dwFlags);
1248 
1249 typedef BOOL
1250 (WINAPI *PFN_CERT_STORE_PROV_SET_CTL_PROPERTY)(
1251   _Inout_ HCERTSTOREPROV hStoreProv,
1252   _In_ PCCTL_CONTEXT pCtlContext,
1253   _In_ DWORD dwPropId,
1254   _In_ DWORD dwFlags,
1255   _In_opt_ const void *pvData);
1256 
1257 typedef BOOL
1258 (WINAPI *PFN_CERT_STORE_PROV_CONTROL)(
1259   _Inout_ HCERTSTOREPROV hStoreProv,
1260   _In_ DWORD dwFlags,
1261   _In_ DWORD dwCtrlType,
1262   _In_opt_ void const *pvCtrlPara);
1263 
1264 typedef struct _CERT_STORE_PROV_FIND_INFO {
1265     DWORD       cbSize;
1266     DWORD       dwMsgAndCertEncodingType;
1267     DWORD       dwFindFlags;
1268     DWORD       dwFindType;
1269     const void *pvFindPara;
1270 } CERT_STORE_PROV_FIND_INFO, *PCERT_STORE_PROV_FIND_INFO;
1271 typedef const CERT_STORE_PROV_FIND_INFO CCERT_STORE_PROV_FIND_INFO,
1272  *PCCERT_STORE_PROV_FIND_INFO;
1273 
1274 typedef
1275 _Success_(return != 0)
1276 BOOL
1277 (WINAPI *PFN_CERT_STORE_PROV_FIND_CERT)(
1278   _Inout_ HCERTSTOREPROV hStoreProv,
1279   _In_ PCCERT_STORE_PROV_FIND_INFO pFindInfo,
1280   _In_ PCCERT_CONTEXT pPrevCertContext,
1281   _In_ DWORD dwFlags,
1282   _Inout_ void **ppvStoreProvFindInfo,
1283   _Outptr_ PCCERT_CONTEXT *ppProvCertContext);
1284 
1285 typedef BOOL
1286 (WINAPI *PFN_CERT_STORE_PROV_FREE_FIND_CERT)(
1287   _Inout_ HCERTSTOREPROV hStoreProv,
1288   _In_ PCCERT_CONTEXT pCertContext,
1289   _In_ void *pvStoreProvFindInfo,
1290   _In_ DWORD dwFlags);
1291 
1292 typedef BOOL
1293 (WINAPI *PFN_CERT_STORE_PROV_GET_CERT_PROPERTY)(
1294   _Inout_ HCERTSTOREPROV hStoreProv,
1295   _In_ PCCERT_CONTEXT pCertContext,
1296   _In_ DWORD dwPropId,
1297   _In_ DWORD dwFlags,
1298   _Out_writes_bytes_to_opt_(*pcbData, *pcbData) void *pvData,
1299   _Inout_ DWORD *pcbData);
1300 
1301 typedef
1302 _Success_(return != 0)
1303 BOOL
1304 (WINAPI *PFN_CERT_STORE_PROV_FIND_CRL)(
1305   _Inout_ HCERTSTOREPROV hStoreProv,
1306   _In_ PCCERT_STORE_PROV_FIND_INFO pFindInfo,
1307   _In_ PCCRL_CONTEXT pPrevCrlContext,
1308   _In_ DWORD dwFlags,
1309   _Inout_ void **ppvStoreProvFindInfo,
1310   _Outptr_ PCCRL_CONTEXT *ppProvCrlContext);
1311 
1312 typedef BOOL
1313 (WINAPI *PFN_CERT_STORE_PROV_FREE_FIND_CRL)(
1314   _Inout_ HCERTSTOREPROV hStoreProv,
1315   _In_ PCCRL_CONTEXT pCrlContext,
1316   _In_ void *pvStoreProvFindInfo,
1317   _In_ DWORD dwFlags);
1318 
1319 typedef BOOL
1320 (WINAPI *PFN_CERT_STORE_PROV_GET_CRL_PROPERTY)(
1321   _Inout_ HCERTSTOREPROV hStoreProv,
1322   _In_ PCCRL_CONTEXT pCrlContext,
1323   _In_ DWORD dwPropId,
1324   _In_ DWORD dwFlags,
1325   _Out_writes_bytes_to_opt_(*pcbData, *pcbData) void *pvData,
1326   _Inout_ DWORD *pcbData);
1327 
1328 typedef
1329 _Success_(return != 0)
1330 BOOL
1331 (WINAPI *PFN_CERT_STORE_PROV_FIND_CTL)(
1332   _In_ HCERTSTOREPROV hStoreProv,
1333   _In_ PCCERT_STORE_PROV_FIND_INFO pFindInfo,
1334   _In_ PCCTL_CONTEXT pPrevCtlContext,
1335   _In_ DWORD dwFlags,
1336   _Inout_ void **ppvStoreProvFindInfo,
1337   _Outptr_ PCCTL_CONTEXT *ppProvCtlContext);
1338 
1339 typedef BOOL
1340 (WINAPI *PFN_CERT_STORE_PROV_GET_CTL_PROPERTY)(
1341   _Inout_ HCERTSTOREPROV hStoreProv,
1342   _In_ PCCTL_CONTEXT pCtlContext,
1343   _In_ DWORD dwPropId,
1344   _In_ DWORD dwFlags,
1345   _Out_writes_bytes_to_opt_(*pcbData, *pcbData) void *pvData,
1346   _Inout_ DWORD *pcbData);
1347 
1348 typedef struct _CERT_CREATE_CONTEXT_PARA {
1349     DWORD          cbSize;
1350     PFN_CRYPT_FREE pfnFree;
1351     void          *pvFree;
1352 } CERT_CREATE_CONTEXT_PARA, *PCERT_CREATE_CONTEXT_PARA;
1353 
1354 typedef struct _CRYPT_OID_FUNC_ENTRY {
1355     LPCSTR pszOID;
1356     void  *pvFuncAddr;
1357 } CRYPT_OID_FUNC_ENTRY, *PCRYPT_OID_FUNC_ENTRY;
1358 
1359 typedef BOOL
1360 (WINAPI *PFN_CRYPT_ENUM_OID_FUNC)(
1361   _In_ DWORD dwEncodingType,
1362   _In_ LPCSTR pszFuncName,
1363   _In_ LPCSTR pszOID,
1364   _In_ DWORD cValue,
1365   _In_reads_(cValue) const DWORD rgdwValueType[],
1366   _In_reads_(cValue) LPCWSTR const rgpwszValueName[],
1367   _In_reads_(cValue) const BYTE * const rgpbValueData[],
1368   _In_reads_(cValue) const DWORD rgcbValueData[],
1369   _Inout_opt_ void *pvArg);
1370 
1371 #define CRYPT_MATCH_ANY_ENCODING_TYPE 0xffffffff
1372 
1373 #define CALG_OID_INFO_CNG_ONLY   0xffffffff
1374 #define CALG_OID_INFO_PARAMETERS 0xfffffffe
1375 
1376 #if defined(__GNUC__)
1377 #define CRYPT_OID_INFO_HASH_PARAMETERS_ALGORITHM     (const WCHAR []){'C','r','y','p','t','O','I','D','I','n','f','o','H','a','s','h','P','a','r','a','m','e','t','e','r','s',0}
1378 #define CRYPT_OID_INFO_ECC_PARAMETERS_ALGORITHM      (const WCHAR []){'C','r','y','p','t','O','I','D','I','n','f','o','E','C','C','P','a','r','a','m','e','t','e','r','s',0}
1379 #define CRYPT_OID_INFO_MGF1_PARAMETERS_ALGORITHM     (const WCHAR []){'C','r','y','p','t','O','I','D','I','n','f','o','M','g','f','1','P','a','r','a','m','e','t','e','r','s',0}
1380 #define CRYPT_OID_INFO_NO_SIGN_ALGORITHM             (const WCHAR []){'C','r','y','p','t','O','I','D','I','n','f','o','N','o','S','i','g','n',0}
1381 #define CRYPT_OID_INFO_OAEP_PARAMETERS_ALGORITHM     (const WCHAR []){'C','r','y','p','t','O','I','D','I','n','f','o','O','A','E','P','P','a','r','a','m','e','t','e','r','s',0}
1382 #define CRYPT_OID_INFO_ECC_WRAP_PARAMETERS_ALGORITHM (const WCHAR []){'C','r','y','p','t','O','I','D','I','n','f','o','E','C','C','W','r','a','p','P','a','r','a','m','e','t','e','r','s',0}
1383 #define CRYPT_OID_INFO_NO_PARAMETERS_ALGORITHM       (const WCHAR []){'C','r','y','p','t','O','I','D','I','n','f','o','N','o','P','a','r','a','m','e','t','e','r','s',0}
1384 #elif defined(_MSC_VER)
1385 #define CRYPT_OID_INFO_HASH_PARAMETERS_ALGORITHM     L"CryptOIDInfoHashParameters"
1386 #define CRYPT_OID_INFO_ECC_PARAMETERS_ALGORITHM      L"CryptOIDInfoECCParameters"
1387 #define CRYPT_OID_INFO_MGF1_PARAMETERS_ALGORITHM     L"CryptOIDInfoMgf1Parameters"
1388 #define CRYPT_OID_INFO_NO_SIGN_ALGORITHM             L"CryptOIDInfoNoSign"
1389 #define CRYPT_OID_INFO_OAEP_PARAMETERS_ALGORITHM     L"CryptOIDInfoOAEPParameters"
1390 #define CRYPT_OID_INFO_ECC_WRAP_PARAMETERS_ALGORITHM L"CryptOIDInfoECCWrapParameters"
1391 #define CRYPT_OID_INFO_NO_PARAMETERS_ALGORITHM       L"CryptOIDInfoNoParameters"
1392 #else
1393 static const WCHAR CRYPT_OID_INFO_HASH_PARAMETERS_ALGORITHM[] =     {'C','r','y','p','t','O','I','D','I','n','f','o','H','a','s','h','P','a','r','a','m','e','t','e','r','s',0};
1394 static const WCHAR CRYPT_OID_INFO_ECC_PARAMETERS_ALGORITHM[] =      {'C','r','y','p','t','O','I','D','I','n','f','o','E','C','C','P','a','r','a','m','e','t','e','r','s',0};
1395 static const WCHAR CRYPT_OID_INFO_MGF1_PARAMETERS_ALGORITHM[] =     {'C','r','y','p','t','O','I','D','I','n','f','o','M','g','f','1','P','a','r','a','m','e','t','e','r','s',0};
1396 static const WCHAR CRYPT_OID_INFO_NO_SIGN_ALGORITHM[] =             {'C','r','y','p','t','O','I','D','I','n','f','o','N','o','S','i','g','n',0};
1397 static const WCHAR CRYPT_OID_INFO_OAEP_PARAMETERS_ALGORITHM[] =     {'C','r','y','p','t','O','I','D','I','n','f','o','O','A','E','P','P','a','r','a','m','e','t','e','r','s',0};
1398 static const WCHAR CRYPT_OID_INFO_ECC_WRAP_PARAMETERS_ALGORITHM[] = {'C','r','y','p','t','O','I','D','I','n','f','o','E','C','C','W','r','a','p','P','a','r','a','m','e','t','e','r','s',0};
1399 static const WCHAR CRYPT_OID_INFO_NO_PARAMETERS_ALGORITHM[] =       {'C','r','y','p','t','O','I','D','I','n','f','o','N','o','P','a','r','a','m','e','t','e','r','s',0};
1400 #endif
1401 
1402 typedef struct _CRYPT_OID_INFO {
1403     DWORD   cbSize;
1404     LPCSTR  pszOID;
1405     LPCWSTR pwszName;
1406     DWORD   dwGroupId;
1407     union {
1408         DWORD  dwValue;
1409         ALG_ID Algid;
1410         DWORD  dwLength;
1411     } DUMMYUNIONNAME;
1412     CRYPT_DATA_BLOB ExtraInfo;
1413 #ifdef CRYPT_OID_INFO_HAS_EXTRA_FIELDS
1414     LPCWSTR         pwszCNGAlgid;
1415     LPCWSTR         pwszCNGExtraAlgid;
1416 #endif
1417 } CRYPT_OID_INFO, *PCRYPT_OID_INFO;
1418 typedef const CRYPT_OID_INFO CCRYPT_OID_INFO, *PCCRYPT_OID_INFO;
1419 
1420 typedef BOOL
1421 (WINAPI *PFN_CRYPT_ENUM_OID_INFO)(
1422   _In_ PCCRYPT_OID_INFO pInfo,
1423   _Inout_opt_ void *pvArg);
1424 
1425 typedef struct _CRYPT_SIGN_MESSAGE_PARA {
1426     DWORD                      cbSize;
1427     DWORD                      dwMsgEncodingType;
1428     PCCERT_CONTEXT             pSigningCert;
1429     CRYPT_ALGORITHM_IDENTIFIER HashAlgorithm;
1430     void *                     pvHashAuxInfo;
1431     DWORD                      cMsgCert;
1432     PCCERT_CONTEXT            *rgpMsgCert;
1433     DWORD                      cMsgCrl;
1434     PCCRL_CONTEXT             *rgpMsgCrl;
1435     DWORD                      cAuthAttr;
1436     PCRYPT_ATTRIBUTE           rgAuthAttr;
1437     DWORD                      cUnauthAttr;
1438     PCRYPT_ATTRIBUTE           rgUnauthAttr;
1439     DWORD                      dwFlags;
1440     DWORD                      dwInnerContentType;
1441 #ifdef CRYPT_SIGN_MESSAGE_PARA_HAS_CMS_FIELDS
1442     CRYPT_ALGORITHM_IDENTIFIER HashEncryptionAlgorithm;
1443     void *                     pvHashEncryptionAuxInfo;
1444 #endif
1445 } CRYPT_SIGN_MESSAGE_PARA, *PCRYPT_SIGN_MESSAGE_PARA;
1446 
1447 #define CRYPT_MESSAGE_BARE_CONTENT_OUT_FLAG         0x00000001
1448 #define CRYPT_MESSAGE_ENCAPSULATED_CONTENT_OUT_FLAG 0x00000002
1449 #define CRYPT_MESSAGE_KEYID_SIGNER_FLAG             0x00000004
1450 #define CRYPT_MESSAGE_SILENT_KEYSET_FLAG            0x00000008
1451 
1452 typedef PCCERT_CONTEXT
1453 (WINAPI *PFN_CRYPT_GET_SIGNER_CERTIFICATE)(
1454   _Inout_opt_ void *pvGetArg,
1455   _In_ DWORD dwCertEncodingType,
1456   _In_ PCERT_INFO pSignerId,
1457   _In_ HCERTSTORE hMsgCertStore);
1458 
1459 typedef struct _CRYPT_VERIFY_MESSAGE_PARA {
1460     DWORD                            cbSize;
1461     DWORD                            dwMsgAndCertEncodingType;
1462     HCRYPTPROV_LEGACY                hCryptProv;
1463     PFN_CRYPT_GET_SIGNER_CERTIFICATE pfnGetSignerCertificate;
1464     void *                           pvGetArg;
1465 } CRYPT_VERIFY_MESSAGE_PARA, *PCRYPT_VERIFY_MESSAGE_PARA;
1466 
1467 typedef struct _CRYPT_ENCRYPT_MESSAGE_PARA {
1468     DWORD                      cbSize;
1469     DWORD                      dwMsgEncodingType;
1470     HCRYPTPROV_LEGACY          hCryptProv;
1471     CRYPT_ALGORITHM_IDENTIFIER ContentEncryptionAlgorithm;
1472     void *                     pvEncryptionAuxInfo;
1473     DWORD                      dwFlags;
1474     DWORD                      dwInnerContentType;
1475 } CRYPT_ENCRYPT_MESSAGE_PARA, *PCRYPT_ENCRYPT_MESSAGE_PARA;
1476 
1477 #define CRYPT_MESSAGE_KEYID_RECIPIENT_FLAG 0x00000004
1478 
1479 typedef struct _CRYPT_DECRYPT_MESSAGE_PARA {
1480     DWORD       cbSize;
1481     DWORD       dwMsgAndCertEncodingType;
1482     DWORD       cCertStore;
1483     HCERTSTORE *rghCertStore;
1484 #ifdef CRYPT_DECRYPT_MESSAGE_PARA_HAS_EXTRA_FIELDS
1485     DWORD       dwFlags;
1486 #endif
1487 } CRYPT_DECRYPT_MESSAGE_PARA, *PCRYPT_DECRYPT_MESSAGE_PARA;
1488 
1489 typedef struct _CRYPT_HASH_MESSAGE_PARA {
1490     DWORD                      cbSize;
1491     DWORD                      dwMsgEncodingType;
1492     HCRYPTPROV_LEGACY          hCryptProv;
1493     CRYPT_ALGORITHM_IDENTIFIER HashAlgorithm;
1494     void *                     pvHashAuxInfo;
1495 } CRYPT_HASH_MESSAGE_PARA, *PCRYPT_HASH_MESSAGE_PARA;
1496 
1497 typedef struct _CRYPT_KEY_SIGN_MESSAGE_PARA {
1498     DWORD                      cbSize;
1499     DWORD                      dwMsgAndCertEncodingType;
1500     HCRYPTPROV                 hCryptProv;
1501     DWORD                      dwKeySpec;
1502     CRYPT_ALGORITHM_IDENTIFIER HashAlgorithm;
1503     void *                     pvHashAuxInfo;
1504 } CRYPT_KEY_SIGN_MESSAGE_PARA, *PCRYPT_KEY_SIGN_MESSAGE_PARA;
1505 
1506 typedef struct _CRYPT_KEY_VERIFY_MESSAGE_PARA {
1507     DWORD      cbSize;
1508     DWORD      dwMsgEncodingType;
1509     HCRYPTPROV_LEGACY hCryptProv;
1510 } CRYPT_KEY_VERIFY_MESSAGE_PARA, *PCRYPT_KEY_VERIFY_MESSAGE_PARA;
1511 
1512 typedef struct _CRYPT_URL_ARRAY {
1513     DWORD   cUrl;
1514     LPWSTR *rgwszUrl;
1515 } CRYPT_URL_ARRAY, *PCRYPT_URL_ARRAY;
1516 
1517 typedef struct _CRYPT_URL_INFO {
1518     DWORD  cbSize;
1519     DWORD  dwSyncDeltaTime;
1520     DWORD  cGroup;
1521     DWORD *rgcGroupEntry;
1522 } CRYPT_URL_INFO, *PCRYPT_URL_INFO;
1523 
1524 #define URL_OID_CERTIFICATE_ISSUER                  ((LPCSTR)1)
1525 #define URL_OID_CERTIFICATE_CRL_DIST_POINT          ((LPCSTR)2)
1526 #define URL_OID_CTL_ISSUER                          ((LPCSTR)3)
1527 #define URL_OID_CTL_NEXT_UPDATE                     ((LPCSTR)4)
1528 #define URL_OID_CRL_ISSUER                          ((LPCSTR)5)
1529 #define URL_OID_CERTIFICATE_FRESHEST_CRL            ((LPCSTR)6)
1530 #define URL_OID_CRL_FRESHEST_CRL                    ((LPCSTR)7)
1531 #define URL_OID_CROSS_CERT_DIST_POINT               ((LPCSTR)8)
1532 #define URL_OID_CERTIFICATE_OCSP                    ((LPCSTR)9)
1533 #define URL_OID_CERTIFICATE_OCSP_AND_CRL_DIST_POINT ((LPCSTR)10)
1534 #define URL_OID_CERTIFICATE_CRL_DIST_POINT_AND_OCSP ((LPCSTR)11)
1535 #define URL_OID_CROSS_CERT_SUBJECT_INFO_ACCESS      ((LPCSTR)12)
1536 
1537 #define URL_OID_GET_OBJECT_URL_FUNC "UrlDllGetObjectUrl"
1538 
1539 typedef HANDLE HCRYPTASYNC, *PHCRYPTASYNC;
1540 
1541 typedef void
1542 (WINAPI *PFN_CRYPT_ASYNC_PARAM_FREE_FUNC)(
1543   _In_ LPSTR pszParamOid,
1544   _In_ LPVOID pvParam);
1545 
1546 #define CRYPT_PARAM_ASYNC_RETRIEVAL_COMPLETION ((LPCSTR)1)
1547 #define CRYPT_PARAM_CANCEL_ASYNC_RETRIEVAL     ((LPCSTR)2)
1548 
1549 typedef void
1550 (WINAPI *PFN_CRYPT_ASYNC_RETRIEVAL_COMPLETION_FUNC)(
1551   _Inout_opt_ void *pvCompletion,
1552   _In_ DWORD dwCompletionCode,
1553   _In_ LPCSTR pszURL,
1554   _In_opt_ LPSTR pszObjectOid,
1555   _In_ void *pvObject);
1556 
1557 typedef struct _CRYPT_ASYNC_RETRIEVAL_COMPLETION {
1558   __callback PFN_CRYPT_ASYNC_RETRIEVAL_COMPLETION_FUNC pfnCompletion;
1559   _Inout_opt_ void *pvCompletion;
1560 } CRYPT_ASYNC_RETRIEVAL_COMPLETION, *PCRYPT_ASYNC_RETRIEVAL_COMPLETION;
1561 
1562 typedef BOOL
1563 (WINAPI *PFN_CANCEL_ASYNC_RETRIEVAL_FUNC)(
1564   _In_opt_ HCRYPTASYNC hAsyncRetrieve);
1565 
1566 typedef struct _CRYPT_BLOB_ARRAY
1567 {
1568     DWORD            cBlob;
1569     PCRYPT_DATA_BLOB rgBlob;
1570 } CRYPT_BLOB_ARRAY, *PCRYPT_BLOB_ARRAY;
1571 
1572 typedef struct _CRYPT_CREDENTIALS {
1573     DWORD  cbSize;
1574     LPCSTR pszCredentialsOid;
1575     LPVOID pvCredentials;
1576 } CRYPT_CREDENTIALS, *PCRYPT_CREDENTIALS;
1577 
1578 #define CREDENTIAL_OID_PASSWORD_CREDENTIALS_A ((LPCSTR)1)
1579 #define CREDENTIAL_OID_PASSWORD_CREDENTIALS_W ((LPCSTR)2)
1580 #define CREDENTIAL_OID_PASSWORD_CREDENTIALS \
1581  WINELIB_NAME_AW(CREDENTIAL_OID_PASSWORD_CREDENTIALS_)
1582 
1583 typedef struct _CRYPT_PASSWORD_CREDENTIALSA {
1584     DWORD cbSize;
1585     LPSTR pszUsername;
1586     LPSTR pszPassword;
1587 } CRYPT_PASSWORD_CREDENTIALSA, *PCRYPT_PASSWORD_CREDENTIALSA;
1588 
1589 typedef struct _CRYPT_PASSWORD_CREDENTIALSW {
1590     DWORD  cbSize;
1591     LPWSTR pszUsername;
1592     LPWSTR pszPassword;
1593 } CRYPT_PASSWORD_CREDENTIALSW, *PCRYPT_PASSWORD_CREDENTIALSW;
1594 #define CRYPT_PASSWORD_CREDENTIALS WINELIB_NAME_AW(CRYPT_PASSWORD_CREDENTIALS)
1595 #define PCRYPT_PASSWORD_CREDENTIALS WINELIB_NAME_AW(PCRYPT_PASSWORD_CREDENTIALS)
1596 
1597 typedef struct _CRYPT_RETRIEVE_AUX_INFO {
1598     DWORD     cbSize;
1599     FILETIME *pLastSyncTime;
1600     DWORD     dwMaxUrlRetrievalByteCount;
1601 } CRYPT_RETRIEVE_AUX_INFO, *PCRYPT_RETRIEVE_AUX_INFO;
1602 
1603 typedef void
1604 (WINAPI *PFN_FREE_ENCODED_OBJECT_FUNC)(
1605   _In_opt_ LPCSTR pszObjectOid,
1606   _Inout_ PCRYPT_BLOB_ARRAY pObject,
1607   _Inout_opt_ void *pvFreeContext);
1608 
1609 #define SCHEME_OID_RETRIEVE_ENCODED_OBJECT_FUNC \
1610  "SchemeDllRetrieveEncodedObject"
1611 #define SCHEME_OID_RETRIEVE_ENCODED_OBJECTW_FUNC \
1612  "SchemeDllRetrieveEncodedObjectW"
1613 /* The signature of SchemeDllRetrieveEncodedObjectW is:
1614 BOOL WINAPI SchemeDllRetrieveEncodedObjectW(LPCWSTR pwszUrl,
1615  LPCSTR pszObjectOid, DWORD dwRetrievalFlags, DWORD dwTimeout,
1616  PCRYPT_BLOB_ARRAY pObject, PFN_FREE_ENCODED_OBJECT_FUNC *ppfnFreeObject,
1617  void **ppvFreeContext, HCRYPTASYNC hAsyncRetrieve,
1618  PCRYPT_CREDENTIALS pCredentials, PCRYPT_RETRIEVE_AUX_INFO pAuxInfo);
1619  */
1620 
1621 #define CONTEXT_OID_CREATE_OBJECT_CONTEXT_FUNC "ContextDllCreateObjectContext"
1622 /* The signature of ContextDllCreateObjectContext is:
1623 BOOL WINAPI ContextDllCreateObjectContext(LPCSTR pszObjectOid,
1624  DWORD dwRetrievalFlags, PCRYPT_BLOB_ARRAY pObject, void **ppvContxt);
1625  */
1626 
1627 #define CONTEXT_OID_CERTIFICATE ((LPCSTR)1)
1628 #define CONTEXT_OID_CRL         ((LPCSTR)2)
1629 #define CONTEXT_OID_CTL         ((LPCSTR)3)
1630 #define CONTEXT_OID_PKCS7       ((LPCSTR)4)
1631 #define CONTEXT_OID_CAPI2_ANY   ((LPCSTR)5)
1632 
1633 #define CRYPT_RETRIEVE_MULTIPLE_OBJECTS      0x00000001
1634 #define CRYPT_CACHE_ONLY_RETRIEVAL           0x00000002
1635 #define CRYPT_WIRE_ONLY_RETRIEVAL            0x00000004
1636 #define CRYPT_DONT_CACHE_RESULT              0x00000008
1637 #define CRYPT_ASYNC_RETRIEVAL                0x00000010
1638 #define CRYPT_STICKY_CACHE_RETRIEVAL         0x00001000
1639 #define CRYPT_LDAP_SCOPE_BASE_ONLY_RETRIEVAL 0x00002000
1640 #define CRYPT_OFFLINE_CHECK_RETRIEVAL        0x00004000
1641 #define CRYPT_LDAP_INSERT_ENTRY_ATTRIBUTE    0x00008000
1642 #define CRYPT_LDAP_SIGN_RETRIEVAL            0x00010000
1643 #define CRYPT_NO_AUTH_RETRIEVAL              0x00020000
1644 #define CRYPT_LDAP_AREC_EXCLUSIVE_RETRIEVAL  0x00040000
1645 #define CRYPT_AIA_RETRIEVAL                  0x00080000
1646 
1647 #define CRYPT_VERIFY_CONTEXT_SIGNATURE      0x00000020
1648 #define CRYPT_VERIFY_DATA_HASH              0x00000040
1649 #define CRYPT_KEEP_TIME_VALID               0x00000080
1650 #define CRYPT_DONT_VERIFY_SIGNATURE         0x00000100
1651 #define CRYPT_DONT_CHECK_TIME_VALIDITY      0x00000200
1652 #define CRYPT_CHECK_FRESHNESS_TIME_VALIDITY 0x00000400
1653 #define CRYPT_ACCUMULATIVE_TIMEOUT          0x00000800
1654 
1655 typedef BOOL
1656 (WINAPI *PFN_CRYPT_CANCEL_RETRIEVAL)(
1657   _In_ DWORD dwFlags,
1658   _Inout_opt_ void *pvArg);
1659 
1660 typedef struct _CERT_CRL_CONTEXT_PAIR
1661 {
1662     PCCERT_CONTEXT pCertContext;
1663     PCCRL_CONTEXT  pCrlContext;
1664 } CERT_CRL_CONTEXT_PAIR, *PCERT_CRL_CONTEXT_PAIR;
1665 typedef const CERT_CRL_CONTEXT_PAIR *PCCERT_CRL_CONTEXT_PAIR;
1666 
1667 #define TIME_VALID_OID_GET_OBJECT_FUNC   "TimeValidDllGetObject"
1668 
1669 #define TIME_VALID_OID_GET_CTL                    ((LPCSTR)1)
1670 #define TIME_VALID_OID_GET_CRL                    ((LPCSTR)2)
1671 #define TIME_VALID_OID_GET_CRL_FROM_CERT          ((LPCSTR)3)
1672 #define TIME_VALID_OID_GET_FRESHEST_CRL_FROM_CERT ((LPCSTR)4)
1673 #define TIME_VALID_OID_GET_FRESHEST_CRL_FROM_CRL  ((LPCSTR)5)
1674 
1675 #define TIME_VALID_OID_FLUSH_OBJECT_FUNC "TimeValidDllFlushObject"
1676 
1677 #define TIME_VALID_OID_FLUSH_CTL                    ((LPCSTR)1)
1678 #define TIME_VALID_OID_FLUSH_CRL                    ((LPCSTR)2)
1679 #define TIME_VALID_OID_FLUSH_CRL_FROM_CERT          ((LPCSTR)3)
1680 #define TIME_VALID_OID_FLUSH_FRESHEST_CRL_FROM_CERT ((LPCSTR)4)
1681 #define TIME_VALID_OID_FLUSH_FRESHEST_CRL_FROM_CRL  ((LPCSTR)5)
1682 
1683 /* OID group IDs */
1684 #define CRYPT_HASH_ALG_OID_GROUP_ID     1
1685 #define CRYPT_ENCRYPT_ALG_OID_GROUP_ID  2
1686 #define CRYPT_PUBKEY_ALG_OID_GROUP_ID   3
1687 #define CRYPT_SIGN_ALG_OID_GROUP_ID     4
1688 #define CRYPT_RDN_ATTR_OID_GROUP_ID     5
1689 #define CRYPT_EXT_OR_ATTR_OID_GROUP_ID  6
1690 #define CRYPT_ENHKEY_USAGE_OID_GROUP_ID 7
1691 #define CRYPT_POLICY_OID_GROUP_ID       8
1692 #define CRYPT_TEMPLATE_OID_GROUP_ID     9
1693 #define CRYPT_LAST_OID_GROUP_ID         9
1694 
1695 #define CRYPT_FIRST_ALG_OID_GROUP_ID CRYPT_HASH_ALG_OID_GROUP_ID
1696 #define CRYPT_LAST_ALG_OID_GROUP_ID  CRYPT_SIGN_ALG_OID_GROUP_ID
1697 
1698 #define CRYPT_OID_INHIBIT_SIGNATURE_FORMAT_FLAG  0x1
1699 #define CRYPT_OID_USE_PUBKEY_PARA_FOR_PKCS7_FLAG 0x2
1700 #define CRYPT_OID_NO_NULL_ALGORITHM_PARA_FLAG    0x4
1701 
1702 #define CRYPT_OID_INFO_OID_KEY   1
1703 #define CRYPT_OID_INFO_NAME_KEY  2
1704 #define CRYPT_OID_INFO_ALGID_KEY 3
1705 #define CRYPT_OID_INFO_SIGN_KEY  4
1706 
1707 /* Algorithm IDs */
1708 
1709 #define GET_ALG_CLASS(x)                (x & (7 << 13))
1710 #define GET_ALG_TYPE(x)                 (x & (15 << 9))
1711 #define GET_ALG_SID(x)                  (x & (511))
1712 
1713 /* Algorithm Classes */
1714 #define ALG_CLASS_ANY                   (0)
1715 #define ALG_CLASS_SIGNATURE             (1 << 13)
1716 #define ALG_CLASS_MSG_ENCRYPT           (2 << 13)
1717 #define ALG_CLASS_DATA_ENCRYPT          (3 << 13)
1718 #define ALG_CLASS_HASH                  (4 << 13)
1719 #define ALG_CLASS_KEY_EXCHANGE          (5 << 13)
1720 #define ALG_CLASS_ALL                   (7 << 13)
1721 /* Algorithm types */
1722 #define ALG_TYPE_ANY                    (0)
1723 #define ALG_TYPE_DSS                    (1 << 9)
1724 #define ALG_TYPE_RSA                    (2 << 9)
1725 #define ALG_TYPE_BLOCK                  (3 << 9)
1726 #define ALG_TYPE_STREAM                 (4 << 9)
1727 #define ALG_TYPE_DH                     (5 << 9)
1728 #define ALG_TYPE_SECURECHANNEL          (6 << 9)
1729 #define ALG_TYPE_DH_EPHEM               (7 << 9) /* FIXME: find the real TYPE name */
1730 
1731 /* SIDs */
1732 #define ALG_SID_ANY                     (0)
1733 /* RSA SIDs */
1734 #define ALG_SID_RSA_ANY                 0
1735 #define ALG_SID_RSA_PKCS                1
1736 #define ALG_SID_RSA_MSATWORK            2
1737 #define ALG_SID_RSA_ENTRUST             3
1738 #define ALG_SID_RSA_PGP                 4
1739 /* DSS SIDs */
1740 #define ALG_SID_DSS_ANY                 0
1741 #define ALG_SID_DSS_PKCS                1
1742 #define ALG_SID_DSS_DMS                 2
1743 #define ALG_SID_ECDSA                   3
1744 
1745 /* DES SIDs */
1746 #define ALG_SID_DES                     1
1747 #define ALG_SID_3DES                    3
1748 #define ALG_SID_DESX                    4
1749 #define ALG_SID_IDEA                    5
1750 #define ALG_SID_CAST                    6
1751 #define ALG_SID_SAFERSK64               7
1752 #define ALG_SID_SAFERSK128              8
1753 #define ALG_SID_3DES_112                9
1754 #define ALG_SID_CYLINK_MEK             12
1755 #define ALG_SID_RC5                    13
1756 #define ALG_SID_AES_128                14
1757 #define ALG_SID_AES_192                15
1758 #define ALG_SID_AES_256                16
1759 #define ALG_SID_AES                    17
1760 /* Fortezza */
1761 #define ALG_SID_SKIPJACK               10
1762 #define ALG_SID_TEK                    11
1763 /* Diffie-Hellman SIDs */
1764 #define ALG_SID_DH_SANDF                1
1765 #define ALG_SID_DH_EPHEM                2
1766 #define ALG_SID_AGREED_KEY_ANY          3
1767 #define ALG_SID_KEA                     4
1768 #define ALG_SID_ECDH                    5
1769 #define ALG_SID_ECDH_EPHEM              6 /* FIXME: find the real SID name */
1770 /* RC2 SIDs */
1771 #define ALG_SID_RC4                     1
1772 #define ALG_SID_RC2                     2
1773 #define ALG_SID_SEAL                    2
1774 /* Hash SIDs */
1775 #define ALG_SID_MD2                     1
1776 #define ALG_SID_MD4                     2
1777 #define ALG_SID_MD5                     3
1778 #define ALG_SID_SHA                     4
1779 #define ALG_SID_SHA1                    ALG_SID_SHA
1780 #define ALG_SID_MAC                     5
1781 #define ALG_SID_RIPEMD                  6
1782 #define ALG_SID_RIPEMD160               7
1783 #define ALG_SID_SSL3SHAMD5              8
1784 #define ALG_SID_HMAC                    9
1785 #define ALG_SID_TLS1PRF                10
1786 #define ALG_SID_HASH_REPLACE_OWF       11
1787 #define ALG_SID_SHA_256                12
1788 #define ALG_SID_SHA_384                13
1789 #define ALG_SID_SHA_512                14
1790 /* SCHANNEL SIDs */
1791 #define ALG_SID_SSL3_MASTER             1
1792 #define ALG_SID_SCHANNEL_MASTER_HASH    2
1793 #define ALG_SID_SCHANNEL_MAC_KEY        3
1794 #define ALG_SID_PCT1_MASTER             4
1795 #define ALG_SID_SSL2_MASTER             5
1796 #define ALG_SID_TLS1_MASTER             6
1797 #define ALG_SID_SCHANNEL_ENC_KEY        7
1798 #define ALG_SID_EXAMPLE                80
1799 
1800 #define ALG_SID_ECMQV                   1
1801 
1802 /* Algorithm Definitions */
1803 #define CALG_MD2                  (ALG_CLASS_HASH         | ALG_TYPE_ANY           | ALG_SID_MD2)
1804 #define CALG_MD4                  (ALG_CLASS_HASH         | ALG_TYPE_ANY           | ALG_SID_MD4)
1805 #define CALG_MD5                  (ALG_CLASS_HASH         | ALG_TYPE_ANY           | ALG_SID_MD5)
1806 #define CALG_SHA                  (ALG_CLASS_HASH         | ALG_TYPE_ANY           | ALG_SID_SHA)
1807 #define CALG_SHA1 CALG_SHA
1808 #define CALG_MAC                  (ALG_CLASS_HASH         | ALG_TYPE_ANY           | ALG_SID_MAC)
1809 #define CALG_SSL3_SHAMD5          (ALG_CLASS_HASH         | ALG_TYPE_ANY           | ALG_SID_SSL3SHAMD5)
1810 #define CALG_HMAC                 (ALG_CLASS_HASH         | ALG_TYPE_ANY           | ALG_SID_HMAC)
1811 #define CALG_TLS1PRF              (ALG_CLASS_HASH         | ALG_TYPE_ANY           | ALG_SID_TLS1PRF)
1812 #define CALG_HASH_REPLACE_OWF     (ALG_CLASS_HASH         | ALG_TYPE_ANY           | ALG_SID_HASH_REPLACE_OWF)
1813 #define CALG_SHA_256              (ALG_CLASS_HASH         | ALG_TYPE_ANY           | ALG_SID_SHA_256)
1814 #define CALG_SHA_384              (ALG_CLASS_HASH         | ALG_TYPE_ANY           | ALG_SID_SHA_384)
1815 #define CALG_SHA_512              (ALG_CLASS_HASH         | ALG_TYPE_ANY           | ALG_SID_SHA_512)
1816 #define CALG_RSA_SIGN             (ALG_CLASS_SIGNATURE    | ALG_TYPE_RSA           | ALG_SID_RSA_ANY)
1817 #define CALG_DSS_SIGN             (ALG_CLASS_SIGNATURE    | ALG_TYPE_DSS           | ALG_SID_DSS_ANY)
1818 #define CALG_NO_SIGN              (ALG_CLASS_SIGNATURE    | ALG_TYPE_ANY           | ALG_SID_ANY)
1819 #define CALG_DH_SF                (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_DH            | ALG_SID_DH_SANDF)
1820 #define CALG_DH_EPHEM             (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_DH            | ALG_SID_DH_EPHEM)
1821 #define CALG_AGREEDKEY_ANY        (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_DH            | ALG_SID_AGREED_KEY_ANY)
1822 #define CALG_KEA_KEYX             (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_DH            | ALG_SID_KEA)
1823 #define CALG_HUGHES_MD5           (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_ANY           | ALG_SID_MD5)
1824 #define CALG_RSA_KEYX             (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_RSA           | ALG_SID_RSA_ANY)
1825 #define CALG_ECDH                 (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_DH            | ALG_SID_ECDH)
1826 #define CALG_ECDH_EPHEM           (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_DH_EPHEM      | ALG_SID_ECDH_EPHEM) /* FIXME: find the original TYPE and SID names */
1827 #define CALG_ECMQV                (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_ANY           | ALG_SID_ECMQV)
1828 #define CALG_DES                  (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK         | ALG_SID_DES)
1829 #define CALG_RC2                  (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK         | ALG_SID_RC2)
1830 #define CALG_3DES                 (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK         | ALG_SID_3DES)
1831 #define CALG_3DES_112             (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK         | ALG_SID_3DES_112)
1832 #define CALG_DESX                 (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK         | ALG_SID_DESX)
1833 #define CALG_AES_128              (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK         | ALG_SID_AES_128)
1834 #define CALG_AES_192              (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK         | ALG_SID_AES_192)
1835 #define CALG_AES_256              (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK         | ALG_SID_AES_256)
1836 #define CALG_AES                  (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK         | ALG_SID_AES)
1837 #define CALG_RC4                  (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_STREAM        | ALG_SID_RC4)
1838 #define CALG_SEAL                 (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_STREAM        | ALG_SID_SEAL)
1839 #define CALG_RC5                  (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_STREAM        | ALG_SID_RC5)
1840 #define CALG_SKIPJACK             (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK         | ALG_SID_SKIPJACK)
1841 #define CALG_TEK                  (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK         | ALG_SID_TEK)
1842 #define CALG_CYLINK_MEK           (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK         | ALG_SID_CYLINK_MEK)
1843 #define CALG_SSL3_MASTER          (ALG_CLASS_MSG_ENCRYPT  | ALG_TYPE_SECURECHANNEL | ALG_SID_SSL3_MASTER)
1844 #define CALG_SCHANNEL_MASTER_HASH (ALG_CLASS_MSG_ENCRYPT  | ALG_TYPE_SECURECHANNEL | ALG_SID_SCHANNEL_MASTER_HASH)
1845 #define CALG_SCHANNEL_MAC_KEY     (ALG_CLASS_MSG_ENCRYPT  | ALG_TYPE_SECURECHANNEL | ALG_SID_SCHANNEL_MAC_KEY)
1846 #define CALG_SCHANNEL_ENC_KEY     (ALG_CLASS_MSG_ENCRYPT  | ALG_TYPE_SECURECHANNEL | ALG_SID_SCHANNEL_ENC_KEY)
1847 #define CALG_PCT1_MASTER          (ALG_CLASS_MSG_ENCRYPT  | ALG_TYPE_SECURECHANNEL | ALG_SID_PCT1_MASTER)
1848 #define CALG_SSL2_MASTER          (ALG_CLASS_MSG_ENCRYPT  | ALG_TYPE_SECURECHANNEL | ALG_SID_SSL2_MASTER)
1849 #define CALG_TLS1_MASTER          (ALG_CLASS_MSG_ENCRYPT  | ALG_TYPE_SECURECHANNEL | ALG_SID_TLS1_MASTER)
1850 #define CALG_ECDSA                (ALG_CLASS_SIGNATURE    | ALG_TYPE_DSS           | ALG_SID_ECDSA)
1851 /* Protocol Flags */
1852 #define CRYPT_FLAG_PCT1    0x0001
1853 #define CRYPT_FLAG_SSL2    0x0002
1854 #define CRYPT_FLAG_SSL3    0x0004
1855 #define CRYPT_FLAG_TLS1    0x0008
1856 #define CRYPT_FLAG_IPSEC   0x0010
1857 #define CRYPT_FLAG_SIGNING 0x0020
1858 
1859 /* Provider names */
1860 #define MS_DEF_PROV_A                            "Microsoft Base Cryptographic Provider v1.0"
1861 #if defined(__GNUC__)
1862 # define MS_DEF_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
1863 	'B','a','s','e',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ', \
1864 	'P','r','o','v','i','d','e','r',' ','v','1','.','0',0 }
1865 #elif defined(_MSC_VER)
1866 # define MS_DEF_PROV_W      L"Microsoft Base Cryptographic Provider v1.0"
1867 #else
1868 static const WCHAR MS_DEF_PROV_W[] =             { 'M','i','c','r','o','s','o','f','t',' ',
1869 	'B','a','s','e',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ',
1870 	'P','r','o','v','i','d','e','r',' ','v','1','.','0',0 };
1871 #endif
1872 #define MS_DEF_PROV                              WINELIB_NAME_AW(MS_DEF_PROV_)
1873 
1874 #define MS_ENHANCED_PROV_A                       "Microsoft Enhanced Cryptographic Provider v1.0"
1875 #if defined(__GNUC__)
1876 # define MS_ENHANCED_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
1877 	'E','n','h','a','n','c','e','d',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ', \
1878 	'P','r','o','v','i','d','e','r',' ','v','1','.','0',0 }
1879 #elif defined(_MSC_VER)
1880 # define MS_ENHANCED_PROV_W     L"Microsoft Enhanced Cryptographic Provider v1.0"
1881 #else
1882 static const WCHAR MS_ENHANCED_PROV_W[] =        { 'M','i','c','r','o','s','o','f','t',' ',
1883 	'E','n','h','a','n','c','e','d',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ',
1884 	'P','r','o','v','i','d','e','r',' ','v','1','.','0',0 };
1885 #endif
1886 #define MS_ENHANCED_PROV                         WINELIB_NAME_AW(MS_ENHANCED_PROV_)
1887 
1888 #define MS_STRONG_PROV_A                         "Microsoft Strong Cryptographic Provider"
1889 #if defined(__GNUC__)
1890 # define MS_STRONG_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
1891 	'S','t','r','o','n','g',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ', \
1892 	'P','r','o','v','i','d','e','r',0 }
1893 #elif defined(_MSC_VER)
1894 # define MS_STRONG_PROV_W     L"Microsoft Strong Cryptographic Provider"
1895 #else
1896 static const WCHAR MS_STRONG_PROV_W[] =          { 'M','i','c','r','o','s','o','f','t',' ',
1897 	'S','t','r','o','n','g',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ',
1898 	'P','r','o','v','i','d','e','r',0 };
1899 #endif
1900 #define MS_STRONG_PROV                           WINELIB_NAME_AW(MS_STRONG_PROV_)
1901 
1902 #define MS_DEF_RSA_SIG_PROV_A                    "Microsoft RSA Signature Cryptographic Provider"
1903 #if defined(__GNUC__)
1904 # define MS_DEF_RSA_SIG_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
1905 	'R','S','A',' ','S','i','g','n','a','t','u','r','e',' ', \
1906 	'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
1907 #elif defined(_MSC_VER)
1908 # define MS_DEF_RSA_SIG_PROV_W      L"Microsoft RSA Signature Cryptographic Provider"
1909 #else
1910 static const WCHAR MS_DEF_RSA_SIG_PROV_W[] =     { 'M','i','c','r','o','s','o','f','t',' ',
1911 	'R','S','A',' ','S','i','g','n','a','t','u','r','e',' ',
1912 	'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
1913 #endif
1914 #define MS_DEF_RSA_SIG_PROV                      WINELIB_NAME_AW(MS_DEF_RSA_SIG_PROV_)
1915 
1916 #define MS_DEF_RSA_SCHANNEL_PROV_A               "Microsoft RSA SChannel Cryptographic Provider"
1917 #if defined(__GNUC__)
1918 # define MS_DEF_RSA_SCHANNEL_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
1919 	'R','S','A',' ','S','C','h','a','n','n','e','l',' ', \
1920 	'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
1921 #elif defined(_MSC_VER)
1922 # define MS_DEF_RSA_SCHANNEL_PROV_W     L"Microsoft RSA SChannel Cryptographic Provider"
1923 #else
1924 static const WCHAR MS_DEF_RSA_SCHANNEL_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
1925 	'R','S','A',' ','S','C','h','a','n','n','e','l',' ',
1926 	'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
1927 #endif
1928 #define MS_DEF_RSA_SCHANNEL_PROV                 WINELIB_NAME_AW(MS_DEF_RSA_SCHANNEL_PROV_)
1929 
1930 #define MS_DEF_DSS_PROV_A                        "Microsoft Base DSS Cryptographic Provider"
1931 #if defined(__GNUC__)
1932 # define MS_DEF_DSS_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
1933 	'B','a','s','e',' ','D','S','S',' ', \
1934 	'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
1935 #elif defined(_MSC_VER)
1936 # define MS_DEF_DSS_PROV_W     L"Microsoft Base DSS Cryptographic Provider"
1937 #else
1938 static const WCHAR MS_DEF_DSS_PROV_W[] =         { 'M','i','c','r','o','s','o','f','t',' ',
1939 	'B','a','s','e',' ','D','S','S',' ',
1940 	'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
1941 #endif
1942 #define MS_DEF_DSS_PROV                          WINELIB_NAME_AW(MS_DEF_DSS_PROV_)
1943 
1944 #define MS_DEF_DSS_DH_PROV_A                     "Microsoft Base DSS and Diffie-Hellman Cryptographic Provider"
1945 #if defined(__GNUC__)
1946 # define MS_DEF_DSS_DH_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
1947 	'B','a','s','e',' ','D','S','S',' ','a','n','d',' ', \
1948 	'D','i','f','f','i','e','-','H','e','l','l','m','a','n',' ', \
1949 	'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
1950 #elif defined(_MSC_VER)
1951 # define MS_DEF_DSS_DH_PROV_W     L"Microsoft Base DSS and Diffie-Hellman Cryptographic Provider"
1952 #else
1953 static const WCHAR MS_DEF_DSS_DH_PROV_W[] =      { 'M','i','c','r','o','s','o','f','t',' ',
1954 	'B','a','s','e',' ','D','S','S',' ','a','n','d',' ',
1955 	'D','i','f','f','i','e','-','H','e','l','l','m','a','n',' ',
1956 	'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
1957 #endif
1958 #define MS_DEF_DSS_DH_PROV                       WINELIB_NAME_AW(MS_DEF_DSS_DH_PROV_)
1959 
1960 #define MS_ENH_DSS_DH_PROV_A                     "Microsoft Enhanced DSS and Diffie-Hellman Cryptographic Provider"
1961 #if defined(__GNUC__)
1962 # define MS_ENH_DSS_DH_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
1963 	'E','n','h','a','n','c','e','d',' ','D','S','S',' ','a','n','d',' ', \
1964 	'D','i','f','f','i','e','-','H','e','l','l','m','a','n',' ', \
1965 	'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
1966 #elif defined(_MSC_VER)
1967 # define MS_ENH_DSS_DH_PROV_W     L"Microsoft Enhanced DSS and Diffie-Hellman Cryptographic Provider"
1968 #else
1969 static const WCHAR MS_ENH_DSS_DH_PROV_W[] =      { 'M','i','c','r','o','s','o','f','t',' ',
1970 	'E','n','h','a','n','c','e','d',' ','D','S','S',' ','a','n','d',' ',
1971 	'D','i','f','f','i','e','-','H','e','l','l','m','a','n',' ',
1972 	'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
1973 #endif
1974 #define MS_ENH_DSS_DH_PROV                       WINELIB_NAME_AW(MS_ENH_DSS_DH_PROV_)
1975 
1976 #define MS_DEF_DH_SCHANNEL_PROV_A                "Microsoft DH SChannel Cryptographic Provider"
1977 #if defined(__GNUC__)
1978 # define MS_DEF_DH_SCHANNEL_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
1979 	'D','H',' ','S','C','h','a','n','n','e','l',' ', \
1980 	'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
1981 #elif defined(_MSC_VER)
1982 # define MS_DEF_DH_SCHANNEL_PROV_W     L"Microsoft DH SChannel Cryptographic Provider"
1983 #else
1984 static const WCHAR MS_DEF_DH_SCHANNEL_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
1985 	'D','H',' ','S','C','h','a','n','n','e','l',' ',
1986 	'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
1987 #endif
1988 #define MS_DEF_DH_SCHANNEL_PROV                  WINELIB_NAME_AW(MS_DEF_DH_SCHANNEL_PROV_)
1989 
1990 #define MS_SCARD_PROV_A                          "Microsoft Base Smart Card Cryptographic Provider"
1991 #if defined(__GNUC__)
1992 # define MS_SCARD_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
1993 	'B','a','s','e',' ','S','m','a','r','t',' ','C','a','r','d',' ', \
1994 	'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
1995 #elif defined(_MSC_VER)
1996 # define MS_SCARD_PROV_W     L"Microsoft Base Smart Card Cryptographic Provider"
1997 #else
1998 static const WCHAR MS_SCARD_PROV_W[] =           { 'M','i','c','r','o','s','o','f','t',' ',
1999 	'B','a','s','e',' ','S','m','a','r','t',' ','C','a','r','d',' ',
2000 	'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
2001 #endif
2002 #define MS_SCARD_PROV                            WINELIB_NAME_AW(MS_SCARD_PROV_)
2003 
2004 #define MS_ENH_RSA_AES_PROV_A                          "Microsoft Enhanced RSA and AES Cryptographic Provider"
2005 #if defined(__GNUC__)
2006 # define MS_ENH_RSA_AES_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
2007 	'E','n','h','a','n','c','e','d',' ','R','S','A',' ','a','n','d',' ','A','E','S',' ',\
2008 	'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
2009 #elif defined(_MSC_VER)
2010 # define MS_ENH_RSA_AES_PROV_W     L"Microsoft Enhanced RSA and AES Cryptographic Provider"
2011 #else
2012 static const WCHAR MS_ENH_RSA_AES_PROV_W[] =           { 'M','i','c','r','o','s','o','f','t',' ',
2013 	'E','n','h','a','n','c','e','d',' ','R','S','A',' ','a','n','d',' ','A','E','S',' ',
2014 	'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
2015 #endif
2016 #define MS_ENH_RSA_AES_PROV                            WINELIB_NAME_AW(MS_ENH_RSA_AES_PROV_)
2017 
2018 #define MS_ENH_RSA_AES_PROV_XP_A    "Microsoft Enhanced RSA and AES Cryptographic Provider (Prototype)"
2019 #if defined(__GNUC__)
2020 # define MS_ENH_RSA_AES_PROV_XP_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
2021         'E','n','h','a','n','c','e','d',' ','R','S','A',' ','a','n','d',' ','A','E','S',' ',\
2022         'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',' ',\
2023         '(','P','r','o','t','o','t','y','p','e',')',0 }
2024 #elif defined(_MSC_VER)
2025 # define MS_ENH_RSA_AES_PROV_XP_W   L"Microsoft Enhanced RSA and AES Cryptographic Provider (Prototype)"
2026 #else
2027 static const WCHAR MS_ENH_RSA_AES_PROV_XP_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
2028         'E','n','h','a','n','c','e','d',' ','R','S','A',' ','a','n','d',' ','A','E','S',' ',
2029         'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',' ',
2030         '(','P','r','o','t','o','t','y','p','e',')',0 };
2031 #endif
2032 #define MS_ENH_RSA_AES_PROV_XP                   WINELIB_NAME_AW(MS_ENH_RSA_AES_PROV_XP_)
2033 
2034 /* Key Specs*/
2035 #define AT_KEYEXCHANGE          1
2036 #define AT_SIGNATURE            2
2037 
2038 /* Provider Types */
2039 #define PROV_RSA_FULL             1
2040 #define PROV_RSA_SIG              2
2041 #define PROV_DSS                  3
2042 #define PROV_FORTEZZA             4
2043 #define PROV_MS_EXCHANGE          5
2044 #define PROV_SSL                  6
2045 #define PROV_RSA_SCHANNEL         12
2046 #define PROV_DSS_DH               13
2047 #define PROV_EC_ECDSA_SIG         14
2048 #define PROV_EC_ECNRA_SIG         15
2049 #define PROV_EC_ECDSA_FULL        16
2050 #define PROV_EC_ECNRA_FULL        17
2051 #define PROV_DH_SCHANNEL          18
2052 #define PROV_SPYRUS_LYNKS         20
2053 #define PROV_RNG                  21
2054 #define PROV_INTEL_SEC            22
2055 #define PROV_REPLACE_OWF          23
2056 #define PROV_RSA_AES              24
2057 
2058 /* FLAGS Section */
2059 
2060 #define CRYPT_FIRST             1
2061 #define CRYPT_NEXT              2
2062 
2063 #define CRYPT_IMPL_HARDWARE     1
2064 #define CRYPT_IMPL_SOFTWARE     2
2065 #define CRYPT_IMPL_MIXED        3
2066 #define CRYPT_IMPL_UNKNOWN      4
2067 
2068 /* CryptAcquireContext */
2069 #define CRYPT_VERIFYCONTEXT       0xF0000000
2070 #define CRYPT_NEWKEYSET           0x00000008
2071 #define CRYPT_DELETEKEYSET        0x00000010
2072 #define CRYPT_MACHINE_KEYSET      0x00000020
2073 #define CRYPT_SILENT              0x00000040
2074 
2075 /* Crypt{Get|Set}Provider */
2076 #define CRYPT_MACHINE_DEFAULT     0x00000001
2077 #define CRYPT_USER_DEFAULT        0x00000002
2078 #define CRYPT_DELETE_DEFAULT      0x00000004
2079 
2080 /* Crypt{Get/Set}ProvParam */
2081 #define PP_CLIENT_HWND          1
2082 #define PP_ENUMALGS             1
2083 #define PP_ENUMCONTAINERS       2
2084 #define PP_IMPTYPE              3
2085 #define PP_NAME                 4
2086 #define PP_VERSION              5
2087 #define PP_CONTAINER            6
2088 #define PP_CHANGE_PASSWORD      7
2089 #define PP_KEYSET_SEC_DESCR     8
2090 #define PP_KEY_TYPE_SUBTYPE     10
2091 #define PP_CONTEXT_INFO         11
2092 #define PP_KEYEXCHANGE_KEYSIZE  12
2093 #define PP_SIGNATURE_KEYSIZE    13
2094 #define PP_KEYEXCHANGE_ALG      14
2095 #define PP_SIGNATURE_ALG        15
2096 #define PP_PROVTYPE             16
2097 #define PP_KEYSTORAGE           17
2098 #define PP_SYM_KEYSIZE          19
2099 #define PP_SESSION_KEYSIZE      20
2100 #define PP_UI_PROMPT            21
2101 #define PP_ENUMALGS_EX          22
2102 #define PP_DELETEKEY            24
2103 #define PP_ENUMMANDROOTS        25
2104 #define PP_ENUMELECTROOTS       26
2105 #define PP_KEYSET_TYPE          27
2106 #define PP_ADMIN_PIN            31
2107 #define PP_KEYEXCHANGE_PIN      32
2108 #define PP_SIGNATURE_PIN        33
2109 #define PP_SIG_KEYSIZE_INC      34
2110 #define PP_KEYX_KEYSIZE_INC     35
2111 #define PP_UNIQUE_CONTAINER     36
2112 #define PP_SGC_INFO             37
2113 #define PP_USE_HARDWARE_RNG     38
2114 #define PP_KEYSPEC              39
2115 #define PP_ENUMEX_SIGNING_PROT  40
2116 #define PP_CRYPT_COUNT_KEY_USE  41
2117 #define PP_USER_CERTSTORE       42
2118 #define PP_SMARTCARD_READER     43
2119 #define PP_SMARTCARD_GUID       45
2120 #define PP_ROOT_CERTSTORE       46
2121 
2122 /* Values returned by CryptGetProvParam of PP_KEYSTORAGE */
2123 #define CRYPT_SEC_DESCR         0x00000001
2124 #define CRYPT_PSTORE            0x00000002
2125 #define CRYPT_UI_PROMPT         0x00000004
2126 
2127 /* Crypt{Get/Set}KeyParam */
2128 #define KP_IV                   1
2129 #define KP_SALT                 2
2130 #define KP_PADDING              3
2131 #define KP_MODE                 4
2132 #define KP_MODE_BITS            5
2133 #define KP_PERMISSIONS          6
2134 #define KP_ALGID                7
2135 #define KP_BLOCKLEN             8
2136 #define KP_KEYLEN               9
2137 #define KP_SALT_EX              10
2138 #define KP_P                    11
2139 #define KP_G                    12
2140 #define KP_Q                    13
2141 #define KP_X                    14
2142 #define KP_Y                    15
2143 #define KP_RA                   16
2144 #define KP_RB                   17
2145 #define KP_INFO                 18
2146 #define KP_EFFECTIVE_KEYLEN     19
2147 #define KP_SCHANNEL_ALG         20
2148 #define KP_CLIENT_RANDOM        21
2149 #define KP_SERVER_RANDOM        22
2150 #define KP_RP                   23
2151 #define KP_PRECOMP_MD5          24
2152 #define KP_PRECOMP_SHA          25
2153 #define KP_CERTIFICATE          26
2154 #define KP_CLEAR_KEY            27
2155 #define KP_PUB_EX_LEN           28
2156 #define KP_PUB_EX_VAL           29
2157 #define KP_KEYVAL               30
2158 #define KP_ADMIN_PIN            31
2159 #define KP_KEYEXCHANGE_PIN      32
2160 #define KP_SIGNATURE_PIN        33
2161 #define KP_PREHASH              34
2162 #define KP_ROUNDS               35
2163 #define KP_OAEP_PARAMS          36
2164 #define KP_CMS_KEY_INFO         37
2165 #define KP_CMS_DH_KEY_INFO      38
2166 #define KP_PUB_PARAMS           39
2167 #define KP_VERIFY_PARAMS        40
2168 #define KP_HIGHEST_VERSION      41
2169 #define KP_GET_USE_COUNT        42
2170 
2171 /* Values for KP_PADDING */
2172 #define PKCS5_PADDING  1
2173 #define RANDOM_PADDING 2
2174 #define ZERO_PADDING   3
2175 
2176 /* CryptSignHash/CryptVerifySignature */
2177 #define CRYPT_NOHASHOID         0x00000001
2178 #define CRYPT_TYPE2_FORMAT      0x00000002
2179 #define CRYPT_X931_FORMAT       0x00000004
2180 
2181 /* Crypt{Get,Set}HashParam */
2182 #define HP_ALGID                0x0001
2183 #define HP_HASHVAL              0x0002
2184 #define HP_HASHSIZE             0x0004
2185 #define HP_HMAC_INFO            0x0005
2186 #define HP_TLS1PRF_LABEL        0x0006
2187 #define HP_TLS1PRF_SEED         0x0007
2188 
2189 /* Crypt{Get,Set}KeyParam */
2190 #define CRYPT_MODE_CBC          1
2191 #define CRYPT_MODE_ECB          2
2192 #define CRYPT_MODE_OFB          3
2193 #define CRYPT_MODE_CFB          4
2194 
2195 #define CRYPT_ENCRYPT           0x0001
2196 #define CRYPT_DECRYPT           0x0002
2197 #define CRYPT_EXPORT            0x0004
2198 #define CRYPT_READ              0x0008
2199 #define CRYPT_WRITE             0x0010
2200 #define CRYPT_MAC               0x0020
2201 #define CRYPT_EXPORT_KEY        0x0040
2202 #define CRYPT_IMPORT_KEY        0x0080
2203 #define CRYPT_ARCHIVE           0x0100
2204 
2205 /* Crypt*Key */
2206 #define CRYPT_EXPORTABLE        0x00000001
2207 #define CRYPT_USER_PROTECTED    0x00000002
2208 #define CRYPT_CREATE_SALT       0x00000004
2209 #define CRYPT_UPDATE_KEY        0x00000008
2210 #define CRYPT_NO_SALT           0x00000010
2211 #define CRYPT_PREGEN            0x00000040
2212 #define CRYPT_SERVER            0x00000400
2213 #define CRYPT_ARCHIVABLE        0x00004000
2214 
2215 /* CryptExportKey */
2216 #define CRYPT_SSL2_FALLBACK     0x00000002
2217 #define CRYPT_DESTROYKEY        0x00000004
2218 #define CRYPT_OAEP              0x00000040
2219 
2220 /* CryptHashSessionKey */
2221 #define CRYPT_LITTLE_ENDIAN     0x00000001
2222 
2223 /* Crypt{Protect,Unprotect}Data PROMPTSTRUCT flags */
2224 #define CRYPTPROTECT_PROMPT_ON_PROTECT    0x0001
2225 #define CRYPTPROTECT_PROMPT_ON_UNPROTECT  0x0002
2226 /* Crypt{Protect,Unprotect}Data flags */
2227 #define CRYPTPROTECT_UI_FORBIDDEN       0x0001
2228 #define CRYPTPROTECT_LOCAL_MACHINE      0x0004
2229 #define CRYPTPROTECT_AUDIT              0x0010
2230 #define CRYPTPROTECT_VERIFY_PROTECTION  0x0040
2231 
2232 /* Crypt{Protect,Unprotect}Memory */
2233 #define CRYPTPROTECTMEMORY_BLOCK_SIZE     16
2234 #define CRYPTPROTECTMEMORY_SAME_PROCESS   0x0000
2235 #define CRYPTPROTECTMEMORY_CROSS_PROCESS  0x0001
2236 #define CRYPTPROTECTMEMORY_SAME_LOGON     0x0002
2237 
2238 /* Blob Types */
2239 #define SIMPLEBLOB              0x1
2240 #define PUBLICKEYBLOB           0x6
2241 #define PRIVATEKEYBLOB          0x7
2242 #define PLAINTEXTKEYBLOB        0x8
2243 #define OPAQUEKEYBLOB           0x9
2244 #define PUBLICKEYBLOBEX         0xA
2245 #define SYMMETRICWRAPKEYBLOB    0xB
2246 
2247 #define CUR_BLOB_VERSION        2
2248 
2249 /* cert store provider types */
2250 #define CERT_STORE_PROV_MSG                  ((LPCSTR)1)
2251 #define CERT_STORE_PROV_MEMORY               ((LPCSTR)2)
2252 #define CERT_STORE_PROV_FILE                 ((LPCSTR)3)
2253 #define CERT_STORE_PROV_REG                  ((LPCSTR)4)
2254 #define CERT_STORE_PROV_PKCS7                ((LPCSTR)5)
2255 #define CERT_STORE_PROV_SERIALIZED           ((LPCSTR)6)
2256 #define CERT_STORE_PROV_FILENAME_A           ((LPCSTR)7)
2257 #define CERT_STORE_PROV_FILENAME_W           ((LPCSTR)8)
2258 #define CERT_STORE_PROV_SYSTEM_A             ((LPCSTR)9)
2259 #define CERT_STORE_PROV_SYSTEM_W             ((LPCSTR)10)
2260 #define CERT_STORE_PROV_SYSTEM               CERT_STORE_PROV_SYSTEM_W
2261 #define CERT_STORE_PROV_COLLECTION           ((LPCSTR)11)
2262 #define CERT_STORE_PROV_SYSTEM_REGISTRY_A    ((LPCSTR)12)
2263 #define CERT_STORE_PROV_SYSTEM_REGISTRY_W    ((LPCSTR)13)
2264 #define CERT_STORE_PROV_SYSTEM_REGISTRY      CERT_STORE_PROV_SYSTEM_REGISTRY_W
2265 #define CERT_STORE_PROV_PHYSICAL_W           ((LPCSTR)14)
2266 #define CERT_STORE_PROV_PHYSICAL             CERT_STORE_PROV_PHYSICAL_W
2267 #define CERT_STORE_PROV_SMART_CARD_W         ((LPCSTR)15)
2268 #define CERT_STORE_PROV_SMART_CARD           CERT_STORE_PROV_SMART_CARD_W
2269 #define CERT_STORE_PROV_LDAP_W               ((LPCSTR)16)
2270 #define CERT_STORE_PROV_LDAP                 CERT_STORE_PROV_LDAP_W
2271 
2272 #define sz_CERT_STORE_PROV_MEMORY            "Memory"
2273 #define sz_CERT_STORE_PROV_FILENAME_W        "File"
2274 #define sz_CERT_STORE_PROV_FILENAME          sz_CERT_STORE_PROV_FILENAME_W
2275 #define sz_CERT_STORE_PROV_SYSTEM_W          "System"
2276 #define sz_CERT_STORE_PROV_SYSTEM            sz_CERT_STORE_PROV_SYSTEM_W
2277 #define sz_CERT_STORE_PROV_PKCS7             "PKCS7"
2278 #define sz_CERT_STORE_PROV_SERIALIZED        "Serialized"
2279 #define sz_CERT_STORE_PROV_COLLECTION        "Collection"
2280 #define sz_CERT_STORE_PROV_SYSTEM_REGISTRY_W "SystemRegistry"
2281 #define sz_CERT_STORE_PROV_SYSTEM_REGISTRY   sz_CERT_STORE_PROV_SYSTEM_REGISTRY_W
2282 #define sz_CERT_STORE_PROV_PHYSICAL_W        "Physical"
2283 #define sz_CERT_STORE_PROV_PHYSICAL          sz_CERT_STORE_PROV_PHYSICAL_W
2284 #define sz_CERT_STORE_PROV_SMART_CARD_W      "SmartCard"
2285 #define sz_CERT_STORE_PROV_SMART_CARD        sz_CERT_STORE_PROV_SMART_CARD_W
2286 #define sz_CERT_STORE_PROV_LDAP_W            "Ldap"
2287 #define sz_CERT_STORE_PROV_LDAP              sz_CERT_STORE_PROV_LDAP_W
2288 
2289 /* types for CertOpenStore dwEncodingType */
2290 #define CERT_ENCODING_TYPE_MASK 0x0000ffff
2291 #define CMSG_ENCODING_TYPE_MASK 0xffff0000
2292 #define GET_CERT_ENCODING_TYPE(x) ((x) & CERT_ENCODING_TYPE_MASK)
2293 #define GET_CMSG_ENCODING_TYPE(x) ((x) & CMSG_ENCODING_TYPE_MASK)
2294 
2295 #define CRYPT_ASN_ENCODING  0x00000001
2296 #define CRYPT_NDR_ENCODING  0x00000002
2297 #define X509_ASN_ENCODING   0x00000001
2298 #define X509_NDR_ENCODING   0x00000002
2299 #define PKCS_7_ASN_ENCODING 0x00010000
2300 #define PKCS_7_NDR_ENCODING 0x00020000
2301 
2302 /* system store locations */
2303 #define CERT_SYSTEM_STORE_LOCATION_MASK  0x00ff0000
2304 #define CERT_SYSTEM_STORE_LOCATION_SHIFT 16
2305 
2306 /* system store location ids */
2307 /* hkcu */
2308 #define CERT_SYSTEM_STORE_CURRENT_USER_ID               1
2309 /* hklm */
2310 #define CERT_SYSTEM_STORE_LOCAL_MACHINE_ID              2
2311 /* hklm\Software\Microsoft\Cryptography\Services */
2312 #define CERT_SYSTEM_STORE_CURRENT_SERVICE_ID            4
2313 #define CERT_SYSTEM_STORE_SERVICES_ID                   5
2314 /* HKEY_USERS */
2315 #define CERT_SYSTEM_STORE_USERS_ID                      6
2316 /* hkcu\Software\Policies\Microsoft\SystemCertificates */
2317 #define CERT_SYSTEM_STORE_CURRENT_USER_GROUP_POLICY_ID  7
2318 /* hklm\Software\Policies\Microsoft\SystemCertificates */
2319 #define CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY_ID 8
2320 /* hklm\Software\Microsoft\EnterpriseCertificates */
2321 #define CERT_SYSTEM_STORE_LOCAL_MACHINE_ENTERPRISE_ID   9
2322 
2323 /* system store location values */
2324 #define CERT_SYSTEM_STORE_CURRENT_USER \
2325  (CERT_SYSTEM_STORE_CURRENT_USER_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
2326 #define CERT_SYSTEM_STORE_LOCAL_MACHINE \
2327  (CERT_SYSTEM_STORE_LOCAL_MACHINE_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
2328 #define CERT_SYSTEM_STORE_CURRENT_SERVICE \
2329  (CERT_SYSTEM_STORE_CURRENT_SERVICE_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
2330 #define CERT_SYSTEM_STORE_SERVICES \
2331  (CERT_SYSTEM_STORE_SERVICES_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
2332 #define CERT_SYSTEM_STORE_USERS \
2333  (CERT_SYSTEM_STORE_USERS_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
2334 #define CERT_SYSTEM_STORE_CURRENT_USER_GROUP_POLICY \
2335  (CERT_SYSTEM_STORE_CURRENT_USER_GROUP_POLICY_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
2336 #define CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY \
2337  (CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
2338 #define CERT_SYSTEM_STORE_LOCAL_MACHINE_ENTERPRISE \
2339  (CERT_SYSTEM_STORE_LOCAL_MACHINE_ENTERPRISE_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
2340 
2341 #if defined(__GNUC__)
2342 #define CERT_LOCAL_MACHINE_SYSTEM_STORE_REGPATH (const WCHAR[])\
2343  {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t',\
2344   '\\','S','y','s','t','e','m','C','e','r','t','i','f','i','c','a','t','e','s',\
2345   0 }
2346 #define CERT_GROUP_POLICY_SYSTEM_STORE_REGPATH (const WCHAR[])\
2347  {'S','o','f','t','w','a','r','e','\\','P','o','l','i','c','i','e','s','\\',\
2348   'M','i','c','r','o','s','o','f','t','\\','S','y','s','t','e','m','C','e','r',\
2349   't','i','f','i','c','a','t','e','s',0 }
2350 #elif defined(_MSC_VER)
2351 #define CERT_LOCAL_MACHINE_SYSTEM_STORE_REGPATH \
2352  L"Software\\Microsoft\\SystemCertificates"
2353 #define CERT_GROUP_POLICY_SYSTEM_STORE_REGPATH \
2354  L"Software\\Policies\\Microsoft\\SystemCertificates"
2355 #else
2356 static const WCHAR CERT_LOCAL_MACHINE_SYSTEM_STORE_REGPATH[] =
2357  {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
2358   'S','y','s','t','e','m','C','e','r','t','i','f','i','c','a','t','e','s',0 };
2359 static const WCHAR CERT_GROUP_POLICY_SYSTEM_STORE_REGPATH[] =
2360  {'S','o','f','t','w','a','r','e','\\','P','o','l','i','c','i','e','s','\\',
2361   'M','i','c','r','o','s','o','f','t','\\','S','y','s','t','e','m','C','e','r',
2362   't','i','f','i','c','a','t','e','s',0 };
2363 #endif
2364 
2365 #if defined(__GNUC__)
2366 #define CERT_EFSBLOB_REGPATH (const WCHAR[])\
2367 {'S','o','f','t','w','a','r','e','\\','P','o','l','i','c','i','e','s','\\',\
2368  'M','i','c','r','o','s','o','f','t','\\','S','y','s','t','e','m','C','e','r',\
2369  't','i','f','i','c','a','t','e','s','\\','E','F','S',0 }
2370 #define CERT_EFSBLOB_VALUE_NAME (const WCHAR[]) {'E','F','S','B','l','o','b',0 }
2371 #elif defined(_MSC_VER)
2372 #define CERT_EFSBLOB_REGPATH CERT_GROUP_POLICY_SYSTEM_STORE_REGPATH L"\\EFS"
2373 #define CERT_EFSBLOB_VALUE_NAME L"EFSBlob"
2374 #else
2375 static const WCHAR CERT_EFSBLOB_REGPATH[] =
2376  {'S','o','f','t','w','a','r','e','\\','P','o','l','i','c','i','e','s','\\',
2377   'M','i','c','r','o','s','o','f','t','\\','S','y','s','t','e','m','C','e','r',
2378   't','i','f','i','c','a','t','e','s','\\','E','F','S',0 };
2379 static const CERT_EFSBLOB_VALUE_NAME[] = { 'E','F','S','B','l','o','b',0 };
2380 #endif
2381 
2382 #if defined(__GNUC__)
2383 #define CERT_PROT_ROOT_FLAGS_REGPATH (const WCHAR[])\
2384 {'\\','R','o','o','t','\\','P','r','o','t','e','c','t','e','d','R','o','o','t',\
2385  's',0 }
2386 #define CERT_PROT_ROOT_FLAGS_VALUE_NAME (const WCHAR[])\
2387 {'F','l','a','g','s',0 }
2388 #elif defined(_MSC_VER)
2389 #define CERT_PROT_ROOT_FLAGS_REGPATH L"\\Root\\ProtectedRoots"
2390 #define CERT_PROT_ROOT_FLAGS_VALUE_NAME L"Flags"
2391 #else
2392 static const WCHAR CERT_PROT_ROOT_FLAGS_REGPATH[] =
2393  { '\\','R','o','o','t','\\','P','r','o','t','e','c','t','e','d','R','o','o',
2394    't','s',0 };
2395 static const WCHAR CERT_PROT_ROOT_FLAGS_VALUE_NAME[] = {'F','l','a','g','s',0 };
2396 #endif
2397 
2398 #define CERT_PROT_ROOT_DISABLE_CURRENT_USER_FLAG                0x01
2399 #define CERT_PROT_ROOT_INHIBIT_ADD_AT_INIT_FLAG                 0x02
2400 #define CERT_PROT_ROOT_INHIBIT_PURGE_LM_FLAG                    0x04
2401 #define CERT_PROT_ROOT_DISABLE_LM_AUTH_FLAG                     0x08
2402 #define CERT_PROT_ROOT_DISABLE_NT_AUTH_REQUIRED_FLAG            0x10
2403 #define CERT_PROT_ROOT_DISABLE_NOT_DEFINED_NAME_CONSTRAINT_FLAG 0x20
2404 
2405 #if defined(__GNUC__)
2406 #define CERT_TRUST_PUB_SAFER_GROUP_POLICY_REGPATH (const WCHAR[])\
2407 {'S','o','f','t','w','a','r','e','\\','P','o','l','i','c','i','e','s','\\',\
2408  'M','i','c','r','o','s','o','f','t','\\','S','y','s','t','e','m','C','e','r',\
2409  't','i','f','i','c','a','t','e','s','\\','T','r','u','s','t','e','d',\
2410  'P','u','b','l','i','s','h','e','r','\\','S','a','f','e','r',0 }
2411 #elif defined(_MSC_VER)
2412 #define CERT_TRUST_PUB_SAFER_GROUP_POLICY_REGPATH \
2413  CERT_GROUP_POLICY_SYSTEM_STORE_REGPATH L"\\TrustedPublisher\\Safer"
2414 #else
2415 static const WCHAR CERT_TRUST_PUB_SAFER_GROUP_POLICY_REGPATH[] =
2416  {'S','o','f','t','w','a','r','e','\\','P','o','l','i','c','i','e','s','\\',
2417   'M','i','c','r','o','s','o','f','t','\\','S','y','s','t','e','m','C','e','r',
2418   't','i','f','i','c','a','t','e','s','\\','T','r','u','s','t','e','d',
2419   'P','u','b','l','i','s','h','e','r','\\','S','a','f','e','r',0 };
2420 #endif
2421 
2422 #if defined(__GNUC__)
2423 #define CERT_TRUST_PUB_SAFER_LOCAL_MACHINE_REGPATH (const WCHAR[])\
2424 {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',\
2425  'S','y','s','t','e','m','C','e','r','t','i','f','i','c','a','t','e','s','\\',\
2426  'T','r','u','s','t','e','d','P','u','b','l','i','s','h','e','r','\\',\
2427  'S','a','f','e','r',0 }
2428 #define CERT_TRUST_PUB_AUTHENTICODE_FLAGS_VALUE_NAME (const WCHAR[])\
2429 {'A','u','t','h','e','n','t','i','c','o','d','e','F','l','a','g','s',0 };
2430 #elif defined(_MSC_VER)
2431 #define CERT_TRUST_PUB_SAFER_LOCAL_MACHINE_REGPATH \
2432  CERT_LOCAL_MACHINE_SYSTEM_STORE_REGPATH L"\\TrustedPublisher\\Safer"
2433 #define CERT_TRUST_PUB_AUTHENTICODE_FLAGS_VALUE_NAME L"AuthenticodeFlags"
2434 #else
2435 static const WCHAR CERT_TRUST_PUB_SAFER_LOCAL_MACHINE_REGPATH[] =
2436  {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
2437   'S','y','s','t','e','m','C','e','r','t','i','f','i','c','a','t','e','s','\\',
2438   'T','r','u','s','t','e','d','P','u','b','l','i','s','h','e','r','\\',
2439   'S','a','f','e','r',0 };
2440 static const WCHAR CERT_TRUST_PUB_AUTHENTICODE_FLAGS_VALUE_NAME[] =
2441  { 'A','u','t','h','e','n','t','i','c','o','d','e','F','l','a','g','s',0 };
2442 #endif
2443 
2444 #define CERT_TRUST_PUB_ALLOW_END_USER_TRUST         0x00000000
2445 #define CERT_TRUST_PUB_ALLOW_MACHINE_ADMIN_TRUST    0x00000001
2446 #define CERT_TRUST_PUB_ALLOW_ENTERPRISE_ADMIN_TRUST 0x00000002
2447 #define CERT_TRUST_PUB_ALLOW_TRUST_MASK             0x00000003
2448 #define CERT_TRUST_PUB_CHECK_PUBLISHER_REV_FLAG     0x00000100
2449 #define CERT_TRUST_PUB_CHECK_TIMESTAMP_REV_FLAG     0x00000200
2450 
2451 /* flags for CertOpenStore dwFlags */
2452 #define CERT_STORE_NO_CRYPT_RELEASE_FLAG            0x00000001
2453 #define CERT_STORE_SET_LOCALIZED_NAME_FLAG          0x00000002
2454 #define CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG 0x00000004
2455 #define CERT_STORE_DELETE_FLAG                      0x00000010
2456 #define CERT_STORE_UNSAFE_PHYSICAL_FLAG             0x00000020
2457 #define CERT_STORE_SHARE_STORE_FLAG                 0x00000040
2458 #define CERT_STORE_SHARE_CONTEXT_FLAG               0x00000080
2459 #define CERT_STORE_MANIFOLD_FLAG                    0x00000100
2460 #define CERT_STORE_ENUM_ARCHIVED_FLAG               0x00000200
2461 #define CERT_STORE_UPDATE_KEYID_FLAG                0x00000400
2462 #define CERT_STORE_BACKUP_RESTORE_FLAG              0x00000800
2463 #define CERT_STORE_MAXIMUM_ALLOWED_FLAG             0x00001000
2464 #define CERT_STORE_CREATE_NEW_FLAG                  0x00002000
2465 #define CERT_STORE_OPEN_EXISTING_FLAG               0x00004000
2466 #define CERT_STORE_READONLY_FLAG                    0x00008000
2467 
2468 #define CERT_REGISTRY_STORE_REMOTE_FLAG      0x00010000
2469 #define CERT_REGISTRY_STORE_SERIALIZED_FLAG  0x00020000
2470 #define CERT_REGISTRY_STORE_ROAMING_FLAG     0x00040000
2471 #define CERT_REGISTRY_STORE_MY_IE_DIRTY_FLAG 0x00080000
2472 #define CERT_REGISTRY_STORE_LM_GPT_FLAG      0x01000000
2473 #define CERT_REGISTRY_STORE_CLIENT_GPT_FLAG  0x80000000
2474 
2475 #define CERT_FILE_STORE_COMMIT_ENABLE_FLAG 0x00010000
2476 
2477 /* CertCloseStore dwFlags */
2478 #define CERT_CLOSE_STORE_FORCE_FLAG 0x00000001
2479 #define CERT_CLOSE_STORE_CHECK_FLAG 0x00000002
2480 
2481 /* dwAddDisposition */
2482 #define CERT_STORE_ADD_NEW                                 1
2483 #define CERT_STORE_ADD_USE_EXISTING                        2
2484 #define CERT_STORE_ADD_REPLACE_EXISTING                    3
2485 #define CERT_STORE_ADD_ALWAYS                              4
2486 #define CERT_STORE_ADD_REPLACE_EXISTING_INHERIT_PROPERTIES 5
2487 #define CERT_STORE_ADD_NEWER                               6
2488 #define CERT_STORE_ADD_NEWER_INHERIT_PROPERTIES            7
2489 
2490 /* Installable OID function defs */
2491 #define CRYPT_OID_OPEN_STORE_PROV_FUNC     "CertDllOpenStoreProv"
2492 #define CRYPT_OID_ENCODE_OBJECT_FUNC       "CryptDllEncodeObject"
2493 #define CRYPT_OID_DECODE_OBJECT_FUNC       "CryptDllDecodeObject"
2494 #define CRYPT_OID_ENCODE_OBJECT_EX_FUNC    "CryptDllEncodeObjectEx"
2495 #define CRYPT_OID_DECODE_OBJECT_EX_FUNC    "CryptDllDecodeObjectEx"
2496 #define CRYPT_OID_CREATE_COM_OBJECT_FUNC   "CryptDllCreateComObject"
2497 #define CRYPT_OID_VERIFY_REVOCATION_FUNC   "CertDllVerifyRevocation"
2498 #define CRYPT_OID_VERIFY_CTL_USAGE_FUNC    "CertDllVerifyCTLUsage"
2499 #define CRYPT_OID_FORMAT_OBJECT_FUNC       "CryptDllFormatObject"
2500 #define CRYPT_OID_FIND_OID_INFO_FUNC       "CryptDllFindOIDInfo"
2501 #define CRYPT_OID_FIND_LOCALIZED_NAME_FUNC "CryptDllFindLocalizedName"
2502 #define CRYPT_OID_EXPORT_PUBLIC_KEY_INFO_FUNC  "CryptDllExportPublicKeyInfoEx"
2503 #define CRYPT_OID_IMPORT_PUBLIC_KEY_INFO_FUNC  "CryptDllImportPublicKeyInfoEx"
2504 #define CRYPT_OID_EXPORT_PRIVATE_KEY_INFO_FUNC "CryptDllExportPrivateKeyInfoEx"
2505 #define CRYPT_OID_IMPORT_PRIVATE_KEY_INFO_FUNC "CryptDllImportPrivateKeyInfoEx"
2506 #define CRYPT_OID_VERIFY_CERTIFICATE_CHAIN_POLICY_FUNC \
2507  "CertDllVerifyCertificateChainPolicy"
2508 #define URL_OID_GET_OBJECT_URL_FUNC    "UrlDllGetObjectUrl"
2509 #define TIME_VALID_OID_GET_OBJECT_FUNC "TimeValidDllGetObject"
2510 #define CMSG_OID_GEN_CONTENT_ENCRYPT_KEY_FUNC "CryptMsgDllGenContentEncryptKey"
2511 #define CMSG_OID_EXPORT_KEY_TRANS_FUNC        "CryptMsgDllExportKeyTrans"
2512 #define CMSG_OID_IMPORT_KEY_TRANS_FUNC        "CryptMsgDllImportKeyTrans"
2513 
2514 #define CRYPT_OID_REGPATH "Software\\Microsoft\\Cryptography\\OID"
2515 #define CRYPT_OID_REG_ENCODING_TYPE_PREFIX "EncodingType "
2516 #if defined(__GNUC__)
2517 # define CRYPT_OID_REG_DLL_VALUE_NAME (const WCHAR []){ 'D','l','l',0 }
2518 # define CRYPT_OID_REG_FUNC_NAME_VALUE_NAME \
2519  (const WCHAR []){ 'F','u','n','c','N','a','m','e',0 }
2520 # define CRYPT_OID_REG_FLAGS_VALUE_NAME \
2521  (const WCHAR []){ 'C','r','y','p','t','F','l','a','g','s',0 }
2522 #elif defined(_MSC_VER)
2523 # define CRYPT_OID_REG_DLL_VALUE_NAME       L"Dll"
2524 # define CRYPT_OID_REG_FUNC_NAME_VALUE_NAME L"FuncName"
2525 # define CRYPT_OID_REG_FLAGS_VALUE_NAME     L"CryptFlags"
2526 #else
2527 static const WCHAR CRYPT_OID_REG_DLL_VALUE_NAME[] = { 'D','l','l',0 };
2528 static const WCHAR CRYPT_OID_REG_FUNC_NAME_VALUE_NAME[] =
2529  { 'F','u','n','c','N','a','m','e',0 };
2530 static const WCHAR CRYPT_OID_REG_FLAGS_VALUE_NAME[] =
2531  { 'C','r','y','p','t','F','l','a','g','s',0 };
2532 #endif
2533 #define CRYPT_OID_REG_FUNC_NAME_VALUE_NAME_A "FuncName"
2534 #define CRYPT_DEFAULT_OID                    "DEFAULT"
2535 
2536 #define CRYPT_INSTALL_OID_FUNC_BEFORE_FLAG 1
2537 
2538 #define CRYPT_GET_INSTALLED_OID_FUNC_FLAG  0x1
2539 
2540 #define CRYPT_REGISTER_FIRST_INDEX 0
2541 #define CRYPT_REGISTER_LAST_INDEX  0xffffffff
2542 
2543 /* values for CERT_STORE_PROV_INFO's dwStoreProvFlags */
2544 #define CERT_STORE_PROV_EXTERNAL_FLAG        0x1
2545 #define CERT_STORE_PROV_DELETED_FLAG         0x2
2546 #define CERT_STORE_PROV_NO_PERSIST_FLAG      0x4
2547 #define CERT_STORE_PROV_SYSTEM_STORE_FLAG    0x8
2548 #define CERT_STORE_PROV_LM_SYSTEM_STORE_FLAG 0x10
2549 
2550 /* function indices */
2551 #define CERT_STORE_PROV_CLOSE_FUNC             0
2552 #define CERT_STORE_PROV_READ_CERT_FUNC         1
2553 #define CERT_STORE_PROV_WRITE_CERT_FUNC        2
2554 #define CERT_STORE_PROV_DELETE_CERT_FUNC       3
2555 #define CERT_STORE_PROV_SET_CERT_PROPERTY_FUNC 4
2556 #define CERT_STORE_PROV_READ_CRL_FUNC          5
2557 #define CERT_STORE_PROV_WRITE_CRL_FUNC         6
2558 #define CERT_STORE_PROV_DELETE_CRL_FUNC        7
2559 #define CERT_STORE_PROV_SET_CRL_PROPERTY_FUNC  8
2560 #define CERT_STORE_PROV_READ_CTL_FUNC          9
2561 #define CERT_STORE_PROV_WRITE_CTL_FUNC         10
2562 #define CERT_STORE_PROV_DELETE_CTL_FUNC        11
2563 #define CERT_STORE_PROV_SET_CTL_PROPERTY_FUNC  12
2564 #define CERT_STORE_PROV_CONTROL_FUNC           13
2565 #define CERT_STORE_PROV_FIND_CERT_FUNC         14
2566 #define CERT_STORE_PROV_FREE_FIND_CERT_FUNC    15
2567 #define CERT_STORE_PROV_GET_CERT_PROPERTY_FUNC 16
2568 #define CERT_STORE_PROV_FIND_CRL_FUNC          17
2569 #define CERT_STORE_PROV_FREE_FIND_CRL_FUNC     18
2570 #define CERT_STORE_PROV_GET_CRL_PROPERTY_FUNC  19
2571 #define CERT_STORE_PROV_FIND_CTL_FUNC          20
2572 #define CERT_STORE_PROV_FREE_FIND_CTL_FUNC     21
2573 #define CERT_STORE_PROV_GET_CTL_PROPERTY_FUNC  22
2574 
2575 /* physical store dwFlags, also used by CertAddStoreToCollection as
2576  * dwUpdateFlags
2577  */
2578 #define CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG                  0x1
2579 #define CERT_PHYSICAL_STORE_OPEN_DISABLE_FLAG                0x2
2580 #define CERT_PHYSICAL_STORE_REMOVE_OPEN_DISABLE_FLAG         0x4
2581 #define CERT_PHYSICAL_STORE_INSERT_COMPUTER_NAME_ENABLE_FLAG 0x8
2582 
2583 /* dwFlag values for CertEnumPhysicalStore callback */
2584 #define CERT_PHYSICAL_STORE_PREDEFINED_ENUM_FLAG 0x1
2585 
2586 /* predefined store names */
2587 #if defined(__GNUC__)
2588 # define CERT_PHYSICAL_STORE_DEFAULT_NAME (const WCHAR[])\
2589  {'.','D','e','f','a','u','l','t','0'}
2590 # define CERT_PHYSICAL_STORE_GROUP_POLICY_NAME (const WCHAR[])\
2591  {'.','G','r','o','u','p','P','o','l','i','c','y',0}
2592 # define CERT_PHYSICAL_STORE_LOCAL_MACHINE_NAME (const WCHAR[])\
2593  {'.','L','o','c','a','l','M','a','c','h','i','n','e',0}
2594 # define CERT_PHYSICAL_STORE_DS_USER_CERTIFICATE_NAME (const WCHAR[])\
2595  {'.','U','s','e','r','C','e','r','t','i','f','i','c','a','t','e',0}
2596 # define CERT_PHYSICAL_STORE_LOCAL_MACHINE_GROUP_POLICY_NAME (const WCHAR[])\
2597  {'.','L','o','c','a','l','M','a','c','h','i','n','e','G','r','o','u','p',\
2598  'P','o','l','i','c','y',0}
2599 # define CERT_PHYSICAL_STORE_ENTERPRISE_NAME (const WCHAR[])\
2600  {'.','E','n','t','e','r','p','r','i','s','e',0}
2601 # define CERT_PHYSICAL_STORE_AUTH_ROOT_NAME (const WCHAR[])\
2602  {'.','A','u','t','h','R','o','o','t',0}
2603 #elif defined(_MSC_VER)
2604 # define CERT_PHYSICAL_STORE_DEFAULT_NAME \
2605  L".Default"
2606 # define CERT_PHYSICAL_STORE_GROUP_POLICY_NAME \
2607  L".GroupPolicy"
2608 # define CERT_PHYSICAL_STORE_LOCAL_MACHINE_NAME \
2609  L".LocalMachine"
2610 # define CERT_PHYSICAL_STORE_DS_USER_CERTIFICATE_NAME \
2611  L".UserCertificate"
2612 # define CERT_PHYSICAL_STORE_LOCAL_MACHINE_GROUP_POLICY_NAME \
2613  L".LocalMachineGroupPolicy"
2614 # define CERT_PHYSICAL_STORE_ENTERPRISE_NAME \
2615  L".Enterprise"
2616 # define CERT_PHYSICAL_STORE_AUTH_ROOT_NAME \
2617  L".AuthRoot"
2618 #else
2619 static const WCHAR CERT_PHYSICAL_STORE_DEFAULT_NAME[] =
2620  {'.','D','e','f','a','u','l','t','0'};
2621 static const WCHAR CERT_PHYSICAL_STORE_GROUP_POLICY_NAME[] =
2622  {'.','G','r','o','u','p','P','o','l','i','c','y',0};
2623 static const WCHAR CERT_PHYSICAL_STORE_LOCAL_MACHINE_NAME[] =
2624  {'.','L','o','c','a','l','M','a','c','h','i','n','e',0};
2625 static const WCHAR CERT_PHYSICAL_STORE_DS_USER_CERTIFICATE_NAME[] =
2626  {'.','U','s','e','r','C','e','r','t','i','f','i','c','a','t','e',0};
2627 static const WCHAR CERT_PHYSICAL_STORE_LOCAL_MACHINE_GROUP_POLICY_NAME[] =
2628  {'.','L','o','c','a','l','M','a','c','h','i','n','e','G','r','o','u','p',
2629  'P','o','l','i','c','y',0};
2630 static const WCHAR CERT_PHYSICAL_STORE_ENTERPRISE_NAME[] =
2631  {'.','E','n','t','e','r','p','r','i','s','e',0};
2632 static const WCHAR CERT_PHYSICAL_STORE_AUTH_ROOT_NAME[] =
2633  {'.','A','u','t','h','R','o','o','t',0};
2634 #endif
2635 
2636 /* cert system store flags */
2637 #define CERT_SYSTEM_STORE_MASK 0xffff0000
2638 #define CERT_SYSTEM_STORE_RELOCATE_FLAG 0x80000000
2639 
2640 /* CertFindChainInStore dwFindType types */
2641 #define CERT_CHAIN_FIND_BY_ISSUER 1
2642 
2643 /* CertSaveStore dwSaveAs values */
2644 #define CERT_STORE_SAVE_AS_STORE 1
2645 #define CERT_STORE_SAVE_AS_PKCS7 2
2646 /* CertSaveStore dwSaveTo values */
2647 #define CERT_STORE_SAVE_TO_FILE       1
2648 #define CERT_STORE_SAVE_TO_MEMORY     2
2649 #define CERT_STORE_SAVE_TO_FILENAME_A 3
2650 #define CERT_STORE_SAVE_TO_FILENAME_W 4
2651 #define CERT_STORE_SAVE_TO_FILENAME   CERT_STORE_SAVE_TO_FILENAME_W
2652 
2653 /* CERT_INFO versions/flags */
2654 #define CERT_V1 0
2655 #define CERT_V2 1
2656 #define CERT_V3 2
2657 #define CERT_INFO_VERSION_FLAG                 1
2658 #define CERT_INFO_SERIAL_NUMBER_FLAG           2
2659 #define CERT_INFO_SIGNATURE_ALGORITHM_FLAG     3
2660 #define CERT_INFO_ISSUER_FLAG                  4
2661 #define CERT_INFO_NOT_BEFORE_FLAG              5
2662 #define CERT_INFO_NOT_AFTER_FLAG               6
2663 #define CERT_INFO_SUBJECT_FLAG                 7
2664 #define CERT_INFO_SUBJECT_PUBLIC_KEY_INFO_FLAG 8
2665 #define CERT_INFO_ISSUER_UNIQUE_ID_FLAG        9
2666 #define CERT_INFO_SUBJECT_UNIQUE_ID_FLAG       10
2667 #define CERT_INFO_EXTENSION_FLAG               11
2668 
2669 /* CERT_REQUEST_INFO versions */
2670 #define CERT_REQUEST_V1 0
2671 
2672 /* CERT_KEYGEN_REQUEST_INFO versions */
2673 #define CERT_KEYGEN_REQUEST_V1 0
2674 
2675 /* CRL versions */
2676 #define CRL_V1 0
2677 #define CRL_V2 1
2678 
2679 /* CTL versions */
2680 #define CTL_V1 0
2681 
2682 /* Certificate, CRL, CTL property IDs */
2683 #define CERT_KEY_PROV_HANDLE_PROP_ID               1
2684 #define CERT_KEY_PROV_INFO_PROP_ID                 2
2685 #define CERT_SHA1_HASH_PROP_ID                     3
2686 #define CERT_HASH_PROP_ID                          CERT_SHA1_HASH_PROP_ID
2687 #define CERT_MD5_HASH_PROP_ID                      4
2688 #define CERT_KEY_CONTEXT_PROP_ID                   5
2689 #define CERT_KEY_SPEC_PROP_ID                      6
2690 #define CERT_IE30_RESERVED_PROP_ID                 7
2691 #define CERT_PUBKEY_HASH_RESERVED_PROP_ID          8
2692 #define CERT_ENHKEY_USAGE_PROP_ID                  9
2693 #define CERT_CTL_USAGE_PROP_ID                     CERT_ENHKEY_USAGE_PROP_ID
2694 #define CERT_NEXT_UPDATE_LOCATION_PROP_ID          10
2695 #define CERT_FRIENDLY_NAME_PROP_ID                 11
2696 #define CERT_PVK_FILE_PROP_ID                      12
2697 #define CERT_DESCRIPTION_PROP_ID                   13
2698 #define CERT_ACCESS_STATE_PROP_ID                  14
2699 #define CERT_SIGNATURE_HASH_PROP_ID                15
2700 #define CERT_SMART_CARD_DATA_PROP_ID               16
2701 #define CERT_EFS_PROP_ID                           17
2702 #define CERT_FORTEZZA_DATA_PROP                    18
2703 #define CERT_ARCHIVED_PROP_ID                      19
2704 #define CERT_KEY_IDENTIFIER_PROP_ID                20
2705 #define CERT_AUTO_ENROLL_PROP_ID                   21
2706 #define CERT_PUBKEY_ALG_PARA_PROP_ID               22
2707 #define CERT_CROSS_CERT_DIST_POINTS_PROP_ID        23
2708 #define CERT_ISSUER_PUBLIC_KEY_MD5_HASH_PROP_ID    24
2709 #define CERT_SUBJECT_PUBLIC_KEY_MD5_HASH_PROP_ID   25
2710 #define CERT_ENROLLMENT_PROP_ID                    26
2711 #define CERT_DATE_STAMP_PROP_ID                    27
2712 #define CERT_ISSUER_SERIAL_NUMBER_MD5_HASH_PROP_ID 28
2713 #define CERT_SUBJECT_NAME_MD5_HASH_PROP_ID         29
2714 #define CERT_EXTENDED_ERROR_INFO_PROP_ID           30
2715 /* 31    -- unused?
2716    32    -- cert prop id
2717    33    -- CRL prop id
2718    34    -- CTL prop id
2719    35    -- KeyId prop id
2720    36-63 -- reserved
2721  */
2722 #define CERT_RENEWAL_PROP_ID                       64
2723 #define CERT_ARCHIVED_KEY_HASH_PROP_ID             65
2724 #define CERT_AUTO_ENROLL_RETRY_PROP_ID             66
2725 #define CERT_AIA_URL_RETRIEVED_PROP_ID             67
2726 #define CERT_AUTHORITY_INFO_ACCESS_PROP_ID         68
2727 #define CERT_BACKED_UP_PROP_ID                     69
2728 #define CERT_OCSP_RESPONSE_PROP_ID                 70
2729 #define CERT_REQUEST_ORIGINATOR_PROP_ID            71
2730 #define CERT_SOURCE_LOCATION_PROP_ID               72
2731 #define CERT_SOURCE_URL_PROP_ID                    73
2732 #define CERT_NEW_KEY_PROP_ID                       74
2733 #define CERT_OCSP_CACHE_PREFIX_PROP_ID             75
2734 #define CERT_SMART_CARD_ROOT_INFO_PROP_ID          76
2735 #define CERT_NO_AUTO_EXPIRE_CHECK_PROP_ID          77
2736 #define CERT_NCRYPT_KEY_HANDLE_PROP_ID             78
2737 #define CERT_HCRYPTPROV_OR_NCRYPT_KEY_HANDLE_PROP_ID 79
2738 #define CERT_SUBJECT_INFO_ACCESS_PROP_ID           80
2739 #define CERT_CA_OCSP_AUTHORITY_INFO_ACCESS_PROP_ID 81
2740 #define CERT_CA_DISABLE_CRL_PROP_ID                82
2741 #define CERT_ROOT_PROGRAM_CERT_POLICIES_PROP_ID    83
2742 #define CERT_ROOT_PROGRAM_NAME_CONSTRAINTS_PROP_ID 84
2743 
2744 #define CERT_FIRST_RESERVED_PROP_ID                85
2745 #define CERT_LAST_RESERVED_PROP_ID                 0x00007fff
2746 #define CERT_FIRST_USER_PROP_ID                    0x00008000
2747 #define CERT_LAST_USER_PROP_ID                     0x0000ffff
2748 
2749 #define IS_CERT_HASH_PROP_ID(x) \
2750  ((x) == CERT_SHA1_HASH_PROP_ID || (x) == CERT_MD5_HASH_PROP_ID || \
2751   (x) == CERT_SIGNATURE_HASH_PROP_ID)
2752 
2753 #define IS_PUBKEY_HASH_PROP_ID(x) \
2754  ((x) == CERT_ISSUER_PUBLIC_KEY_MD5_HASH_PROP_ID || \
2755   (x) == CERT_SUBJECT_PUBLIC_KEY_MD5_HASH_PROP_ID)
2756 
2757 #define IS_CHAIN_HASH_PROP_ID(x) \
2758  ((x) == CERT_ISSUER_PUBLIC_KEY_MD5_HASH_PROP_ID || \
2759   (x) == CERT_SUBJECT_PUBLIC_KEY_MD5_HASH_PROP_ID || \
2760   (x) == CERT_ISSUER_SERIAL_NUMBER_MD5_HASH_PROP_ID || \
2761   (x) == CERT_SUBJECT_NAME_MD5_HASH_PROP_ID)
2762 
2763 /* access state flags */
2764 #define CERT_ACCESS_STATE_WRITE_PERSIST_FLAG   0x1
2765 #define CERT_ACCESS_STATE_SYSTEM_STORE_FLAG    0x2
2766 #define CERT_ACCESS_STATE_LM_SYSTEM_STORE_FLAG 0x4
2767 
2768 /* CertSetCertificateContextProperty flags */
2769 #define CERT_SET_PROPERTY_INHIBIT_PERSIST_FLAG      0x40000000
2770 #define CERT_SET_PROPERTY_IGNORE_PERSIST_ERROR_FLAG 0x80000000
2771 
2772 /* CERT_RDN attribute dwValueType types */
2773 #define CERT_RDN_TYPE_MASK 0x000000ff
2774 #define CERT_RDN_ANY_TYPE         0
2775 #define CERT_RDN_ENCODED_BLOB     1
2776 #define CERT_RDN_OCTET_STRING     2
2777 #define CERT_RDN_NUMERIC_STRING   3
2778 #define CERT_RDN_PRINTABLE_STRING 4
2779 #define CERT_RDN_TELETEX_STRING   5
2780 #define CERT_RDN_T61_STRING       5
2781 #define CERT_RDN_VIDEOTEX_STRING  6
2782 #define CERT_RDN_IA5_STRING       7
2783 #define CERT_RDN_GRAPHIC_STRING   8
2784 #define CERT_RDN_VISIBLE_STRING   9
2785 #define CERT_RDN_ISO646_STRING    9
2786 #define CERT_RDN_GENERAL_STRING   10
2787 #define CERT_RDN_UNIVERSAL_STRING 11
2788 #define CERT_RDN_INT4_STRING      11
2789 #define CERT_RDN_BMP_STRING       12
2790 #define CERT_RDN_UNICODE_STRING   12
2791 #define CERT_RDN_UTF8_STRING      13
2792 
2793 /* CERT_RDN attribute dwValueType flags */
2794 #define CERT_RDN_FLAGS_MASK 0xff000000
2795 #define CERT_RDN_ENABLE_T61_UNICODE_FLAG  0x80000000
2796 #define CERT_RDN_DISABLE_CHECK_TYPE_FLAG  0x4000000
2797 #define CERT_RDN_ENABLE_UTF8_UNICODE_FLAG 0x2000000
2798 #define CERT_RDN_DISABLE_IE4_UTF8_FLAG    0x0100000
2799 
2800 #define IS_CERT_RDN_CHAR_STRING(x) \
2801  (((x) & CERT_RDN_TYPE_MASK) >= CERT_RDN_NUMERIC_STRING)
2802 
2803 /* CertIsRDNAttrsInCertificateName flags */
2804 #define CERT_UNICODE_IS_RDN_ATTRS_FLAG          0x1
2805 #define CERT_CASE_INSENSITIVE_IS_RDN_ATTRS_FLAG 0x2
2806 
2807 /* CRL reason codes */
2808 #define CRL_REASON_UNSPECIFIED            0
2809 #define CRL_REASON_KEY_COMPROMISE         1
2810 #define CRL_REASON_CA_COMPROMISE          2
2811 #define CRL_REASON_AFFILIATION_CHANGED    3
2812 #define CRL_REASON_SUPERSEDED             4
2813 #define CRL_REASON_CESSATION_OF_OPERATION 5
2814 #define CRL_REASON_CERTIFICATE_HOLD       6
2815 #define CRL_REASON_REMOVE_FROM_CRL        8
2816 
2817 /* CertControlStore control types */
2818 #define CERT_STORE_CTRL_RESYNC        1
2819 #define CERT_STORE_CTRL_NOTIFY_CHANGE 2
2820 #define CERT_STORE_CTRL_COMMIT        3
2821 #define CERT_STORE_CTRL_AUTO_RESYNC   4
2822 #define CERT_STORE_CTRL_CANCEL_NOTIFY 5
2823 
2824 #define CERT_STORE_CTRL_COMMIT_FORCE_FLAG 0x1
2825 #define CERT_STORE_CTRL_COMMIT_CLEAR_FLAG 0x2
2826 
2827 /* cert store properties */
2828 #define CERT_STORE_LOCALIZED_NAME_PROP_ID 0x1000
2829 
2830 /* CertCreateContext flags */
2831 #define CERT_CREATE_CONTEXT_NOCOPY_FLAG       0x1
2832 #define CERT_CREATE_CONTEXT_SORTED_FLAG       0x2
2833 #define CERT_CREATE_CONTEXT_NO_HCRYPTMSG_FLAG 0x4
2834 #define CERT_CREATE_CONTEXT_NO_ENTRY_FLAG     0x8
2835 
2836 #define CERT_COMPARE_MASK                   0xffff
2837 #define CERT_COMPARE_SHIFT                  16
2838 #define CERT_COMPARE_ANY                    0
2839 #define CERT_COMPARE_SHA1_HASH              1
2840 #define CERT_COMPARE_HASH                   CERT_COMPARE_SHA1_HASH
2841 #define CERT_COMPARE_NAME                   2
2842 #define CERT_COMPARE_ATTR                   3
2843 #define CERT_COMPARE_MD5_HASH               4
2844 #define CERT_COMPARE_PROPERTY               5
2845 #define CERT_COMPARE_PUBLIC_KEY             6
2846 #define CERT_COMPARE_NAME_STR_A             7
2847 #define CERT_COMPARE_NAME_STR_W             8
2848 #define CERT_COMPARE_KEY_SPEC               9
2849 #define CERT_COMPARE_ENHKEY_USAGE           10
2850 #define CERT_COMPARE_CTL_USAGE              CERT_COMPARE_ENHKEY_USAGE
2851 #define CERT_COMPARE_SUBJECT_CERT           11
2852 #define CERT_COMPARE_ISSUER_OF              12
2853 #define CERT_COMPARE_EXISTING               13
2854 #define CERT_COMPARE_SIGNATURE_HASH         14
2855 #define CERT_COMPARE_KEY_IDENTIFIER         15
2856 #define CERT_COMPARE_CERT_ID                16
2857 #define CERT_COMPARE_CROSS_CERT_DIST_POINTS 17
2858 #define CERT_COMPARE_PUBKEY_MD5_HASH        18
2859 
2860 /* values of dwFindType for CertFind*InStore */
2861 #define CERT_FIND_ANY \
2862  (CERT_COMPARE_ANY << CERT_COMPARE_SHIFT)
2863 #define CERT_FIND_SHA1_HASH \
2864  (CERT_COMPARE_SHA1_HASH << CERT_COMPARE_SHIFT)
2865 #define CERT_FIND_MD5_HASH \
2866  (CERT_COMPARE_MD5_HASH << CERT_COMPARE_SHIFT)
2867 #define CERT_FIND_SIGNATURE_HASH \
2868  (CERT_COMPARE_SIGNATURE_HASH << CERT_COMPARE_SHIFT)
2869 #define CERT_FIND_KEY_IDENTIFIER \
2870  (CERT_COMPARE_KEY_IDENTIFIER << CERT_COMPARE_SHIFT)
2871 #define CERT_FIND_HASH CERT_FIND_SHA1_HASH
2872 #define CERT_FIND_PROPERTY \
2873  (CERT_COMPARE_PROPERTY << CERT_COMPARE_SHIFT)
2874 #define CERT_FIND_PUBLIC_KEY \
2875  (CERT_COMPARE_PUBLIC_KEY << CERT_COMPARE_SHIFT)
2876 #define CERT_FIND_SUBJECT_NAME \
2877  (CERT_COMPARE_NAME << CERT_COMPARE_SHIFT | CERT_INFO_SUBJECT_FLAG)
2878 #define CERT_FIND_SUBJECT_ATTR \
2879  (CERT_COMPARE_ATTR << CERT_COMPARE_SHIFT | CERT_INFO_SUBJECT_FLAG)
2880 #define CERT_FIND_ISSUER_NAME \
2881  (CERT_COMPARE_NAME << CERT_COMPARE_SHIFT | CERT_INFO_ISSUER_FLAG)
2882 #define CERT_FIND_ISSUER_ATTR \
2883  (CERT_COMPARE_ATTR << CERT_COMPARE_SHIFT | CERT_INFO_ISSUER_FLAG)
2884 #define CERT_FIND_SUBJECT_STR_A \
2885  (CERT_COMPARE_NAME_STR_A << CERT_COMPARE_SHIFT | CERT_INFO_SUBJECT_FLAG)
2886 #define CERT_FIND_SUBJECT_STR_W \
2887  (CERT_COMPARE_NAME_STR_W << CERT_COMPARE_SHIFT | CERT_INFO_SUBJECT_FLAG)
2888 #define CERT_FIND_SUBJECT_STR CERT_FIND_SUBJECT_STR_W
2889 #define CERT_FIND_ISSUER_STR_A \
2890  (CERT_COMPARE_NAME_STR_A << CERT_COMPARE_SHIFT | CERT_INFO_ISSUER_FLAG)
2891 #define CERT_FIND_ISSUER_STR_W \
2892  (CERT_COMPARE_NAME_STR_W << CERT_COMPARE_SHIFT | CERT_INFO_ISSUER_FLAG)
2893 #define CERT_FIND_ISSUER_STR CERT_FIND_ISSUER_STR_W
2894 #define CERT_FIND_KEY_SPEC \
2895  (CERT_COMPARE_KEY_SPEC << CERT_COMPARE_SHIFT)
2896 #define CERT_FIND_ENHKEY_USAGE \
2897  (CERT_COMPARE_ENHKEY_USAGE << CERT_COMPARE_SHIFT)
2898 #define CERT_FIND_CTL_USAGE CERT_FIND_ENHKEY_USAGE
2899 #define CERT_FIND_SUBJECT_CERT \
2900  (CERT_COMPARE_SUBJECT_CERT << CERT_COMPARE_SHIFT)
2901 #define CERT_FIND_ISSUER_OF \
2902  (CERT_COMPARE_ISSUER_OF << CERT_COMPARE_SHIFT)
2903 #define CERT_FIND_EXISTING \
2904  (CERT_COMPARE_EXISTING << CERT_COMPARE_SHIFT)
2905 #define CERT_FIND_CERT_ID \
2906  (CERT_COMPARE_CERT_ID << CERT_COMPARE_SHIFT)
2907 #define CERT_FIND_CROSS_CERT_DIST_POINTS \
2908  (CERT_COMPARE_CROSS_CERT_DIST_POINTS << CERT_COMPARE_SHIFT)
2909 #define CERT_FIND_PUBKEY_MD5_HASH \
2910  (CERT_COMPARE_PUBKEY_MD5_HASH << CERT_COMPARE_SHIFT)
2911 
2912 #define CERT_FIND_OPTIONAL_ENHKEY_USAGE_FLAG  0x1
2913 #define CERT_FIND_OPTIONAL_CTL_USAGE_FLAG     0x1
2914 #define CERT_FIND_EXT_ONLY_ENHKEY_USAGE_FLAG  0x2
2915 #define CERT_FIND_EXT_ONLY_CTL_USAGE_FLAG     0x2
2916 #define CERT_FIND_PROP_ONLY_ENHKEY_USAGE_FLAG 0x4
2917 #define CERT_FIND_PROP_ONLY_CTL_USAGE_FLAG    0x4
2918 #define CERT_FIND_NO_ENHKEY_USAGE_FLAG        0x8
2919 #define CERT_FIND_NO_CTL_USAGE_FLAG           0x8
2920 #define CERT_FIND_OR_ENHKEY_USAGE_FLAG        0x10
2921 #define CERT_FIND_OR_CTL_USAGE_FLAG           0x10
2922 #define CERT_FIND_VALID_ENHKEY_USAGE_FLAG     0x20
2923 #define CERT_FIND_VALID_CTL_USAGE_FLAG        0x20
2924 
2925 #define CRL_FIND_ANY        0
2926 #define CRL_FIND_ISSUED_BY  1
2927 #define CRL_FIND_EXISTING   2
2928 #define CRL_FIND_ISSUED_FOR 3
2929 
2930 #define CRL_FIND_ISSUED_BY_AKI_FLAG       0x1
2931 #define CRL_FIND_ISSUED_BY_SIGNATURE_FLAG 0x2
2932 #define CRL_FIND_ISSUED_BY_DELTA_FLAG     0x4
2933 #define CRL_FIND_ISSUED_BY_BASE_FLAG      0x8
2934 
2935 typedef struct _CRL_FIND_ISSUED_FOR_PARA
2936 {
2937     PCCERT_CONTEXT pSubjectCert;
2938     PCCERT_CONTEXT pIssuerCert;
2939 } CRL_FIND_ISSUED_FOR_PARA, *PCRL_FIND_ISSUED_FOR_PARA;
2940 
2941 #define CTL_FIND_ANY       0
2942 #define CTL_FIND_SHA1_HASH 1
2943 #define CTL_FIND_MD5_HASH  2
2944 #define CTL_FIND_USAGE     3
2945 #define CTL_FIND_SUBJECT   4
2946 #define CTL_FIND_EXISTING  5
2947 
2948 typedef struct _CTL_FIND_USAGE_PARA
2949 {
2950     DWORD           cbSize;
2951     CTL_USAGE       SubjectUsage;
2952     CRYPT_DATA_BLOB ListIdentifier;
2953     PCERT_INFO      pSigner;
2954 } CTL_FIND_USAGE_PARA, *PCTL_FIND_USAGE_PARA;
2955 
2956 #define CTL_FIND_NO_LIST_ID_CBDATA 0xffffffff
2957 #define CTL_FIND_NO_SIGNER_PTR     ((PCERT_INFO)-1)
2958 #define CTL_FIND_SAME_USAGE_FLAG   0x00000001
2959 
2960 typedef struct _CTL_FIND_SUBJECT_PARA
2961 {
2962     DWORD                cbSize;
2963     PCTL_FIND_USAGE_PARA pUsagePara;
2964     DWORD                dwSubjectType;
2965     void                *pvSubject;
2966 } CTL_FIND_SUBJECT_PARA, *PCTL_FIND_SUBJECT_PARA;
2967 
2968 /* PFN_CERT_STORE_PROV_WRITE_CERT dwFlags values */
2969 #define CERT_STORE_PROV_WRITE_ADD_FLAG 0x1
2970 
2971 /* CertAddSerializedElementToStore context types */
2972 #define CERT_STORE_CERTIFICATE_CONTEXT 1
2973 #define CERT_STORE_CRL_CONTEXT         2
2974 #define CERT_STORE_CTL_CONTEXT         3
2975 #define CERT_STORE_ALL_CONTEXT_FLAG    ~0U
2976 #define CERT_STORE_CERTIFICATE_CONTEXT_FLAG \
2977                                     (1 << CERT_STORE_CERTIFICATE_CONTEXT)
2978 #define CERT_STORE_CRL_CONTEXT_FLAG (1 << CERT_STORE_CRL_CONTEXT)
2979 #define CERT_STORE_CTL_CONTEXT_FLAG (1 << CERT_STORE_CTL_CONTEXT)
2980 
2981 /* CryptBinaryToString/CryptStringToBinary flags */
2982 #define CRYPT_STRING_BASE64HEADER        0x00000000
2983 #define CRYPT_STRING_BASE64              0x00000001
2984 #define CRYPT_STRING_BINARY              0x00000002
2985 #define CRYPT_STRING_BASE64REQUESTHEADER 0x00000003
2986 #define CRYPT_STRING_HEX                 0x00000004
2987 #define CRYPT_STRING_HEXASCII            0x00000005
2988 #define CRYPT_STRING_BASE64_ANY          0x00000006
2989 #define CRYPT_STRING_ANY                 0x00000007
2990 #define CRYPT_STRING_HEX_ANY             0x00000008
2991 #define CRYPT_STRING_BASE64X509CRLHEADER 0x00000009
2992 #define CRYPT_STRING_HEXADDR             0x0000000a
2993 #define CRYPT_STRING_HEXASCIIADDR        0x0000000b
2994 #define CRYPT_STRING_NOCRLF              0x40000000
2995 #define CRYPT_STRING_NOCR                0x80000000
2996 
2997 /* OIDs */
2998 #define szOID_RSA                           "1.2.840.113549"
2999 #define szOID_PKCS                          "1.2.840.113549.1"
3000 #define szOID_RSA_HASH                      "1.2.840.113549.2"
3001 #define szOID_RSA_ENCRYPT                   "1.2.840.113549.3"
3002 #define szOID_PKCS_1                        "1.2.840.113549.1.1"
3003 #define szOID_PKCS_2                        "1.2.840.113549.1.2"
3004 #define szOID_PKCS_3                        "1.2.840.113549.1.3"
3005 #define szOID_PKCS_4                        "1.2.840.113549.1.4"
3006 #define szOID_PKCS_5                        "1.2.840.113549.1.5"
3007 #define szOID_PKCS_6                        "1.2.840.113549.1.6"
3008 #define szOID_PKCS_7                        "1.2.840.113549.1.7"
3009 #define szOID_PKCS_8                        "1.2.840.113549.1.8"
3010 #define szOID_PKCS_9                        "1.2.840.113549.1.9"
3011 #define szOID_PKCS_10                       "1.2.840.113549.1.10"
3012 #define szOID_PKCS_11                       "1.2.840.113549.1.12"
3013 #define szOID_RSA_RSA                       "1.2.840.113549.1.1.1"
3014 #define CERT_RSA_PUBLIC_KEY_OBJID           szOID_RSA_RSA
3015 #define CERT_DEFAULT_OID_PUBLIC_KEY_SIGN    szOID_RSA_RSA
3016 #define CERT_DEFAULT_OID_PUBLIC_KEY_XCHG    szOID_RSA_RSA
3017 #define szOID_RSA_MD2RSA                    "1.2.840.113549.1.1.2"
3018 #define szOID_RSA_MD4RSA                    "1.2.840.113549.1.1.3"
3019 #define szOID_RSA_MD5RSA                    "1.2.840.113549.1.1.4"
3020 #define szOID_RSA_SHA1RSA                   "1.2.840.113549.1.1.5"
3021 #define szOID_RSA_SET0AEP_RSA               "1.2.840.113549.1.1.6"
3022 #define szOID_RSA_SHA256RSA                 "1.2.840.113549.1.1.11"
3023 #define szOID_RSA_SHA384RSA                 "1.2.840.113549.1.1.12"
3024 #define szOID_RSA_SHA512RSA                 "1.2.840.113549.1.1.13"
3025 #define szOID_RSA_DH                        "1.2.840.113549.1.3.1"
3026 #define szOID_RSA_data                      "1.2.840.113549.1.7.1"
3027 #define szOID_RSA_signedData                "1.2.840.113549.1.7.2"
3028 #define szOID_RSA_envelopedData             "1.2.840.113549.1.7.3"
3029 #define szOID_RSA_signEnvData               "1.2.840.113549.1.7.4"
3030 #define szOID_RSA_digestedData              "1.2.840.113549.1.7.5"
3031 #define szOID_RSA_hashedData                "1.2.840.113549.1.7.5"
3032 #define szOID_RSA_encryptedData             "1.2.840.113549.1.7.6"
3033 #define szOID_RSA_emailAddr                 "1.2.840.113549.1.9.1"
3034 #define szOID_RSA_unstructName              "1.2.840.113549.1.9.2"
3035 #define szOID_RSA_contentType               "1.2.840.113549.1.9.3"
3036 #define szOID_RSA_messageDigest             "1.2.840.113549.1.9.4"
3037 #define szOID_RSA_signingTime               "1.2.840.113549.1.9.5"
3038 #define szOID_RSA_counterSign               "1.2.840.113549.1.9.6"
3039 #define szOID_RSA_challengePwd              "1.2.840.113549.1.9.7"
3040 #define szOID_RSA_unstructAddr              "1.2.840.113549.1.9.9"
3041 #define szOID_RSA_extCertAttrs              "1.2.840.113549.1.9.9"
3042 #define szOID_RSA_certExtensions            "1.2.840.113549.1.9.14"
3043 #define szOID_RSA_SMIMECapabilities         "1.2.840.113549.1.9.15"
3044 #define szOID_RSA_preferSignedData          "1.2.840.113549.1.9.15.1"
3045 #define szOID_RSA_SMIMEalg                  "1.2.840.113549.1.9.16.3"
3046 #define szOID_RSA_SMIMEalgESDH              "1.2.840.113549.1.9.16.3.5"
3047 #define szOID_RSA_SMIMEalgCMS3DESwrap       "1.2.840.113549.1.9.16.3.6"
3048 #define szOID_RSA_SMIMEalgCMSRC2wrap        "1.2.840.113549.1.9.16.3.7"
3049 #define szOID_RSA_MD2                       "1.2.840.113549.2.2"
3050 #define szOID_RSA_MD4                       "1.2.840.113549.2.4"
3051 #define szOID_RSA_MD5                       "1.2.840.113549.2.5"
3052 #define szOID_RSA_RC2CBC                    "1.2.840.113549.3.2"
3053 #define szOID_RSA_RC4                       "1.2.840.113549.3.4"
3054 #define szOID_RSA_DES_EDE3_CBC              "1.2.840.113549.3.7"
3055 #define szOID_RSA_RC5_CBCPad                "1.2.840.113549.3.9"
3056 #define szOID_ANSI_X942                     "1.2.840.10046"
3057 #define szOID_ANSI_X942_DH                  "1.2.840.10046.2.1"
3058 #define szOID_X957                          "1.2.840.10040"
3059 #define szOID_X957_DSA                      "1.2.840.10040.4.1"
3060 #define szOID_X957_SHA1DSA                  "1.2.840.10040.4.3"
3061 #define szOID_ECC_PUBLIC_KEY                "1.2.840.10045.2.1"
3062 #define szOID_ECC_CURVE_P256                "1.2.840.10045.3.1.7"
3063 #define szOID_ECDSA_SPECIFIED               "1.2.840.10045.4.3"
3064 #define szOID_ECDSA_SHA256                  "1.2.840.10045.4.3.2"
3065 #define szOID_ECDSA_SHA384                  "1.2.840.10045.4.3.3"
3066 #define szOID_ECDSA_SHA512                  "1.2.840.10045.4.3.4"
3067 #define szOID_DS                            "2.5"
3068 #define szOID_DSALG                         "2.5.8"
3069 #define szOID_DSALG_CRPT                    "2.5.8.1"
3070 #define szOID_DSALG_HASH                    "2.5.8.2"
3071 #define szOID_DSALG_SIGN                    "2.5.8.3"
3072 #define szOID_DSALG_RSA                     "2.5.8.1.1"
3073 #define szOID_OIW                           "1.3.14"
3074 #define szOID_OIWSEC                        "1.3.14.3.2"
3075 #define szOID_OIWSEC_md4RSA                 "1.3.14.3.2.2"
3076 #define szOID_OIWSEC_md5RSA                 "1.3.14.3.2.3"
3077 #define szOID_OIWSEC_md4RSA2                "1.3.14.3.2.4"
3078 #define szOID_OIWSEC_desECB                 "1.3.14.3.2.6"
3079 #define szOID_OIWSEC_desCBC                 "1.3.14.3.2.7"
3080 #define szOID_OIWSEC_desOFB                 "1.3.14.3.2.8"
3081 #define szOID_OIWSEC_desCFB                 "1.3.14.3.2.9"
3082 #define szOID_OIWSEC_desMAC                 "1.3.14.3.2.10"
3083 #define szOID_OIWSEC_rsaSign                "1.3.14.3.2.11"
3084 #define szOID_OIWSEC_dsa                    "1.3.14.3.2.12"
3085 #define szOID_OIWSEC_shaDSA                 "1.3.14.3.2.13"
3086 #define szOID_OIWSEC_mdc2RSA                "1.3.14.3.2.14"
3087 #define szOID_OIWSEC_shaRSA                 "1.3.14.3.2.15"
3088 #define szOID_OIWSEC_dhCommMod              "1.3.14.3.2.16"
3089 #define szOID_OIWSEC_desEDE                 "1.3.14.3.2.17"
3090 #define szOID_OIWSEC_sha                    "1.3.14.3.2.18"
3091 #define szOID_OIWSEC_mdc2                   "1.3.14.3.2.19"
3092 #define szOID_OIWSEC_dsaComm                "1.3.14.3.2.20"
3093 #define szOID_OIWSEC_dsaCommSHA             "1.3.14.3.2.21"
3094 #define szOID_OIWSEC_rsaXchg                "1.3.14.3.2.22"
3095 #define szOID_OIWSEC_keyHashSeal            "1.3.14.3.2.23"
3096 #define szOID_OIWSEC_md2RSASign             "1.3.14.3.2.24"
3097 #define szOID_OIWSEC_md5RSASign             "1.3.14.3.2.25"
3098 #define szOID_OIWSEC_sha1                   "1.3.14.3.2.26"
3099 #define szOID_OIWSEC_dsaSHA1                "1.3.14.3.2.27"
3100 #define szOID_OIWSEC_dsaCommSHA1            "1.3.14.3.2.28"
3101 #define szOID_OIWSEC_sha1RSASign            "1.3.14.3.2.29"
3102 #define szOID_OIWDIR                        "1.3.14.7.2"
3103 #define szOID_OIWDIR_CRPT                   "1.3.14.7.2.1"
3104 #define szOID_OIWDIR_HASH                   "1.3.14.7.2.2"
3105 #define szOID_OIWDIR_SIGN                   "1.3.14.7.2.3"
3106 #define szOID_OIWDIR_md2                    "1.3.14.7.2.2.1"
3107 #define szOID_OIWDIR_md2RSA                 "1.3.14.7.2.3.1"
3108 #define szOID_ECC_CURVE_P384                "1.3.132.0.34"
3109 #define szOID_ECC_CURVE_P521                "1.3.132.0.35"
3110 #define szOID_INFOSEC                       "2.16.840.1.101.2.1"
3111 #define szOID_INFOSEC_sdnsSignature         "2.16.840.1.101.2.1.1.1"
3112 #define szOID_INFOSEC_mosaicSignature       "2.16.840.1.101.2.1.1.2"
3113 #define szOID_INFOSEC_sdnsConfidentiality   "2.16.840.1.101.2.1.1.3"
3114 #define szOID_INFOSEC_mosaicConfidentiality "2.16.840.1.101.2.1.1.4"
3115 #define szOID_INFOSEC_sdnsIntegrity         "2.16.840.1.101.2.1.1.5"
3116 #define szOID_INFOSEC_mosaicIntegrity       "2.16.840.1.101.2.1.1.6"
3117 #define szOID_INFOSEC_sdnsTokenProtection   "2.16.840.1.101.2.1.1.7"
3118 #define szOID_INFOSEC_mosaicTokenProtection "2.16.840.1.101.2.1.1.8"
3119 #define szOID_INFOSEC_sdnsKeyManagement     "2.16.840.1.101.2.1.1.9"
3120 #define szOID_INFOSEC_mosaicKeyManagement   "2.16.840.1.101.2.1.1.10"
3121 #define szOID_INFOSEC_sdnsKMandSig          "2.16.840.1.101.2.1.1.11"
3122 #define szOID_INFOSEC_mosaicKMandSig        "2.16.840.1.101.2.1.1.12"
3123 #define szOID_INFOSEC_SuiteASignature       "2.16.840.1.101.2.1.1.13"
3124 #define szOID_INFOSEC_SuiteAConfidentiality "2.16.840.1.101.2.1.1.14"
3125 #define szOID_INFOSEC_SuiteAIntegrity       "2.16.840.1.101.2.1.1.15"
3126 #define szOID_INFOSEC_SuiteATokenProtection "2.16.840.1.101.2.1.1.16"
3127 #define szOID_INFOSEC_SuiteAKeyManagement   "2.16.840.1.101.2.1.1.17"
3128 #define szOID_INFOSEC_SuiteAKMandSig        "2.16.840.1.101.2.1.1.18"
3129 #define szOID_INFOSEC_mosaicUpdatedSig      "2.16.840.1.101.2.1.1.19"
3130 #define szOID_INFOSEC_mosaicKMandUpdSig     "2.16.840.1.101.2.1.1.20"
3131 #define szOID_INFOSEC_mosaicUpdateInteg     "2.16.840.1.101.2.1.1.21"
3132 #define szOID_COMMON_NAME                   "2.5.4.3"
3133 #define szOID_SUR_NAME                      "2.5.4.4"
3134 #define szOID_DEVICE_SERIAL_NUMBER          "2.5.4.5"
3135 #define szOID_COUNTRY_NAME                  "2.5.4.6"
3136 #define szOID_LOCALITY_NAME                 "2.5.4.7"
3137 #define szOID_STATE_OR_PROVINCE_NAME        "2.5.4.8"
3138 #define szOID_STREET_ADDRESS                "2.5.4.9"
3139 #define szOID_ORGANIZATION_NAME             "2.5.4.10"
3140 #define szOID_ORGANIZATIONAL_UNIT_NAME      "2.5.4.11"
3141 #define szOID_TITLE                         "2.5.4.12"
3142 #define szOID_DESCRIPTION                   "2.5.4.13"
3143 #define szOID_SEARCH_GUIDE                  "2.5.4.14"
3144 #define szOID_BUSINESS_CATEGORY             "2.5.4.15"
3145 #define szOID_POSTAL_ADDRESS                "2.5.4.16"
3146 #define szOID_POSTAL_CODE                   "2.5.4.17"
3147 #define szOID_POST_OFFICE_BOX               "2.5.4.18"
3148 #define szOID_PHYSICAL_DELIVERY_OFFICE_NAME "2.5.4.19"
3149 #define szOID_TELEPHONE_NUMBER              "2.5.4.20"
3150 #define szOID_TELEX_NUMBER                  "2.5.4.21"
3151 #define szOID_TELETEXT_TERMINAL_IDENTIFIER  "2.5.4.22"
3152 #define szOID_FACSIMILE_TELEPHONE_NUMBER    "2.5.4.23"
3153 #define szOID_X21_ADDRESS                   "2.5.4.24"
3154 #define szOID_INTERNATIONAL_ISDN_NUMBER     "2.5.4.25"
3155 #define szOID_REGISTERED_ADDRESS            "2.5.4.26"
3156 #define szOID_DESTINATION_INDICATOR         "2.5.4.27"
3157 #define szOID_PREFERRED_DELIVERY_METHOD     "2.5.4.28"
3158 #define szOID_PRESENTATION_ADDRESS          "2.5.4.29"
3159 #define szOID_SUPPORTED_APPLICATION_CONTEXT "2.5.4.30"
3160 #define szOID_MEMBER                        "2.5.4.31"
3161 #define szOID_OWNER                         "2.5.4.32"
3162 #define szOID_ROLE_OCCUPANT                 "2.5.4.33"
3163 #define szOID_SEE_ALSO                      "2.5.4.34"
3164 #define szOID_USER_PASSWORD                 "2.5.4.35"
3165 #define szOID_USER_CERTIFICATE              "2.5.4.36"
3166 #define szOID_CA_CERTIFICATE                "2.5.4.37"
3167 #define szOID_AUTHORITY_REVOCATION_LIST     "2.5.4.38"
3168 #define szOID_CERTIFICATE_REVOCATION_LIST   "2.5.4.39"
3169 #define szOID_CROSS_CERTIFICATE_PAIR        "2.5.4.40"
3170 #define szOID_GIVEN_NAME                    "2.5.4.42"
3171 #define szOID_INITIALS                      "2.5.4.43"
3172 #define szOID_DN_QUALIFIER                  "2.5.4.46"
3173 #define szOID_AUTHORITY_KEY_IDENTIFIER      "2.5.29.1"
3174 #define szOID_KEY_ATTRIBUTES                "2.5.29.2"
3175 #define szOID_CERT_POLICIES_95              "2.5.29.3"
3176 #define szOID_KEY_USAGE_RESTRICTION         "2.5.29.4"
3177 #define szOID_LEGACY_POLICY_MAPPINGS        "2.5.29.5"
3178 #define szOID_SUBJECT_ALT_NAME              "2.5.29.7"
3179 #define szOID_ISSUER_ALT_NAME               "2.5.29.8"
3180 #define szOID_SUBJECT_DIR_ATTRS             "2.5.29.9"
3181 #define szOID_BASIC_CONSTRAINTS             "2.5.29.10"
3182 #define szOID_SUBJECT_KEY_IDENTIFIER        "2.5.29.14"
3183 #define szOID_KEY_USAGE                     "2.5.29.15"
3184 #define szOID_PRIVATEKEY_USAGE_PERIOD       "2.5.29.16"
3185 #define szOID_SUBJECT_ALT_NAME2             "2.5.29.17"
3186 #define szOID_ISSUER_ALT_NAME2              "2.5.29.18"
3187 #define szOID_BASIC_CONSTRAINTS2            "2.5.29.19"
3188 #define szOID_CRL_NUMBER                    "2.5.29.20"
3189 #define szOID_CRL_REASON_CODE               "2.5.29.21"
3190 #define szOID_REASON_CODE_HOLD              "2.5.29.23"
3191 #define szOID_DELTA_CRL_INDICATOR           "2.5.29.27"
3192 #define szOID_ISSUING_DIST_POINT            "2.5.29.28"
3193 #define szOID_NAME_CONSTRAINTS              "2.5.29.30"
3194 #define szOID_CRL_DIST_POINTS               "2.5.29.31"
3195 #define szOID_CERT_POLICIES                 "2.5.29.32"
3196 #define szOID_ANY_CERT_POLICY               "2.5.29.32.0"
3197 #define szOID_POLICY_MAPPINGS               "2.5.29.33"
3198 #define szOID_AUTHORITY_KEY_IDENTIFIER2     "2.5.29.35"
3199 #define szOID_POLICY_CONSTRAINTS            "2.5.29.36"
3200 #define szOID_ENHANCED_KEY_USAGE            "2.5.29.37"
3201 #define szOID_FRESHEST_CRL                  "2.5.29.46"
3202 #define szOID_INHIBIT_ANY_POLICY            "2.5.29.54"
3203 #define szOID_DOMAIN_COMPONENT              "0.9.2342.19200300.100.1.25"
3204 #define szOID_PKCS_12_FRIENDLY_NAME_ATTR     "1.2.840.113549.1.9.20"
3205 #define szOID_PKCS_12_LOCAL_KEY_ID           "1.2.840.113549.1.9.21"
3206 #define szOID_CERT_EXTENSIONS                "1.3.6.1.4.1.311.2.1.14"
3207 #define szOID_NEXT_UPDATE_LOCATION           "1.3.6.1.4.1.311.10.2"
3208 #define szOID_KP_CTL_USAGE_SIGNING           "1.3.6.1.4.1.311.10.3.1"
3209 #define szOID_KP_TIME_STAMP_SIGNING          "1.3.6.1.4.1.311.10.3.2"
3210 #ifndef szOID_SERVER_GATED_CRYPTO
3211 #define szOID_SERVER_GATED_CRYPTO            "1.3.6.1.4.1.311.10.3.3"
3212 #endif
3213 #ifndef szOID_SGC_NETSCAPE
3214 #define szOID_SGC_NETSCAPE                   "2.16.840.1.113730.4.1"
3215 #endif
3216 #define szOID_KP_EFS                         "1.3.6.1.4.1.311.10.3.4"
3217 #define szOID_EFS_RECOVERY                   "1.3.6.1.4.1.311.10.3.4.1"
3218 #define szOID_WHQL_CRYPTO                    "1.3.6.1.4.1.311.10.3.5"
3219 #define szOID_NT5_CRYPTO                     "1.3.6.1.4.1.311.10.3.6"
3220 #define szOID_OEM_WHQL_CRYPTO                "1.3.6.1.4.1.311.10.3.7"
3221 #define szOID_EMBEDDED_NT_CRYPTO             "1.3.6.1.4.1.311.10.3.8"
3222 #define szOID_ROOT_LIST_SIGNER               "1.3.6.1.4.1.311.10.3.9"
3223 #define szOID_KP_QUALIFIED_SUBORDINATION     "1.3.6.1.4.1.311.10.3.10"
3224 #define szOID_KP_KEY_RECOVERY                "1.3.6.1.4.1.311.10.3.11"
3225 #define szOID_KP_DOCUMENT_SIGNING            "1.3.6.1.4.1.311.10.3.12"
3226 #define szOID_KP_LIFETIME_SIGNING            "1.3.6.1.4.1.311.10.3.13"
3227 #define szOID_KP_MOBILE_DEVICE_SOFTWARE      "1.3.6.1.4.1.311.10.3.14"
3228 #define szOID_YESNO_TRUST_ATTR               "1.3.6.1.4.1.311.10.4.1"
3229 #ifndef szOID_DRM
3230 #define szOID_DRM                            "1.3.6.1.4.1.311.10.5.1"
3231 #endif
3232 #ifndef szOID_DRM_INDIVIDUALIZATION
3233 #define szOID_DRM_INDIVIDUALIZATION          "1.3.6.1.4.1.311.10.5.2"
3234 #endif
3235 #ifndef szOID_LICENSES
3236 #define szOID_LICENSES                       "1.3.6.1.4.1.311.10.6.1"
3237 #endif
3238 #ifndef szOID_LICENSE_SERVER
3239 #define szOID_LICENSE_SERVER                 "1.3.6.1.4.1.311.10.6.2"
3240 #endif
3241 #define szOID_REMOVE_CERTIFICATE             "1.3.6.1.4.1.311.10.8.1"
3242 #define szOID_CROSS_CERT_DIST_POINTS         "1.3.6.1.4.1.311.10.9.1"
3243 #define szOID_CTL                            "1.3.6.1.4.1.311.10.1"
3244 #define szOID_SORTED_CTL                     "1.3.6.1.4.1.311.10.1.1"
3245 #define szOID_ANY_APPLICATION_POLICY         "1.3.6.1.4.1.311.10.12.1"
3246 #define szOID_RENEWAL_CERTIFICATE            "1.3.6.1.4.1.311.13.1"
3247 #define szOID_ENROLLMENT_NAME_VALUE_PAIR     "1.3.6.1.4.1.311.13.2.1"
3248 #define szOID_ENROLLMENT_CSP_PROVIDER        "1.3.6.1.4.1.311.13.2.2"
3249 #define szOID_OS_VERSION                     "1.3.6.1.4.1.311.13.2.3"
3250 #define szOID_PKCS_12_KEY_PROVIDER_NAME_ATTR "1.3.6.1.4.1.311.17.1"
3251 #define szOID_LOCAL_MACHINE_KEYSET           "1.3.6.1.4.1.311.17.2"
3252 #define szOID_AUTO_ENROLL_CTL_USAGE          "1.3.6.1.4.1.311.20.1"
3253 #define szOID_ENROLL_CERTTYPE_EXTENSION      "1.3.6.1.4.1.311.20.2"
3254 #define szOID_ENROLLMENT_AGENT               "1.3.6.1.4.1.311.20.2.1"
3255 #ifndef szOID_KP_SMARTCARD_LOGON
3256 #define szOID_KP_SMARTCARD_LOGON             "1.3.6.1.4.1.311.20.2.2"
3257 #endif
3258 #ifndef szOID_NT_PRINCIPAL_NAME
3259 #define szOID_NT_PRINCIPAL_NAME              "1.3.6.1.4.1.311.20.2.3"
3260 #endif
3261 #define szOID_CERT_MANIFOLD                  "1.3.6.1.4.1.311.20.3"
3262 #ifndef szOID_CERTSRV_CA_VERSION
3263 #define szOID_CERTSRV_CA_VERSION             "1.3.6.1.4.1.311.21.1"
3264 #endif
3265 #define szOID_CERTSRV_PREVIOUS_CERT_HASH     "1.3.6.1.4.1.311.21.2"
3266 #define szOID_CRL_VIRTUAL_BASE               "1.3.6.1.4.1.311.21.3"
3267 #define szOID_CRL_NEXT_PUBLISH               "1.3.6.1.4.1.311.21.4"
3268 #define szOID_KP_CA_EXCHANGE                 "1.3.6.1.4.1.311.21.5"
3269 #define szOID_KP_KEY_RECOVERY_AGENT          "1.3.6.1.4.1.311.21.6"
3270 #define szOID_CERTIFICATE_TEMPLATE           "1.3.6.1.4.1.311.21.7"
3271 #define szOID_ENTERPRISE_OID_ROOT            "1.3.6.1.4.1.311.21.8"
3272 #define szOID_RDN_DUMMY_SIGNER               "1.3.6.1.4.1.311.21.9"
3273 #define szOID_APPLICATION_CERT_POLICIES      "1.3.6.1.4.1.311.21.10"
3274 #define szOID_APPLICATION_POLICY_MAPPINGS    "1.3.6.1.4.1.311.21.11"
3275 #define szOID_APPLICATION_POLICY_CONSTRAINTS "1.3.6.1.4.1.311.21.12"
3276 #define szOID_ARCHIVED_KEY_ATTR              "1.3.6.1.4.1.311.21.13"
3277 #define szOID_CRL_SELF_CDP                   "1.3.6.1.4.1.311.21.14"
3278 #define szOID_REQUIRE_CERT_CHAIN_POLICY      "1.3.6.1.4.1.311.21.15"
3279 #define szOID_ARCHIVED_KEY_CERT_HASH         "1.3.6.1.4.1.311.21.16"
3280 #define szOID_ISSUED_CERT_HASH               "1.3.6.1.4.1.311.21.17"
3281 #define szOID_DS_EMAIL_REPLICATION           "1.3.6.1.4.1.311.21.19"
3282 #define szOID_REQUEST_CLIENT_INFO            "1.3.6.1.4.1.311.21.20"
3283 #define szOID_ENCRYPTED_KEY_HASH             "1.3.6.1.4.1.311.21.21"
3284 #define szOID_CERTSRV_CROSSCA_VERSION        "1.3.6.1.4.1.311.21.22"
3285 #define szOID_KEYID_RDN                      "1.3.6.1.4.1.311.10.7.1"
3286 #define szOID_PKIX                           "1.3.6.1.5.5.7"
3287 #define szOID_PKIX_PE                        "1.3.6.1.5.5.7.1"
3288 #define szOID_AUTHORITY_INFO_ACCESS          "1.3.6.1.5.5.7.1.1"
3289 #define szOID_PKIX_POLICY_QUALIFIER_CPS      "1.3.6.1.5.5.7.2.1"
3290 #define szOID_PKIX_POLICY_QUALIFIER_USERNOTICE "1.3.6.1.5.5.7.2.2"
3291 #define szOID_PKIX_KP                        "1.3.6.1.5.5.7.3"
3292 #define szOID_PKIX_KP_SERVER_AUTH            "1.3.6.1.5.5.7.3.1"
3293 #define szOID_PKIX_KP_CLIENT_AUTH            "1.3.6.1.5.5.7.3.2"
3294 #define szOID_PKIX_KP_CODE_SIGNING           "1.3.6.1.5.5.7.3.3"
3295 #define szOID_PKIX_KP_EMAIL_PROTECTION       "1.3.6.1.5.5.7.3.4"
3296 #define szOID_PKIX_KP_IPSEC_END_SYSTEM       "1.3.6.1.5.5.7.3.5"
3297 #define szOID_PKIX_KP_IPSEC_TUNNEL           "1.3.6.1.5.5.7.3.6"
3298 #define szOID_PKIX_KP_IPSEC_USER             "1.3.6.1.5.5.7.3.7"
3299 #define szOID_PKIX_KP_TIMESTAMP_SIGNING      "1.3.6.1.5.5.7.3.8"
3300 #define szOID_PKIX_NO_SIGNATURE              "1.3.6.1.5.5.7.6.2"
3301 #define szOID_CMC                            "1.3.6.1.5.5.7.7"
3302 #define szOID_CMC_STATUS_INFO                "1.3.6.1.5.5.7.7.1"
3303 #define szOID_CMC_IDENTIFICATION             "1.3.6.1.5.5.7.7.2"
3304 #define szOID_CMC_IDENTITY_PROOF             "1.3.6.1.5.5.7.7.3"
3305 #define szOID_CMC_DATA_RETURN                "1.3.6.1.5.5.7.7.4"
3306 #define szOID_CMC_TRANSACTION_ID             "1.3.6.1.5.5.7.7.5"
3307 #define szOID_CMC_SENDER_NONCE               "1.3.6.1.5.5.7.7.6"
3308 #define szOID_CMC_RECIPIENT_NONCE            "1.3.6.1.5.5.7.7.7"
3309 #define szOID_CMC_ADD_EXTENSIONS             "1.3.6.1.5.5.7.7.8"
3310 #define szOID_CMC_ENCRYPTED_POP              "1.3.6.1.5.5.7.7.9"
3311 #define szOID_CMC_DECRYPTED_POP              "1.3.6.1.5.5.7.7.10"
3312 #define szOID_CMC_LRA_POP_WITNESS            "1.3.6.1.5.5.7.7.11"
3313 #define szOID_CMC_GET_CERT                   "1.3.6.1.5.5.7.7.15"
3314 #define szOID_CMC_GET_CRL                    "1.3.6.1.5.5.7.7.16"
3315 #define szOID_CMC_REVOKE_REQUEST             "1.3.6.1.5.5.7.7.17"
3316 #define szOID_CMC_REG_INFO                   "1.3.6.1.5.5.7.7.18"
3317 #define szOID_CMC_RESPONSE_INFO              "1.3.6.1.5.5.7.7.19"
3318 #define szOID_CMC_QUERY_PENDING              "1.3.6.1.5.5.7.7.21"
3319 #define szOID_CMC_ID_POP_LINK_RANDOM         "1.3.6.1.5.5.7.7.22"
3320 #define szOID_CMC_ID_POP_LINK_WITNESS        "1.3.6.1.5.5.7.7.23"
3321 #define szOID_CT_PKI_DATA                    "1.3.6.1.5.5.7.12.2"
3322 #define szOID_CT_PKI_RESPONSE                "1.3.6.1.5.5.7.12.3"
3323 #define szOID_PKIX_ACC_DESCR                 "1.3.6.1.5.5.7.48"
3324 #define szOID_PKIX_OCSP                      "1.3.6.1.5.5.7.48.1"
3325 #define szOID_PKIX_CA_ISSUERS                "1.3.6.1.5.5.7.48.2"
3326 #define szOID_IPSEC_KP_IKE_INTERMEDIATE      "1.3.6.1.5.5.8.2.2"
3327 
3328 #ifndef szOID_SERIALIZED
3329 #define szOID_SERIALIZED                     "1.3.6.1.4.1.311.10.3.3.1"
3330 #endif
3331 
3332 #ifndef szOID_PRODUCT_UPDATE
3333 #define szOID_PRODUCT_UPDATE                 "1.3.6.1.4.1.311.31.1"
3334 #endif
3335 
3336 #define szOID_NETSCAPE                       "2.16.840.1.113730"
3337 #define szOID_NETSCAPE_CERT_EXTENSION        "2.16.840.1.113730.1"
3338 #define szOID_NETSCAPE_CERT_TYPE             "2.16.840.1.113730.1.1"
3339 #define szOID_NETSCAPE_BASE_URL              "2.16.840.1.113730.1.2"
3340 #define szOID_NETSCAPE_REVOCATION_URL        "2.16.840.1.113730.1.3"
3341 #define szOID_NETSCAPE_CA_REVOCATION_URL     "2.16.840.1.113730.1.4"
3342 #define szOID_NETSCAPE_CERT_RENEWAL_URL      "2.16.840.1.113730.1.7"
3343 #define szOID_NETSCAPE_CA_POLICY_URL         "2.16.840.1.113730.1.8"
3344 #define szOID_NETSCAPE_SSL_SERVER_NAME       "2.16.840.1.113730.1.12"
3345 #define szOID_NETSCAPE_COMMENT               "2.16.840.1.113730.1.13"
3346 #define szOID_NETSCAPE_DATA_TYPE             "2.16.840.1.113730.2"
3347 #define szOID_NETSCAPE_CERT_SEQUENCE         "2.16.840.1.113730.2.5"
3348 
3349 #define szOID_NIST_sha256                    "2.16.840.1.101.3.4.2.1"
3350 #define szOID_NIST_sha384                    "2.16.840.1.101.3.4.2.2"
3351 #define szOID_NIST_sha512                    "2.16.840.1.101.3.4.2.3"
3352 
3353 /* Bits for szOID_NETSCAPE_CERT_TYPE */
3354 #define NETSCAPE_SSL_CLIENT_AUTH_CERT_TYPE 0x80
3355 #define NETSCAPE_SSL_SERVER_AUTH_CERT_TYPE 0x40
3356 #define NETSCAPE_SMIME_CERT_TYPE           0x20
3357 #define NETSCAPE_SIGN_CERT_TYPE            0x10
3358 #define NETSCAPE_SSL_CA_CERT_TYPE          0x04
3359 #define NETSCAPE_SMIME_CA_CERT_TYPE        0x02
3360 #define NETSCAPE_SIGN_CA_CERT_TYPE         0x01
3361 
3362 #define CRYPT_ENCODE_DECODE_NONE             0
3363 #define X509_CERT                            ((LPCSTR)1)
3364 #define X509_CERT_TO_BE_SIGNED               ((LPCSTR)2)
3365 #define X509_CERT_CRL_TO_BE_SIGNED           ((LPCSTR)3)
3366 #define X509_CERT_REQUEST_TO_BE_SIGNED       ((LPCSTR)4)
3367 #define X509_EXTENSIONS                      ((LPCSTR)5)
3368 #define X509_NAME_VALUE                      ((LPCSTR)6)
3369 #define X509_ANY_STRING                      X509_NAME_VALUE
3370 #define X509_NAME                            ((LPCSTR)7)
3371 #define X509_PUBLIC_KEY_INFO                 ((LPCSTR)8)
3372 #define X509_AUTHORITY_KEY_ID                ((LPCSTR)9)
3373 #define X509_KEY_ATTRIBUTES                  ((LPCSTR)10)
3374 #define X509_KEY_USAGE_RESTRICTION           ((LPCSTR)11)
3375 #define X509_ALTERNATE_NAME                  ((LPCSTR)12)
3376 #define X509_BASIC_CONSTRAINTS               ((LPCSTR)13)
3377 #define X509_KEY_USAGE                       ((LPCSTR)14)
3378 #define X509_BASIC_CONSTRAINTS2              ((LPCSTR)15)
3379 #define X509_CERT_POLICIES                   ((LPCSTR)16)
3380 #define PKCS_UTC_TIME                        ((LPCSTR)17)
3381 #define PKCS_TIME_REQUEST                    ((LPCSTR)18)
3382 #define RSA_CSP_PUBLICKEYBLOB                ((LPCSTR)19)
3383 #define X509_UNICODE_NAME                    ((LPCSTR)20)
3384 #define X509_KEYGEN_REQUEST_TO_BE_SIGNED     ((LPCSTR)21)
3385 #define PKCS_ATTRIBUTE                       ((LPCSTR)22)
3386 #define PKCS_CONTENT_INFO_SEQUENCE_OF_ANY    ((LPCSTR)23)
3387 #define X509_UNICODE_NAME_VALUE              ((LPCSTR)24)
3388 #define X509_UNICODE_ANY_STRING              X509_UNICODE_NAME_VALUE
3389 #define X509_OCTET_STRING                    ((LPCSTR)25)
3390 #define X509_BITS                            ((LPCSTR)26)
3391 #define X509_INTEGER                         ((LPCSTR)27)
3392 #define X509_MULTI_BYTE_INTEGER              ((LPCSTR)28)
3393 #define X509_ENUMERATED                      ((LPCSTR)29)
3394 #define X509_CRL_REASON_CODE                 X509_ENUMERATED
3395 #define X509_CHOICE_OF_TIME                  ((LPCSTR)30)
3396 #define X509_AUTHORITY_KEY_ID2               ((LPCSTR)31)
3397 #define X509_AUTHORITY_INFO_ACCESS           ((LPCSTR)32)
3398 #define PKCS_CONTENT_INFO                    ((LPCSTR)33)
3399 #define X509_SEQUENCE_OF_ANY                 ((LPCSTR)34)
3400 #define X509_CRL_DIST_POINTS                 ((LPCSTR)35)
3401 #define X509_ENHANCED_KEY_USAGE              ((LPCSTR)36)
3402 #define PKCS_CTL                             ((LPCSTR)37)
3403 #define X509_MULTI_BYTE_UINT                 ((LPCSTR)38)
3404 #define X509_DSS_PUBLICKEY                   X509_MULTI_BYTE_UINT
3405 #define X509_DSS_PARAMETERS                  ((LPCSTR)39)
3406 #define X509_DSS_SIGNATURE                   ((LPCSTR)40)
3407 #define PKCS_RC2_CBC_PARAMETERS              ((LPCSTR)41)
3408 #define PKCS_SMIME_CAPABILITIES              ((LPCSTR)42)
3409 #define PKCS_RSA_PRIVATE_KEY                 ((LPCSTR)43)
3410 #define PKCS_PRIVATE_KEY_INFO                ((LPCSTR)44)
3411 #define PKCS_ENCRYPTED_PRIVATE_KEY_INFO      ((LPCSTR)45)
3412 #define X509_PKIX_POLICY_QUALIFIER_USERNOTICE ((LPCSTR)46)
3413 #define X509_DH_PUBLICKEY                    X509_MULTI_BYTE_UINT
3414 #define X509_DH_PARAMETERS                   ((LPCSTR)47)
3415 #define X509_ECC_SIGNATURE                   ((LPCSTR)47)
3416 #define PKCS_ATTRIBUTES                      ((LPCSTR)48)
3417 #define PKCS_SORTED_CTL                      ((LPCSTR)49)
3418 #define X942_DH_PARAMETERS                   ((LPCSTR)50)
3419 #define X509_BITS_WITHOUT_TRAILING_ZEROES    ((LPCSTR)51)
3420 #define X942_OTHER_INFO                      ((LPCSTR)52)
3421 #define X509_CERT_PAIR                       ((LPCSTR)53)
3422 #define X509_ISSUING_DIST_POINT              ((LPCSTR)54)
3423 #define X509_NAME_CONSTRAINTS                ((LPCSTR)55)
3424 #define X509_POLICY_MAPPINGS                 ((LPCSTR)56)
3425 #define X509_POLICY_CONSTRAINTS              ((LPCSTR)57)
3426 #define X509_CROSS_CERT_DIST_POINTS          ((LPCSTR)58)
3427 #define CMC_DATA                             ((LPCSTR)59)
3428 #define CMC_RESPONSE                         ((LPCSTR)60)
3429 #define CMC_STATUS                           ((LPCSTR)61)
3430 #define CMC_ADD_EXTENSIONS                   ((LPCSTR)62)
3431 #define CMC_ADD_ATTRIBUTES                   ((LPCSTR)63)
3432 #define X509_CERTIFICATE_TEMPLATE            ((LPCSTR)64)
3433 #define X509_OBJECT_IDENTIFIER               ((LPCSTR)73)
3434 #define PKCS7_SIGNER_INFO                    ((LPCSTR)500)
3435 #define CMS_SIGNER_INFO                      ((LPCSTR)501)
3436 
3437 /* encode/decode flags */
3438 #define CRYPT_ENCODE_NO_SIGNATURE_BYTE_REVERSAL_FLAG           0x00008
3439 #define CRYPT_ENCODE_ALLOC_FLAG                                0x08000
3440 #define CRYPT_SORTED_CTL_ENCODE_HASHED_SUBJECT_IDENTIFIER_FLAG 0x10000
3441 #define CRYPT_UNICODE_NAME_ENCODE_ENABLE_T61_UNICODE_FLAG \
3442  CERT_RDN_ENABLE_T61_UNICODE_FLAG
3443 #define CRYPT_UNICODE_NAME_ENCODE_ENABLE_UTF8_UNICODE_FLAG \
3444  CERT_RDN_ENABLE_UTF8_UNICODE_FLAG
3445 #define CRYPT_UNICODE_NAME_ENCODE_DISABLE_CHECK_TYPE_FLAG \
3446  CERT_RDN_DISABLE_CHECK_TYPE_FLAG
3447 
3448 #define CRYPT_DECODE_NOCOPY_FLAG                               0x00001
3449 #define CRYPT_DECODE_TO_BE_SIGNED_FLAG                         0x00002
3450 #define CRYPT_DECODE_SHARE_OID_STRING_FLAG                     0x00004
3451 #define CRYPT_DECODE_NO_SIGNATURE_BYTE_REVERSAL_FLAG           0x00008
3452 #define CRYPT_DECODE_ALLOC_FLAG                                0x08000
3453 #define CRYPT_UNICODE_NAME_DECODE_DISABLE_IE4_UTF8_FLAG \
3454  CERT_RDN_DISABLE_IE4_UTF8_FLAG
3455 
3456 #define CERT_STORE_SIGNATURE_FLAG     0x00000001
3457 #define CERT_STORE_TIME_VALIDITY_FLAG 0x00000002
3458 #define CERT_STORE_REVOCATION_FLAG    0x00000004
3459 #define CERT_STORE_NO_CRL_FLAG        0x00010000
3460 #define CERT_STORE_NO_ISSUER_FLAG     0x00020000
3461 
3462 #define CERT_STORE_BASE_CRL_FLAG  0x00000100
3463 #define CERT_STORE_DELTA_CRL_FLAG 0x00000200
3464 
3465 /* subject types for CryptVerifyCertificateSignatureEx */
3466 #define CRYPT_VERIFY_CERT_SIGN_SUBJECT_BLOB 1
3467 #define CRYPT_VERIFY_CERT_SIGN_SUBJECT_CERT 2
3468 #define CRYPT_VERIFY_CERT_SIGN_SUBJECT_CRL  3
3469 
3470 /* issuer types for CryptVerifyCertificateSignatureEx */
3471 #define CRYPT_VERIFY_CERT_SIGN_ISSUER_PUBKEY 1
3472 #define CRYPT_VERIFY_CERT_SIGN_ISSUER_CERT   2
3473 #define CRYPT_VERIFY_CERT_SIGN_ISSUER_CHAIN  3
3474 #define CRYPT_VERIFY_CERT_SIGN_ISSUER_NULL   4
3475 
3476 #define CRYPT_GET_URL_FROM_PROPERTY         0x00000001
3477 #define CRYPT_GET_URL_FROM_EXTENSION        0x00000002
3478 #define CRYPT_GET_URL_FROM_UNAUTH_ATTRIBUTE 0x00000004
3479 #define CRYPT_GET_URL_FROM_AUTH_ATTRIBUTE   0x00000008
3480 
3481 /* Certificate name string types and flags */
3482 #define CERT_SIMPLE_NAME_STR 1
3483 #define CERT_OID_NAME_STR    2
3484 #define CERT_X500_NAME_STR   3
3485 #define CERT_NAME_STR_SEMICOLON_FLAG           0x40000000
3486 #define CERT_NAME_STR_NO_PLUS_FLAG             0x20000000
3487 #define CERT_NAME_STR_NO_QUOTING_FLAG          0x10000000
3488 #define CERT_NAME_STR_CRLF_FLAG                0x08000000
3489 #define CERT_NAME_STR_COMMA_FLAG               0x04000000
3490 #define CERT_NAME_STR_REVERSE_FLAG             0x02000000
3491 #define CERT_NAME_STR_ENABLE_UTF8_UNICODE_FLAG 0x00040000
3492 #define CERT_NAME_STR_ENABLE_T61_UNICODE_FLAG  0x00020000
3493 #define CERT_NAME_STR_DISABLE_IE4_UTF8_FLAG    0x00010000
3494 
3495 #define CERT_NAME_EMAIL_TYPE            1
3496 #define CERT_NAME_RDN_TYPE              2
3497 #define CERT_NAME_ATTR_TYPE             3
3498 #define CERT_NAME_SIMPLE_DISPLAY_TYPE   4
3499 #define CERT_NAME_FRIENDLY_DISPLAY_TYPE 5
3500 #define CERT_NAME_DNS_TYPE              6
3501 #define CERT_NAME_URL_TYPE              7
3502 #define CERT_NAME_UPN_TYPE              8
3503 
3504 #define CERT_NAME_ISSUER_FLAG           0x00000001
3505 #define CERT_NAME_DISABLE_IE4_UTF8_FLAG 0x00010000
3506 
3507 /* CryptFormatObject flags */
3508 #define CRYPT_FORMAT_STR_MULTI_LINE 0x0001
3509 #define CRYPT_FORMAT_STR_NO_HEX     0x0010
3510 
3511 #define CRYPT_FORMAT_SIMPLE        0x0001
3512 #define CRYPT_FORMAT_X509          0x0002
3513 #define CRYPT_FORMAT_OID           0x0004
3514 #define CRYPT_FORMAT_RDN_SEMICOLON 0x0100
3515 #define CRYPT_FORMAT_RDN_CRLF      0x0200
3516 #define CRYPT_FORMAT_RDN_UNQUOTE   0x0400
3517 #define CRYPT_FORMAT_RDN_REVERSE   0x0800
3518 
3519 #define CRYPT_FORMAT_COMMA     0x1000
3520 #define CRYPT_FORMAT_SEMICOLON CRYPT_FORMAT_RDN_SEMICOLON
3521 #define CRYPT_FORMAT_CRLF      CRYPT_FORMAT_RDN_CRLF
3522 
3523 /* CryptQueryObject types and flags */
3524 #define CERT_QUERY_OBJECT_FILE 1
3525 #define CERT_QUERY_OBJECT_BLOB 2
3526 
3527 #define CERT_QUERY_CONTENT_CERT               1
3528 #define CERT_QUERY_CONTENT_CTL                2
3529 #define CERT_QUERY_CONTENT_CRL                3
3530 #define CERT_QUERY_CONTENT_SERIALIZED_STORE   4
3531 #define CERT_QUERY_CONTENT_SERIALIZED_CERT    5
3532 #define CERT_QUERY_CONTENT_SERIALIZED_CTL     6
3533 #define CERT_QUERY_CONTENT_SERIALIZED_CRL     7
3534 #define CERT_QUERY_CONTENT_PKCS7_SIGNED       8
3535 #define CERT_QUERY_CONTENT_PKCS7_UNSIGNED     9
3536 #define CERT_QUERY_CONTENT_PKCS7_SIGNED_EMBED 10
3537 #define CERT_QUERY_CONTENT_PKCS10             11
3538 #define CERT_QUERY_CONTENT_PFX                12
3539 #define CERT_QUERY_CONTENT_CERT_PAIR          13
3540 
3541 #define CERT_QUERY_CONTENT_FLAG_CERT      (1 << CERT_QUERY_CONTENT_CERT)
3542 #define CERT_QUERY_CONTENT_FLAG_CTL       (1 << CERT_QUERY_CONTENT_CTL)
3543 #define CERT_QUERY_CONTENT_FLAG_CRL       (1 << CERT_QUERY_CONTENT_CRL)
3544 #define CERT_QUERY_CONTENT_FLAG_SERIALIZED_STORE \
3545  (1 << CERT_QUERY_CONTENT_SERIALIZED_STORE)
3546 #define CERT_QUERY_CONTENT_FLAG_SERIALIZED_CERT \
3547  (1 << CERT_QUERY_CONTENT_SERIALIZED_CERT)
3548 #define CERT_QUERY_CONTENT_FLAG_SERIALIZED_CTL \
3549  (1 << CERT_QUERY_CONTENT_SERIALIZED_CTL)
3550 #define CERT_QUERY_CONTENT_FLAG_SERIALIZED_CRL \
3551  (1 << CERT_QUERY_CONTENT_SERIALIZED_CRL)
3552 #define CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED \
3553  (1 << CERT_QUERY_CONTENT_PKCS7_SIGNED)
3554 #define CERT_QUERY_CONTENT_FLAG_PKCS7_UNSIGNED \
3555  (1 << CERT_QUERY_CONTENT_PKCS7_UNSIGNED)
3556 #define CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED_EMBED \
3557  (1 << CERT_QUERY_CONTENT_PKCS7_SIGNED_EMBED)
3558 #define CERT_QUERY_CONTENT_FLAG_PKCS10    (1 << CERT_QUERY_CONTENT_PKCS10)
3559 #define CERT_QUERY_CONTENT_FLAG_PFX       (1 << CERT_QUERY_CONTENT_PFX)
3560 #define CERT_QUERY_CONTENT_FLAG_CERT_PAIR (1 << CERT_QUERY_CONTENT_CERT_PAIR)
3561 
3562 #define CERT_QUERY_CONTENT_FLAG_ALL \
3563  CERT_QUERY_CONTENT_FLAG_CERT | \
3564  CERT_QUERY_CONTENT_FLAG_CTL | \
3565  CERT_QUERY_CONTENT_FLAG_CRL | \
3566  CERT_QUERY_CONTENT_FLAG_SERIALIZED_STORE | \
3567  CERT_QUERY_CONTENT_FLAG_SERIALIZED_CERT | \
3568  CERT_QUERY_CONTENT_FLAG_SERIALIZED_CTL | \
3569  CERT_QUERY_CONTENT_FLAG_SERIALIZED_CRL | \
3570  CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED | \
3571  CERT_QUERY_CONTENT_FLAG_PKCS7_UNSIGNED | \
3572  CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED_EMBED | \
3573  CERT_QUERY_CONTENT_FLAG_PKCS10 | \
3574  CERT_QUERY_CONTENT_FLAG_PFX | \
3575  CERT_QUERY_CONTENT_FLAG_CERT_PAIR
3576 
3577 #define CERT_QUERY_FORMAT_BINARY                1
3578 #define CERT_QUERY_FORMAT_BASE64_ENCODED        2
3579 #define CERT_QUERY_FORMAT_ASN_ASCII_HEX_ENCODED 3
3580 
3581 #define CERT_QUERY_FORMAT_FLAG_BINARY (1 << CERT_QUERY_FORMAT_BINARY)
3582 #define CERT_QUERY_FORMAT_FLAG_BASE64_ENCODED \
3583  (1 << CERT_QUERY_FORMAT_BASE64_ENCODED)
3584 #define CERT_QUERY_FORMAT_FLAG_ASN_ASCII_HEX_ENCODED \
3585  (1 << CERT_QUERY_FORMAT_ASN_ASCII_HEX_ENCODED)
3586 
3587 #define CERT_QUERY_FORMAT_FLAG_ALL \
3588  CERT_QUERY_FORMAT_FLAG_BINARY | \
3589  CERT_QUERY_FORMAT_FLAG_BASE64_ENCODED | \
3590  CERT_QUERY_FORMAT_FLAG_ASN_ASCII_HEX_ENCODED \
3591 
3592 #define CERT_SET_KEY_PROV_HANDLE_PROP_ID 0x00000001
3593 #define CERT_SET_KEY_CONTEXT_PROP_ID     0x00000001
3594 
3595 #define CERT_CREATE_SELFSIGN_NO_SIGN     1
3596 #define CERT_CREATE_SELFSIGN_NO_KEY_INFO 2
3597 
3598 /* flags for CryptAcquireCertificatePrivateKey */
3599 #define CRYPT_ACQUIRE_CACHE_FLAG         0x00000001
3600 #define CRYPT_ACQUIRE_USE_PROV_INFO_FLAG 0x00000002
3601 #define CRYPT_ACQUIRE_COMPARE_KEY_FLAG   0x00000004
3602 #define CRYPT_ACQUIRE_SILENT_FLAG        0x00000040
3603 
3604 /* flags for CryptFindCertificateKeyProvInfo */
3605 #define CRYPT_FIND_USER_KEYSET_FLAG    0x00000001
3606 #define CRYPT_FIND_MACHINE_KEYSET_FLAG 0x00000002
3607 #define CRYPT_FIND_SILENT_KEYSET_FLAG  0x00000040
3608 
3609 /* Chain engines and chains */
3610 typedef HANDLE HCERTCHAINENGINE;
3611 #define HCCE_CURRENT_USER  ((HCERTCHAINENGINE)NULL)
3612 #define HCCE_LOCAL_MACHINE ((HCERTCHAINENGINE)1)
3613 
3614 #define CERT_CHAIN_CACHE_END_CERT           0x00000001
3615 #define CERT_CHAIN_THREAD_STORE_SYNC        0x00000002
3616 #define CERT_CHAIN_CACHE_ONLY_URL_RETRIEVAL 0x00000004
3617 #define CERT_CHAIN_USE_LOCAL_MACHINE_STORE  0x00000008
3618 #define CERT_CHAIN_ENABLE_CACHE_AUTO_UPDATE 0x00000010
3619 #define CERT_CHAIN_ENABLE_SHARE_STORE       0x00000020
3620 
3621 typedef struct _CERT_CHAIN_ENGINE_CONFIG
3622 {
3623     DWORD       cbSize;
3624     HCERTSTORE  hRestrictedRoot;
3625     HCERTSTORE  hRestrictedTrust;
3626     HCERTSTORE  hRestrictedOther;
3627     DWORD       cAdditionalStore;
3628     HCERTSTORE *rghAdditionalStore;
3629     DWORD       dwFlags;
3630     DWORD       dwUrlRetrievalTimeout;
3631     DWORD       MaximumCachedCertificates;
3632     DWORD       CycleDetectionModulus;
3633     HCERTSTORE  hExclusiveRoot;
3634     HCERTSTORE  hExclusiveRootTrustedPeople;
3635 } CERT_CHAIN_ENGINE_CONFIG, *PCERT_CHAIN_ENGINE_CONFIG;
3636 
3637 /* message-related definitions */
3638 
3639 typedef BOOL
3640 (WINAPI *PFN_CMSG_STREAM_OUTPUT)(
3641   _In_opt_ const void *pvArg,
3642   _In_reads_bytes_opt_(cbData) BYTE *pbData,
3643   _In_ DWORD cbData,
3644   _In_ BOOL fFinal);
3645 
3646 #define CMSG_INDEFINITE_LENGTH 0xffffffff
3647 
3648 typedef struct _CMSG_STREAM_INFO
3649 {
3650     DWORD cbContent;
3651     PFN_CMSG_STREAM_OUTPUT pfnStreamOutput;
3652     void *pvArg;
3653 } CMSG_STREAM_INFO, *PCMSG_STREAM_INFO;
3654 
3655 typedef struct _CERT_ISSUER_SERIAL_NUMBER
3656 {
3657     CERT_NAME_BLOB     Issuer;
3658     CRYPT_INTEGER_BLOB SerialNumber;
3659 } CERT_ISSUER_SERIAL_NUMBER, *PCERT_ISSUER_SERIAL_NUMBER;
3660 
3661 typedef struct _CERT_ID
3662 {
3663     DWORD dwIdChoice;
3664     union {
3665         CERT_ISSUER_SERIAL_NUMBER IssuerSerialNumber;
3666         CRYPT_HASH_BLOB           KeyId;
3667         CRYPT_HASH_BLOB           HashId;
3668     } DUMMYUNIONNAME;
3669 } CERT_ID, *PCERT_ID;
3670 
3671 #define CERT_ID_ISSUER_SERIAL_NUMBER 1
3672 #define CERT_ID_KEY_IDENTIFIER       2
3673 #define CERT_ID_SHA1_HASH            3
3674 
3675 #ifndef USE_WC_PREFIX
3676 #undef CMSG_DATA /* may be defined by sys/socket.h */
3677 #define CMSG_DATA                 1
3678 #define CMSG_SIGNED               2
3679 #define CMSG_ENVELOPED            3
3680 #define CMSG_SIGNED_AND_ENVELOPED 4
3681 #define CMSG_HASHED               5
3682 #define CMSG_ENCRYPTED            6
3683 
3684 #define CMSG_ALL_FLAGS                 ~0U
3685 #define CMSG_DATA_FLAG                 (1 << CMSG_DATA)
3686 #define CMSG_SIGNED_FLAG               (1 << CMSG_SIGNED)
3687 #define CMSG_ENVELOPED_FLAG            (1 << CMSG_ENVELOPED)
3688 #define CMSG_SIGNED_AND_ENVELOPED_FLAG (1 << CMSG_SIGNED_AND_ENVELOPED)
3689 #define CMSG_ENCRYPTED_FLAG            (1 << CMSG_ENCRYPTED)
3690 #else
3691 #define WC_CMSG_DATA                 1
3692 #define WC_CMSG_SIGNED               2
3693 #define WC_CMSG_ENVELOPED            3
3694 #define WC_CMSG_SIGNED_AND_ENVELOPED 4
3695 #define WC_CMSG_HASHED               5
3696 #define WC_CMSG_ENCRYPTED            6
3697 
3698 #define WC_CMSG_ALL_FLAGS                 ~0U
3699 #define WC_CMSG_DATA_FLAG                 (1 << WC_CMSG_DATA)
3700 #define WC_CMSG_SIGNED_FLAG               (1 << WC_CMSG_SIGNED)
3701 #define WC_CMSG_ENVELOPED_FLAG            (1 << WC_CMSG_ENVELOPED)
3702 #define WC_CMSG_SIGNED_AND_ENVELOPED_FLAG (1 << WC_CMSG_SIGNED_AND_ENVELOPED)
3703 #define WC_CMSG_ENCRYPTED_FLAG            (1 << WC_CMSG_ENCRYPTED)
3704 #endif
3705 
3706 typedef struct _CMSG_SIGNER_ENCODE_INFO
3707 {
3708     DWORD                      cbSize;
3709     PCERT_INFO                 pCertInfo;
3710     HCRYPTPROV                 hCryptProv;
3711     DWORD                      dwKeySpec;
3712     CRYPT_ALGORITHM_IDENTIFIER HashAlgorithm;
3713     void                      *pvHashAuxInfo;
3714     DWORD                      cAuthAttr;
3715     PCRYPT_ATTRIBUTE           rgAuthAttr;
3716     DWORD                      cUnauthAttr;
3717     PCRYPT_ATTRIBUTE           rgUnauthAttr;
3718 #ifdef CMSG_SIGNER_ENCODE_INFO_HAS_CMS_FIELDS
3719     CERT_ID                    SignerId;
3720     CRYPT_ALGORITHM_IDENTIFIER HashEncryptionAlgorithm;
3721     void                      *pvHashEncryptionAuxInfo;
3722 #endif
3723 } CMSG_SIGNER_ENCODE_INFO, *PCMSG_SIGNER_ENCODE_INFO;
3724 
3725 typedef struct _CMSG_SIGNED_ENCODE_INFO
3726 {
3727     DWORD                    cbSize;
3728     DWORD                    cSigners;
3729     PCMSG_SIGNER_ENCODE_INFO rgSigners;
3730     DWORD                    cCertEncoded;
3731     PCERT_BLOB               rgCertEncoded;
3732     DWORD                    cCrlEncoded;
3733     PCRL_BLOB                rgCrlEncoded;
3734 #ifdef CMSG_SIGNED_ENCODE_INFO_HAS_CMS_FIELDS
3735     DWORD                    cAttrCertEncoded;
3736     PCERT_BLOB               rgAttrCertEncoded;
3737 #endif
3738 } CMSG_SIGNED_ENCODE_INFO, *PCMSG_SIGNED_ENCODE_INFO;
3739 
3740 typedef struct _CMSG_KEY_TRANS_RECIPIENT_ENCODE_INFO
3741 {
3742     DWORD                      cbSize;
3743     CRYPT_ALGORITHM_IDENTIFIER KeyEncryptionAlgorithm;
3744     void                      *pvKeyEncryptionAuxInfo;
3745     HCRYPTPROV_LEGACY          hCryptProv;
3746     CRYPT_BIT_BLOB             RecipientPublicKey;
3747     CERT_ID                    RecipientId;
3748 } CMSG_KEY_TRANS_RECIPIENT_ENCODE_INFO, *PCMSG_KEY_TRANS_RECIPIENT_ENCODE_INFO;
3749 
3750 typedef struct _CMSG_RECIPIENT_ENCRYPTED_KEY_ENCODE_INFO
3751 {
3752     DWORD                       cbSize;
3753     CRYPT_BIT_BLOB              RecipientPublicKey;
3754     CERT_ID                     RecipientId;
3755     FILETIME                    Date;
3756     PCRYPT_ATTRIBUTE_TYPE_VALUE pOtherAttr;
3757 } CMSG_RECIPIENT_ENCRYPTED_KEY_ENCODE_INFO,
3758  *PCMSG_RECIPIENT_ENCRYPTED_KEY_ENCODE_INFO;
3759 
3760 typedef struct _CMSG_KEY_AGREE_RECIPIENT_ENCODE_INFO
3761 {
3762     DWORD                      cbSize;
3763     CRYPT_ALGORITHM_IDENTIFIER KeyEncryptionAlgorithm;
3764     void                      *pvKeyEncryptionAuxInfo;
3765     CRYPT_ALGORITHM_IDENTIFIER KeyWrapAlgorithm;
3766     void                      *pvKeyWrapAuxInfo;
3767     HCRYPTPROV_LEGACY          hCryptProv;
3768     DWORD                      dwKeySpec;
3769     DWORD                      dwKeyChoice;
3770     union {
3771         PCRYPT_ALGORITHM_IDENTIFIER pEphemeralAlgorithm;
3772         PCERT_ID                    pSenderId;
3773     } DUMMYUNIONNAME;
3774     CRYPT_DATA_BLOB            UserKeyingMaterial;
3775     DWORD                      cRecipientEncryptedKeys;
3776     PCMSG_RECIPIENT_ENCRYPTED_KEY_ENCODE_INFO *rgpRecipientEncryptedKeys;
3777 } CMSG_KEY_AGREE_RECIPIENT_ENCODE_INFO, *PCMSG_KEY_AGREE_RECIPIENT_ENCODE_INFO;
3778 
3779 #define CMSG_KEY_AGREE_EPHEMERAL_KEY_CHOICE 1
3780 #define CMSG_KEY_AGREE_STATIC_KEY_CHOICE    2
3781 
3782 typedef struct _CMSG_MAIL_LIST_RECIPIENT_ENCODE_INFO
3783 {
3784     DWORD                       cbSize;
3785     CRYPT_ALGORITHM_IDENTIFIER  KeyEncryptionAlgorithm;
3786     void                       *pvKeyEncryptionAuxInfo;
3787     HCRYPTPROV                  hCryptProv;
3788     DWORD                       dwKeyChoice;
3789     union {
3790         HCRYPTKEY hKeyEncryptionKey;
3791         void     *pvKeyEncryptionKey;
3792     } DUMMYUNIONNAME;
3793     CRYPT_DATA_BLOB             KeyId;
3794     FILETIME                    Date;
3795     PCRYPT_ATTRIBUTE_TYPE_VALUE pOtherAttr;
3796 } CMSG_MAIL_LIST_RECIPIENT_ENCODE_INFO, *PCMSG_MAIL_LIST_RECIPIENT_ENCODE_INFO;
3797 
3798 #define CMSG_MAIL_LIST_HANDLE_KEY_CHOICE 1
3799 
3800 typedef struct _CMSG_RECIPIENT_ENCODE_INFO
3801 {
3802     DWORD dwRecipientChoice;
3803     union {
3804         PCMSG_KEY_TRANS_RECIPIENT_ENCODE_INFO pKeyTrans;
3805         PCMSG_KEY_AGREE_RECIPIENT_ENCODE_INFO pKeyAgree;
3806         PCMSG_MAIL_LIST_RECIPIENT_ENCODE_INFO pMailList;
3807     } DUMMYUNIONNAME;
3808 } CMSG_RECIPIENT_ENCODE_INFO, *PCMSG_RECIPIENT_ENCODE_INFO;
3809 
3810 #define CMSG_KEY_TRANS_RECIPIENT 1
3811 #define CMSG_KEY_AGREE_RECIPIENT 2
3812 #define CMSG_MAIL_LIST_RECIPIENT 3
3813 
3814 typedef struct _CMSG_ENVELOPED_ENCODE_INFO
3815 {
3816     DWORD                       cbSize;
3817     HCRYPTPROV_LEGACY           hCryptProv;
3818     CRYPT_ALGORITHM_IDENTIFIER  ContentEncryptionAlgorithm;
3819     void                       *pvEncryptionAuxInfo;
3820     DWORD                       cRecipients;
3821     PCERT_INFO                 *rgpRecipientCert;
3822 #ifdef CMSG_ENVELOPED_ENCODE_INFO_HAS_CMS_FIELDS
3823     PCMSG_RECIPIENT_ENCODE_INFO rgCmsRecipients;
3824     DWORD                       cCertEncoded;
3825     PCERT_BLOB                  rgCertEncoded;
3826     DWORD                       cCrlEncoded;
3827     PCRL_BLOB                   rgCrlEncoded;
3828     DWORD                       cAttrCertEncoded;
3829     PCERT_BLOB                  rgAttrCertEncoded;
3830     DWORD                       cUnprotectedAttr;
3831     PCRYPT_ATTRIBUTE            rgUnprotectedAttr;
3832 #endif
3833 } CMSG_ENVELOPED_ENCODE_INFO, *PCMSG_ENVELOPED_ENCODE_INFO;
3834 
3835 typedef struct _CMSG_SIGNED_AND_ENVELOPED_ENCODE_INFO
3836 {
3837     DWORD                      cbSize;
3838     CMSG_SIGNED_ENCODE_INFO    SignedInfo;
3839     CMSG_ENVELOPED_ENCODE_INFO EnvelopedInfo;
3840 } CMSG_SIGNED_AND_ENVELOPED_ENCODE_INFO,
3841  *PCMSG_SIGNED_AND_ENVELOPED_ENCODE_INFO;
3842 
3843 typedef struct _CMSG_HASHED_ENCODE_INFO
3844 {
3845     DWORD                      cbSize;
3846     HCRYPTPROV_LEGACY          hCryptProv;
3847     CRYPT_ALGORITHM_IDENTIFIER HashAlgorithm;
3848     void                      *pvHashAuxInfo;
3849 } CMSG_HASHED_ENCODE_INFO, *PCMSG_HASHED_ENCODE_INFO;
3850 
3851 typedef struct _CMSG_ENCRYPTED_ENCODE_INFO
3852 {
3853     DWORD                      cbSize;
3854     CRYPT_ALGORITHM_IDENTIFIER ContentEncryptionAlgorithm;
3855     void                      *pvEncryptionAuxInfo;
3856 } CMSG_ENCRYPTED_ENCODE_INFO, *PCMSG_ENCRYPTED_ENCODE_INFO;
3857 
3858 #define CMSG_BARE_CONTENT_FLAG             0x00000001
3859 #define CMSG_LENGTH_ONLY_FLAG              0x00000002
3860 #define CMSG_DETACHED_FLAG                 0x00000004
3861 #define CMSG_AUTHENTICATED_ATTRIBUTES_FLAG 0x00000008
3862 #define CMSG_CONTENTS_OCTETS_FLAG          0x00000010
3863 #define CMSG_MAX_LENGTH_FLAG               0x00000020
3864 #define CMSG_CMS_ENCAPSULATED_CONTENT_FLAG 0x00000040
3865 #define CMSG_CRYPT_RELEASE_CONTEXT_FLAG    0x00008000
3866 
3867 #define CMSG_CTRL_VERIFY_SIGNATURE       1
3868 #define CMSG_CTRL_DECRYPT                2
3869 #define CMSG_CTRL_VERIFY_HASH            5
3870 #define CMSG_CTRL_ADD_SIGNER             6
3871 #define CMSG_CTRL_DEL_SIGNER             7
3872 #define CMSG_CTRL_ADD_SIGNER_UNAUTH_ATTR 8
3873 #define CMSG_CTRL_DEL_SIGNER_UNAUTH_ATTR 9
3874 #define CMSG_CTRL_ADD_CERT               10
3875 #define CMSG_CTRL_DEL_CERT               11
3876 #define CMSG_CTRL_ADD_CRL                12
3877 #define CMSG_CTRL_DEL_CRL                13
3878 #define CMSG_CTRL_ADD_ATTR_CERT          14
3879 #define CMSG_CTRL_DEL_ATTR_CERT          15
3880 #define CMSG_CTRL_KEY_TRANS_DECRYPT      16
3881 #define CMSG_CTRL_KEY_AGREE_DECRYPT      17
3882 #define CMSG_CTRL_MAIL_LIST_DECRYPT      18
3883 #define CMSG_CTRL_VERIFY_SIGNATURE_EX    19
3884 #define CMSG_CTRL_ADD_CMS_SIGNER_INFO    20
3885 
3886 typedef struct _CMSG_CTRL_DECRYPT_PARA
3887 {
3888     DWORD      cbSize;
3889     HCRYPTPROV hCryptProv;
3890     DWORD      dwKeySpec;
3891     DWORD      dwRecipientIndex;
3892 } CMSG_CTRL_DECRYPT_PARA, *PCMSG_CTRL_DECRYPT_PARA;
3893 
3894 typedef struct _CMSG_CTRL_ADD_SIGNER_UNAUTH_ATTR_PARA
3895 {
3896     DWORD           cbSize;
3897     DWORD           dwSignerIndex;
3898     CRYPT_DATA_BLOB blob;
3899 } CMSG_CTRL_ADD_SIGNER_UNAUTH_ATTR_PARA,
3900  *PCMSG_CTRL_ADD_SIGNER_UNAUTH_ATTR_PARA;
3901 
3902 typedef struct _CMSG_CTRL_DEL_SIGNER_UNAUTH_ATTR_PARA
3903 {
3904     DWORD           cbSize;
3905     DWORD           dwSignerIndex;
3906     DWORD           dwUnauthAttrIndex;
3907 } CMSG_CTRL_DEL_SIGNER_UNAUTH_ATTR_PARA,
3908  *PCMSG_CTRL_DEL_SIGNER_UNAUTH_ATTR_PARA;
3909 
3910 typedef struct _CMSG_CTRL_VERIFY_SIGNATURE_EX_PARA {
3911     DWORD      cbSize;
3912     HCRYPTPROV hCryptProv;
3913     DWORD      dwSignerIndex;
3914     DWORD      dwSignerType;
3915     void      *pvSigner;
3916 } CMSG_CTRL_VERIFY_SIGNATURE_EX_PARA, *PCMSG_CTRL_VERIFY_SIGNATURE_EX_PARA;
3917 
3918 #define CMSG_VERIFY_SIGNER_PUBKEY 1
3919 #define CMSG_VERIFY_SIGNER_CERT   2
3920 #define CMSG_VERIFY_SIGNER_CHAIN  3
3921 #define CMSG_VERIFY_SIGNER_NULL   4
3922 
3923 #define CMSG_TYPE_PARAM                  1
3924 #define CMSG_CONTENT_PARAM               2
3925 #define CMSG_BARE_CONTENT_PARAM          3
3926 #define CMSG_INNER_CONTENT_TYPE_PARAM    4
3927 #define CMSG_SIGNER_COUNT_PARAM          5
3928 #define CMSG_SIGNER_INFO_PARAM           6
3929 #define CMSG_SIGNER_CERT_INFO_PARAM      7
3930 #define CMSG_SIGNER_HASH_ALGORITHM_PARAM 8
3931 #define CMSG_SIGNER_AUTH_ATTR_PARAM      9
3932 #define CMSG_SIGNER_UNAUTH_ATTR_PARAM    10
3933 #define CMSG_CERT_COUNT_PARAM            11
3934 #define CMSG_CERT_PARAM                  12
3935 #define CMSG_CRL_COUNT_PARAM             13
3936 #define CMSG_CRL_PARAM                   14
3937 #define CMSG_ENVELOPE_ALGORITHM_PARAM    15
3938 #define CMSG_RECIPIENT_COUNT_PARAM       17
3939 #define CMSG_RECIPIENT_INDEX_PARAM       18
3940 #define CMSG_RECIPIENT_INFO_PARAM        19
3941 #define CMSG_HASH_ALGORITHM_PARAM        20
3942 #define CMSG_HASH_DATA_PARAM             21
3943 #define CMSG_COMPUTED_HASH_PARAM         22
3944 #define CMSG_ENCRYPT_PARAM               26
3945 #define CMSG_ENCRYPTED_DIGEST            27
3946 #define CMSG_ENCODED_SIGNER              28
3947 #define CMSG_ENCODED_MESSAGE             29
3948 #define CMSG_VERSION_PARAM               30
3949 #define CMSG_ATTR_CERT_COUNT_PARAM       31
3950 #define CMSG_ATTR_CERT_PARAM             32
3951 #define CMSG_CMS_RECIPIENT_COUNT_PARAM   33
3952 #define CMSG_CMS_RECIPIENT_INDEX_PARAM   34
3953 #define CMSG_CMS_RECIPIENT_ENCRYPTED_KEY_INDEX_PARAM 35
3954 #define CMSG_CMS_RECIPIENT_INFO_PARAM    36
3955 #define CMSG_UNPROTECTED_ATTR_PARAM      37
3956 #define CMSG_SIGNER_CERT_ID_PARAM        38
3957 #define CMSG_CMS_SIGNER_INFO_PARAM       39
3958 
3959 typedef struct _CMSG_CMS_SIGNER_INFO {
3960     DWORD                      dwVersion;
3961     CERT_ID                    SignerId;
3962     CRYPT_ALGORITHM_IDENTIFIER HashAlgorithm;
3963     CRYPT_ALGORITHM_IDENTIFIER HashEncryptionAlgorithm;
3964     CRYPT_DATA_BLOB            EncryptedHash;
3965     CRYPT_ATTRIBUTES           AuthAttrs;
3966     CRYPT_ATTRIBUTES           UnauthAttrs;
3967 } CMSG_CMS_SIGNER_INFO, *PCMSG_CMS_SIGNER_INFO;
3968 
3969 typedef CRYPT_ATTRIBUTES CMSG_ATTR, *PCMSG_ATTR;
3970 
3971 #define CMSG_SIGNED_DATA_V1               1
3972 #define CMSG_SIGNED_DATA_V3               3
3973 #define CMSG_SIGNED_DATA_PKCS_1_5_VERSION CMSG_SIGNED_DATA_V1
3974 #define CMSG_SIGNED_DATA_CMS_VERSION      CMSG_SIGNED_DATA_V3
3975 
3976 #define CMSG_SIGNER_INFO_V1               1
3977 #define CMSG_SIGNER_INFO_V3               3
3978 #define CMSG_SIGNER_INFO_PKCS_1_5_VERSION CMSG_SIGNER_INFO_V1
3979 #define CMSG_SIGNER_INFO_CMS_VERSION      CMSG_SIGNER_INFO_V3
3980 
3981 #define CMSG_HASHED_DATA_V0               0
3982 #define CMSG_HASHED_DATA_V2               2
3983 #define CMSG_HASHED_DATA_PKCS_1_5_VERSION CMSG_HASHED_DATA_V0
3984 #define CMSG_HASHED_DATA_CMS_VERSION      CMSG_HASHED_DATA_V2
3985 
3986 #define CMSG_ENVELOPED_DATA_V0               0
3987 #define CMSG_ENVELOPED_DATA_V2               2
3988 #define CMSG_ENVELOPED_DATA_PKCS_1_5_VERSION CMSG_ENVELOPED_DATA_V0
3989 #define CMSG_ENVELOPED_DATA_CMS_VERSION      CMSG_ENVELOPED_DATA_V2
3990 
3991 typedef struct _CMSG_KEY_TRANS_RECIPIENT_INFO {
3992     DWORD                      dwVersion;
3993     CERT_ID                    RecipientId;
3994     CRYPT_ALGORITHM_IDENTIFIER KeyEncryptionAlgorithm;
3995     CRYPT_DATA_BLOB            EncryptedKey;
3996 } CMSG_KEY_TRANS_RECIPIENT_INFO, *PCMSG_KEY_TRANS_RECIPIENT_INFO;
3997 
3998 typedef struct _CMSG_RECIPIENT_ENCRYPTED_KEY_INFO {
3999     CERT_ID                     RecipientId;
4000     CRYPT_DATA_BLOB             EncryptedKey;
4001     PCRYPT_ATTRIBUTE_TYPE_VALUE pOtherAttr;
4002 } CMSG_RECIPIENT_ENCRYPTED_KEY_INFO, *PCMSG_RECIPIENT_ENCRYPTED_KEY_INFO;
4003 
4004 typedef struct _CMSG_KEY_AGREE_RECIPIENT_INFO {
4005     DWORD                               dwVersion;
4006     DWORD                               dwOriginatorChoice;
4007     union {
4008         CERT_ID              OriginatorCertId;
4009         CERT_PUBLIC_KEY_INFO OriginatorPublicKeyInfo;
4010     } DUMMYUNIONNAME;
4011     CRYPT_ALGORITHM_IDENTIFIER          UserKeyingMaterial;
4012     DWORD                               cRecipientEncryptedKeys;
4013     PCMSG_RECIPIENT_ENCRYPTED_KEY_INFO *rgpRecipientEncryptedKeys;
4014 } CMSG_KEY_AGREE_RECIPIENT_INFO, *PCMSG_KEY_AGREE_RECIPIENT_INFO;
4015 
4016 #define CMSG_KEY_AGREE_ORIGINATOR_CERT       1
4017 #define CMSG_KEY_AGREE_ORIGINATOR_PUBLIC_KEY 2
4018 
4019 typedef struct _CMSG_MAIL_LIST_RECIPIENT_INFO {
4020     DWORD                       dwVersion;
4021     CRYPT_DATA_BLOB             KeyId;
4022     CRYPT_ALGORITHM_IDENTIFIER  KeyEncryptionAlgorithm;
4023     CRYPT_DATA_BLOB             EncryptedKey;
4024     FILETIME                    Date;
4025     PCRYPT_ATTRIBUTE_TYPE_VALUE pOtherAttr;
4026 } CMSG_MAIL_LIST_RECIPIENT_INFO, *PCMSG_MAIL_LIST_RECIPIENT_INFO;
4027 
4028 typedef struct _CMSG_CMS_RECIPIENT_INFO {
4029     DWORD dwRecipientChoice;
4030     union {
4031         PCMSG_KEY_TRANS_RECIPIENT_INFO pKeyTrans;
4032         PCMSG_KEY_AGREE_RECIPIENT_INFO pKeyAgree;
4033         PCMSG_MAIL_LIST_RECIPIENT_INFO pMailList;
4034     } DUMMYUNIONNAME;
4035 } CMSG_CMS_RECIPIENT_INFO, *PCMSG_CMS_RECIPIENT_INFO;
4036 
4037 #define CMSG_ENVELOPED_RECIPIENT_V0     0
4038 #define CMSG_ENVELOPED_RECIPIENT_V2     2
4039 #define CMSG_ENVELOPED_RECIPIENT_V3     3
4040 #define CMSG_ENVELOPED_RECIPIENT_V4     4
4041 #define CMSG_KEY_TRANS_PKCS_1_5_VERSION CMSG_ENVELOPED_RECIPIENT_V0
4042 #define CMSG_KEY_TRANS_CMS_VERSION      CMSG_ENVELOPED_RECIPIENT_V2
4043 #define CMSG_KEY_AGREE_VERSION          CMSG_ENVELOPED_RECIPIENT_V3
4044 #define CMSG_MAIL_LIST_VERSION          CMSG_ENVELOPED_RECIPIENT_V4
4045 
4046 typedef void * (WINAPI *PFN_CMSG_ALLOC)(_In_ size_t cb);
4047 typedef void (WINAPI *PFN_CMSG_FREE)(_Inout_ void *pv);
4048 
4049 typedef struct _CMSG_CONTENT_ENCRYPT_INFO {
4050     DWORD                       cbSize;
4051     HCRYPTPROV                  hCryptProv;
4052     CRYPT_ALGORITHM_IDENTIFIER  ContentEncryptionAlgorithm;
4053     void                       *pvEncryptionAuxInfo;
4054     DWORD                       cRecipients;
4055     PCMSG_RECIPIENT_ENCODE_INFO rgCmsRecipients;
4056     PFN_CMSG_ALLOC              pfnAlloc;
4057     PFN_CMSG_FREE               pfnFree;
4058     DWORD                       dwEncryptFlags;
4059     HCRYPTKEY                   hContentEncryptKey;
4060     DWORD                       dwFlags;
4061 } CMSG_CONTENT_ENCRYPT_INFO, *PCMSG_CONTENT_ENCRYPT_INFO;
4062 
4063 typedef struct _CMSG_KEY_TRANS_ENCRYPT_INFO {
4064     DWORD                       cbSize;
4065     DWORD                       dwRecipientIndex;
4066     CRYPT_ALGORITHM_IDENTIFIER  KeyEncryptionAlgorithm;
4067     CRYPT_DATA_BLOB             EncryptedKey;
4068     DWORD                       dwFlags;
4069 } CMSG_KEY_TRANS_ENCRYPT_INFO, *PCMSG_KEY_TRANS_ENCRYPT_INFO;
4070 
4071 typedef struct _CMSG_CTRL_KEY_TRANS_DECRYPT_PARA {
4072     DWORD                          cbSize;
4073     HCRYPTPROV                     hCryptProv;
4074     DWORD                          dwKeySpec;
4075     PCMSG_KEY_TRANS_RECIPIENT_INFO pKeyTrans;
4076     DWORD                          dwRecipientIndex;
4077 } CMSG_CTRL_KEY_TRANS_DECRYPT_PARA, *PCMSG_CTRL_KEY_TRANS_DECRYPT_PARA;
4078 
4079 typedef struct _CERT_STRONG_SIGN_SERIALIZED_INFO {
4080     DWORD    dwFlags;
4081     WCHAR    *pwszCNGSignHashAlgids;
4082     WCHAR    *pwszCNGPubKeyMinBitLengths;
4083 } CERT_STRONG_SIGN_SERIALIZED_INFO, *PCERT_STRONG_SIGN_SERIALIZED_INFO;
4084 
4085 typedef struct _CERT_STRONG_SIGN_PARA {
4086     DWORD    cbSize;
4087     DWORD    dwInfoChoice;
4088     union {
4089         void                               *pvInfo;
4090         CERT_STRONG_SIGN_SERIALIZED_INFO   *pSerializedInfo;
4091         char                               *pszOID;
4092     } DUMMYUNIONNAME;
4093 } CERT_STRONG_SIGN_PARA, *PCERT_STRONG_SIGN_PARA;
4094 
4095 typedef BOOL
4096 (WINAPI *PFN_CMSG_GEN_CONTENT_ENCRYPT_KEY)(
4097   _Inout_ PCMSG_CONTENT_ENCRYPT_INFO pContentEncryptInfo,
4098   _In_ DWORD dwFlags,
4099   _Reserved_ void *pvReserved);
4100 
4101 typedef BOOL
4102 (WINAPI *PFN_CMSG_EXPORT_KEY_TRANS)(
4103   _In_ PCMSG_CONTENT_ENCRYPT_INFO pContentEncryptInfo,
4104   _In_ PCMSG_KEY_TRANS_RECIPIENT_ENCODE_INFO pKeyTransEncodeInfo,
4105   _Inout_ PCMSG_KEY_TRANS_ENCRYPT_INFO pKeyTransEncryptInfo,
4106   _In_ DWORD dwFlags,
4107   _Reserved_ void *pvReserved);
4108 
4109 typedef BOOL
4110 (WINAPI *PFN_CMSG_IMPORT_KEY_TRANS)(
4111   _In_ PCRYPT_ALGORITHM_IDENTIFIER pContentEncryptionAlgorithm,
4112   _In_ PCMSG_CTRL_KEY_TRANS_DECRYPT_PARA pKeyTransDecryptPara,
4113   _In_ DWORD dwFlags,
4114   _Reserved_ void *pvReserved,
4115   _Out_ HCRYPTKEY *phContentEncryptKey);
4116 
4117 /* CryptMsgGetAndVerifySigner flags */
4118 #define CMSG_TRUSTED_SIGNER_FLAG   0x1
4119 #define CMSG_SIGNER_ONLY_FLAG      0x2
4120 #define CMSG_USE_SIGNER_INDEX_FLAG 0x4
4121 
4122 /* CryptMsgSignCTL flags */
4123 #define CMSG_CMS_ENCAPSULATED_CTL_FLAG 0x00008000
4124 
4125 /* CryptMsgEncodeAndSignCTL flags */
4126 #define CMSG_ENCODED_SORTED_CTL_FLAG               0x1
4127 #define CMSG_ENCODE_HASHED_SUBJECT_IDENTIFIER_FLAG 0x2
4128 
4129 /* PFXImportCertStore flags */
4130 #define CRYPT_USER_KEYSET           0x00001000
4131 #define PKCS12_IMPORT_RESERVED_MASK 0xffff0000
4132 /* PFXExportCertStore flags */
4133 #define REPORT_NO_PRIVATE_KEY                 0x00000001
4134 #define REPORT_NOT_ABLE_TO_EXPORT_PRIVATE_KEY 0x00000002
4135 #define EXPORT_PRIVATE_KEYS                   0x00000004
4136 #define PKCS12_EXPORT_RESERVED_MASK           0xffff0000
4137 
4138 #define CRYPT_USERDATA 0x00000001
4139 
4140 /* function declarations */
4141 /* advapi32.dll */
4142 WINADVAPI
4143 BOOL
4144 WINAPI
4145 CryptAcquireContextA(
4146   _Out_ HCRYPTPROV *,
4147   _In_opt_ LPCSTR,
4148   _In_opt_ LPCSTR,
4149   _In_ DWORD,
4150   _In_ DWORD);
4151 
4152 WINADVAPI
4153 BOOL
4154 WINAPI
4155 CryptAcquireContextW(
4156   _Out_ HCRYPTPROV *,
4157   _In_opt_ LPCWSTR,
4158   _In_opt_ LPCWSTR,
4159   _In_ DWORD,
4160   _In_ DWORD);
4161 
4162 #define CryptAcquireContext WINELIB_NAME_AW(CryptAcquireContext)
4163 
4164 WINADVAPI
4165 BOOL
4166 WINAPI
4167 CryptGenRandom(
4168   _In_ HCRYPTPROV hProv,
4169   _In_ DWORD dwLen,
4170   _Inout_updates_bytes_(dwLen) BYTE *pbBuffer);
4171 
4172 WINADVAPI
4173 BOOL
4174 WINAPI
4175 CryptContextAddRef(
4176   _In_ HCRYPTPROV,
4177   _Reserved_ DWORD *,
4178   _In_ DWORD);
4179 
4180 WINADVAPI
4181 BOOL
4182 WINAPI
4183 CryptCreateHash(
4184   _In_ HCRYPTPROV,
4185   _In_ ALG_ID,
4186   _In_ HCRYPTKEY,
4187   _In_ DWORD,
4188   _Out_ HCRYPTHASH *);
4189 
4190 _Success_(return != 0)
4191 WINADVAPI
4192 BOOL
4193 WINAPI
4194 CryptDecrypt(
4195   _In_ HCRYPTKEY hKey,
4196   _In_ HCRYPTHASH hHash,
4197   _In_ BOOL Final,
4198   _In_ DWORD dwFlags,
4199   _Inout_updates_bytes_to_(*pdwDataLen, *pdwDataLen) BYTE *pbData,
4200   _Inout_ DWORD *pdwDataLen);
4201 
4202 WINADVAPI
4203 BOOL
4204 WINAPI
4205 CryptDeriveKey(
4206   _In_ HCRYPTPROV,
4207   _In_ ALG_ID,
4208   _In_ HCRYPTHASH,
4209   _In_ DWORD,
4210   _Out_ HCRYPTKEY *);
4211 
4212 WINADVAPI BOOL WINAPI CryptDestroyHash(_In_ HCRYPTHASH);
4213 WINADVAPI BOOL WINAPI CryptDestroyKey(_In_ HCRYPTKEY);
4214 
4215 WINADVAPI
4216 BOOL
4217 WINAPI
4218 CryptDuplicateKey(
4219   _In_ HCRYPTKEY,
4220   _Reserved_ DWORD *,
4221   _In_ DWORD,
4222   _Out_ HCRYPTKEY *);
4223 
4224 WINADVAPI
4225 BOOL
4226 WINAPI
4227 CryptDuplicateHash(
4228   _In_ HCRYPTHASH,
4229   _Reserved_ DWORD *,
4230   _In_ DWORD,
4231   _Out_ HCRYPTHASH *);
4232 
4233 _Success_(return != 0)
4234 WINADVAPI
4235 BOOL
4236 WINAPI
4237 CryptEncrypt(
4238   _In_ HCRYPTKEY hKey,
4239   _In_ HCRYPTHASH hHash,
4240   _In_ BOOL Final,
4241   _In_ DWORD dwFlags,
4242   _Inout_updates_bytes_to_opt_(dwBufLen, *pdwDataLen) BYTE *pbData,
4243   _Inout_ DWORD *pdwDataLen,
4244   _In_ DWORD dwBufLen);
4245 
4246 _Success_(return != 0)
4247 WINADVAPI
4248 BOOL
4249 WINAPI
4250 CryptEnumProvidersA(
4251   _In_ DWORD dwIndex,
4252   _Reserved_ DWORD *pdwReserved,
4253   _In_ DWORD dwFlags,
4254   _Out_ DWORD *pdwProvType,
4255   _Out_writes_bytes_to_opt_(*pcbProvName, *pcbProvName) LPSTR szProvName,
4256   _Inout_ DWORD *pcbProvName);
4257 
4258 _Success_(return != 0)
4259 WINADVAPI
4260 BOOL
4261 WINAPI
4262 CryptEnumProvidersW(
4263   _In_ DWORD dwIndex,
4264   _Reserved_ DWORD *pdwReserved,
4265   _In_ DWORD dwFlags,
4266   _Out_ DWORD *pdwProvType,
4267   _Out_writes_bytes_to_opt_(*pcbProvName, *pcbProvName) LPWSTR szProvName,
4268   _Inout_ DWORD *pcbProvName);
4269 
4270 #define CryptEnumProviders WINELIB_NAME_AW(CryptEnumProviders)
4271 
4272 _Success_(return != 0)
4273 WINADVAPI
4274 BOOL
4275 WINAPI
4276 CryptEnumProviderTypesA(
4277   _In_ DWORD dwIndex,
4278   _Reserved_ DWORD *pdwReserved,
4279   _In_ DWORD dwFlags,
4280   _Out_ DWORD *pdwProvType,
4281   _Out_writes_bytes_to_opt_(*pcbTypeName, *pcbTypeName) LPSTR szTypeName,
4282   _Inout_ DWORD *pcbTypeName);
4283 
4284 _Success_(return != 0)
4285 WINADVAPI
4286 BOOL
4287 WINAPI
4288 CryptEnumProviderTypesW(
4289   _In_ DWORD dwIndex,
4290   _Reserved_ DWORD *pdwReserved,
4291   _In_ DWORD dwFlags,
4292   _Out_ DWORD *pdwProvType,
4293   _Out_writes_bytes_to_opt_(*pcbTypeName, *pcbTypeName) LPWSTR szTypeName,
4294   _Inout_ DWORD *pcbTypeName);
4295 
4296 #define CryptEnumProviderTypes WINELIB_NAME_AW(CryptEnumProviderTypes)
4297 
4298 WINADVAPI
4299 BOOL
4300 WINAPI
4301 CryptExportKey(
4302   _In_ HCRYPTKEY hKey,
4303   _In_ HCRYPTKEY hExpKey,
4304   _In_ DWORD dwBlobType,
4305   _In_ DWORD dwFlags,
4306   _Out_writes_bytes_to_opt_(*pdwDataLen, *pdwDataLen) BYTE *pbData,
4307   _Inout_ DWORD *pdwDataLen);
4308 
4309 WINADVAPI
4310 BOOL
4311 WINAPI
4312 CryptGenKey(
4313   _In_ HCRYPTPROV,
4314   _In_ ALG_ID,
4315   _In_ DWORD,
4316   _Out_ HCRYPTKEY *);
4317 
4318 WINADVAPI
4319 BOOL
4320 WINAPI
4321 CryptGetKeyParam(
4322   _In_ HCRYPTKEY hKey,
4323   _In_ DWORD dwParam,
4324   _Out_writes_bytes_to_opt_(*pdwDataLen, *pdwDataLen) BYTE *pbData,
4325   _Inout_ DWORD *pdwDataLen,
4326   _In_ DWORD dwFlags);
4327 
4328 WINADVAPI
4329 BOOL
4330 WINAPI
4331 CryptGetHashParam(
4332   _In_ HCRYPTHASH hHash,
4333   _In_ DWORD dwParam,
4334   _Out_writes_bytes_to_opt_(*pdwDataLen, *pdwDataLen) BYTE *pbData,
4335   _Inout_ DWORD *pdwDataLen,
4336   _In_ DWORD dwFlags);
4337 
4338 WINADVAPI
4339 BOOL
4340 WINAPI
4341 CryptGetProvParam(
4342   _In_ HCRYPTPROV hProv,
4343   _In_ DWORD dwParam,
4344   _Out_writes_bytes_to_opt_(*pdwDataLen, *pdwDataLen) BYTE *pbData,
4345   _Inout_ DWORD *pdwDataLen,
4346   _In_ DWORD dwFlags);
4347 
4348 _Success_(return != 0)
4349 WINADVAPI
4350 BOOL
4351 WINAPI
4352 CryptGetDefaultProviderA(
4353   _In_ DWORD dwProvType,
4354   _Reserved_ DWORD *pdwReserved,
4355   _In_ DWORD dwFlags,
4356   _Out_writes_bytes_to_opt_(*pcbProvName, *pcbProvName) LPSTR pszProvName,
4357   _Inout_ DWORD *pcbProvName);
4358 
4359 _Success_(return != 0)
4360 WINADVAPI
4361 BOOL
4362 WINAPI
4363 CryptGetDefaultProviderW(
4364   _In_ DWORD dwProvType,
4365   _Reserved_ DWORD *pdwReserved,
4366   _In_ DWORD dwFlags,
4367   _Out_writes_bytes_to_opt_(*pcbProvName, *pcbProvName) LPWSTR pszProvName,
4368   _Inout_ DWORD *pcbProvName);
4369 
4370 #define CryptGetDefaultProvider WINELIB_NAME_AW(CryptGetDefaultProvider)
4371 
4372 WINADVAPI BOOL WINAPI CryptGetUserKey(_In_ HCRYPTPROV, _In_ DWORD, _Out_ HCRYPTKEY *);
4373 
4374 WINADVAPI
4375 BOOL
4376 WINAPI
4377 CryptHashData(
4378   _In_ HCRYPTHASH hHash,
4379   _In_reads_bytes_(dwDataLen) CONST BYTE *pbData,
4380   _In_ DWORD dwDataLen,
4381   _In_ DWORD dwFlags);
4382 
4383 WINADVAPI BOOL WINAPI CryptHashSessionKey(_In_ HCRYPTHASH, _In_ HCRYPTKEY, _In_ DWORD);
4384 
4385 WINADVAPI
4386 BOOL
4387 WINAPI
4388 CryptImportKey(
4389   _In_ HCRYPTPROV hProv,
4390   _In_reads_bytes_(dwDataLen) CONST BYTE *pbData,
4391   _In_ DWORD dwDataLen,
4392   _In_ HCRYPTKEY hPubKey,
4393   _In_ DWORD dwFlags,
4394   _Out_ HCRYPTKEY *phKey);
4395 
4396 #if (NTDDI_VERSION >= NTDDI_WINXP)
4397 WINADVAPI BOOL WINAPI CryptReleaseContext(_In_ HCRYPTPROV, _In_ DWORD);
4398 #else
4399 WINADVAPI BOOL WINAPI CryptReleaseContext(_In_ HCRYPTPROV, _In_ ULONG_PTR);
4400 #endif
4401 
4402 WINADVAPI
4403 BOOL
4404 WINAPI
4405 CryptSetHashParam(
4406   _In_ HCRYPTHASH,
4407   _In_ DWORD,
4408   _In_ CONST BYTE *,
4409   _In_ DWORD);
4410 
4411 WINADVAPI
4412 BOOL
4413 WINAPI
4414 CryptSetKeyParam(
4415   _In_ HCRYPTKEY,
4416   _In_ DWORD,
4417   _In_ CONST BYTE *,
4418   _In_ DWORD);
4419 
4420 WINADVAPI BOOL WINAPI CryptSetProviderA(_In_ LPCSTR, _In_ DWORD);
4421 WINADVAPI BOOL WINAPI CryptSetProviderW(_In_ LPCWSTR, _In_ DWORD);
4422 
4423 #define CryptSetProvider WINELIB_NAME_AW(CryptSetProvider)
4424 
4425 WINADVAPI
4426 BOOL
4427 WINAPI
4428 CryptSetProviderExA(
4429   _In_ LPCSTR,
4430   _In_ DWORD,
4431   _Reserved_ DWORD *,
4432   _In_ DWORD);
4433 
4434 WINADVAPI
4435 BOOL
4436 WINAPI
4437 CryptSetProviderExW(
4438   _In_ LPCWSTR,
4439   _In_ DWORD,
4440   _Reserved_ DWORD *,
4441   _In_ DWORD);
4442 
4443 #define CryptSetProviderEx WINELIB_NAME_AW(CryptSetProviderEx)
4444 
4445 WINADVAPI BOOL WINAPI CryptSetProvParam(_In_ HCRYPTPROV, _In_ DWORD, _In_ CONST BYTE *, _In_ DWORD);
4446 
4447 WINADVAPI
4448 BOOL
4449 WINAPI
4450 CryptSignHashA(
4451   _In_ HCRYPTHASH hHash,
4452   _In_ DWORD dwKeySpec,
4453   _In_opt_ LPCSTR szDescription,
4454   _In_ DWORD dwFlags,
4455   _Out_writes_bytes_to_opt_(*pdwSigLen, *pdwSigLen) BYTE *pbSignature,
4456   _Inout_ DWORD *pdwSigLen);
4457 
4458 WINADVAPI
4459 BOOL
4460 WINAPI
4461 CryptSignHashW(
4462   _In_ HCRYPTHASH hHash,
4463   _In_ DWORD dwKeySpec,
4464   _In_opt_ LPCWSTR szDescription,
4465   _In_ DWORD dwFlags,
4466   _Out_writes_bytes_to_opt_(*pdwSigLen, *pdwSigLen) BYTE *pbSignature,
4467   _Inout_ DWORD *pdwSigLen);
4468 
4469 #define CryptSignHash WINELIB_NAME_AW(CryptSignHash)
4470 
4471 WINADVAPI
4472 BOOL
4473 WINAPI
4474 CryptVerifySignatureA(
4475   _In_ HCRYPTHASH hHash,
4476   _In_reads_bytes_(dwSigLen) CONST BYTE *pbSignature,
4477   _In_ DWORD dwSigLen,
4478   _In_ HCRYPTKEY hPubKey,
4479   _In_opt_ LPCSTR szDescription,
4480   _In_ DWORD dwFlags);
4481 
4482 WINADVAPI
4483 BOOL
4484 WINAPI
4485 CryptVerifySignatureW(
4486   _In_ HCRYPTHASH hHash,
4487   _In_reads_bytes_(dwSigLen) CONST BYTE *pbSignature,
4488   _In_ DWORD dwSigLen,
4489   _In_ HCRYPTKEY hPubKey,
4490   _In_opt_ LPCWSTR szDescription,
4491   _In_ DWORD dwFlags);
4492 
4493 #define CryptVerifySignature WINELIB_NAME_AW(CryptVerifySignature)
4494 
4495 /* crypt32.dll functions */
4496 LPVOID WINAPI CryptMemAlloc(_In_ ULONG cbSize) __WINE_ALLOC_SIZE(1);
4497 LPVOID WINAPI CryptMemRealloc(_In_opt_ LPVOID pv, _In_ ULONG cbSize) __WINE_ALLOC_SIZE(2);
4498 VOID   WINAPI CryptMemFree(_In_opt_ LPVOID pv);
4499 
4500 _Success_(return != 0)
4501 BOOL
4502 WINAPI
4503 CryptBinaryToStringA(
4504   _In_reads_bytes_(cbBinary) const BYTE *pbBinary,
4505   _In_ DWORD cbBinary,
4506   _In_ DWORD dwFlags,
4507   _Out_writes_to_opt_(*pcchString, *pcchString) LPSTR pszString,
4508   _Inout_ DWORD *pcchString);
4509 
4510 _Success_(return != 0)
4511 BOOL
4512 WINAPI
4513 CryptBinaryToStringW(
4514   _In_reads_bytes_(cbBinary) const BYTE *pbBinary,
4515   _In_ DWORD cbBinary,
4516   _In_ DWORD dwFlags,
4517   _Out_writes_to_opt_(*pcchString, *pcchString) LPWSTR pszString,
4518   _Inout_ DWORD *pcchString);
4519 
4520 #define CryptBinaryToString WINELIB_NAME_AW(CryptBinaryToString)
4521 
4522 BOOL
4523 WINAPI
4524 CryptStringToBinaryA(
4525   _In_reads_(cchString) LPCSTR pszString,
4526   _In_ DWORD cchString,
4527   _In_ DWORD dwFlags,
4528   _Out_writes_bytes_to_opt_(*pcbBinary, *pcbBinary) BYTE *pbBinary,
4529   _Inout_ DWORD  *pcbBinary,
4530   _Out_opt_ DWORD *pdwSkip,
4531   _Out_opt_ DWORD *pdwFlags);
4532 
4533 BOOL
4534 WINAPI
4535 CryptStringToBinaryW(
4536   _In_reads_(cchString) LPCWSTR pszString,
4537   _In_ DWORD cchString,
4538   _In_ DWORD dwFlags,
4539   _Out_writes_bytes_to_opt_(*pcbBinary, *pcbBinary) BYTE *pbBinary,
4540   _Inout_ DWORD  *pcbBinary,
4541   _Out_opt_ DWORD *pdwSkip,
4542   _Out_opt_ DWORD *pdwFlags);
4543 
4544 #define CryptStringToBinary WINELIB_NAME_AW(CryptStringToBinary)
4545 
4546 BOOL
4547 WINAPI
4548 CryptCreateAsyncHandle(
4549   _In_ DWORD dwFlags,
4550   _Out_ PHCRYPTASYNC phAsync);
4551 
4552 BOOL
4553 WINAPI
4554 CryptSetAsyncParam(
4555   _In_ HCRYPTASYNC hAsync,
4556   _In_ LPSTR pszParamOid,
4557   _In_opt_ LPVOID pvParam,
4558   __callback PFN_CRYPT_ASYNC_PARAM_FREE_FUNC pfnFree);
4559 
4560 BOOL
4561 WINAPI
4562 CryptGetAsyncParam(
4563   _In_ HCRYPTASYNC hAsync,
4564   _In_ LPSTR pszParamOid,
4565   _Outptr_opt_result_maybenull_ LPVOID* ppvParam,
4566   _Outptr_opt_result_maybenull_ __callback PFN_CRYPT_ASYNC_PARAM_FREE_FUNC* ppfnFree);
4567 
4568 BOOL
4569 WINAPI
4570 CryptRegisterDefaultOIDFunction(
4571   _In_ DWORD,
4572   _In_ LPCSTR,
4573   _In_ DWORD,
4574   _In_ LPCWSTR);
4575 
4576 BOOL
4577 WINAPI
4578 CryptRegisterOIDFunction(
4579   _In_ DWORD,
4580   _In_ LPCSTR,
4581   _In_ LPCSTR,
4582   _In_opt_ LPCWSTR,
4583   _In_opt_ LPCSTR);
4584 
4585 BOOL
4586 WINAPI
4587 CryptGetOIDFunctionValue(
4588   _In_ DWORD dwEncodingType,
4589   _In_ LPCSTR pszFuncName,
4590   _In_ LPCSTR pszOID,
4591   _In_opt_ LPCWSTR pwszValueName,
4592   _Out_opt_ DWORD *pdwValueType,
4593   _Out_writes_bytes_to_opt_(*pcbValueData, *pcbValueData) BYTE *pbValueData,
4594   _Inout_opt_ DWORD *pcbValueData);
4595 
4596 BOOL
4597 WINAPI
4598 CryptSetOIDFunctionValue(
4599   _In_ DWORD dwEncodingType,
4600   _In_ LPCSTR pszFuncName,
4601   _In_ LPCSTR pszOID,
4602   _In_opt_ LPCWSTR pwszValueName,
4603   _In_ DWORD dwValueType,
4604   _In_reads_bytes_opt_(cbValueData) const BYTE *pbValueData,
4605   _In_ DWORD cbValueData);
4606 
4607 BOOL WINAPI CryptUnregisterDefaultOIDFunction(_In_ DWORD, _In_ LPCSTR, _In_ LPCWSTR);
4608 BOOL WINAPI CryptUnregisterOIDFunction(_In_ DWORD, _In_ LPCSTR, _In_ LPCSTR);
4609 
4610 BOOL
4611 WINAPI
4612 CryptEnumOIDFunction(
4613   _In_ DWORD dwEncodingType,
4614   _In_opt_ LPCSTR pszFuncName,
4615   _In_opt_ LPCSTR pszOID,
4616   _In_ DWORD dwFlags,
4617   _Inout_opt_ void *pvArg,
4618   __callback PFN_CRYPT_ENUM_OID_FUNC pfnEnumOIDFunc);
4619 
4620 HCRYPTOIDFUNCSET WINAPI CryptInitOIDFunctionSet(_In_ LPCSTR, _In_ DWORD);
4621 
4622 _Success_(return != 0)
4623 BOOL
4624 WINAPI
4625 CryptGetDefaultOIDDllList(
4626   _In_ HCRYPTOIDFUNCSET hFuncSet,
4627   _In_ DWORD dwEncodingType,
4628   _Out_writes_to_opt_(*pcchDllList, *pcchDllList) _Post_ _NullNull_terminated_ WCHAR *pwszDllList,
4629   _Inout_ DWORD *pcchDllList);
4630 
4631 _Success_(return != 0)
4632 BOOL
4633 WINAPI
4634 CryptGetDefaultOIDFunctionAddress(
4635   _In_ HCRYPTOIDFUNCSET hFuncSet,
4636   _In_ DWORD dwEncodingType,
4637   _In_opt_ LPCWSTR pwszDll,
4638   _In_ DWORD dwFlags,
4639   _Outptr_ void **ppvFuncAddr,
4640   _Inout_ HCRYPTOIDFUNCADDR *phFuncAddr);
4641 
4642 _Success_(return != 0)
4643 BOOL
4644 WINAPI
4645 CryptGetOIDFunctionAddress(
4646   _In_ HCRYPTOIDFUNCSET hFuncSet,
4647   _In_ DWORD dwEncodingType,
4648   _In_ LPCSTR pszOID,
4649   _In_ DWORD dwFlags,
4650   _Outptr_ void **ppvFuncAddr,
4651   _Out_ HCRYPTOIDFUNCADDR *phFuncAddr);
4652 
4653 BOOL
4654 WINAPI
4655 CryptFreeOIDFunctionAddress(
4656   _In_ HCRYPTOIDFUNCADDR hFuncAddr,
4657   _In_ DWORD dwFlags);
4658 
4659 BOOL
4660 WINAPI
4661 CryptInstallOIDFunctionAddress(
4662   _In_opt_ HMODULE hModule,
4663   _In_ DWORD dwEncodingType,
4664   _In_ LPCSTR pszFuncName,
4665   _In_ DWORD cFuncEntry,
4666   _In_reads_(cFuncEntry) const CRYPT_OID_FUNC_ENTRY rgFuncEntry[],
4667   _In_ DWORD dwFlags);
4668 
4669 BOOL
4670 WINAPI
4671 CryptInstallDefaultContext(
4672   _In_ HCRYPTPROV hCryptProv,
4673   _In_ DWORD dwDefaultType,
4674   _In_opt_ const void *pvDefaultPara,
4675   _In_ DWORD dwFlags,
4676   _Reserved_ void *pvReserved,
4677   _Out_ HCRYPTDEFAULTCONTEXT *phDefaultContext);
4678 
4679 BOOL
4680 WINAPI
4681 CryptUninstallDefaultContext(
4682   _In_opt_ HCRYPTDEFAULTCONTEXT hDefaultContext,
4683   _In_ DWORD dwFlags,
4684   _Reserved_ void *pvReserved);
4685 
4686 BOOL
4687 WINAPI
4688 CryptEnumOIDInfo(
4689   _In_ DWORD dwGroupId,
4690   _In_ DWORD dwFlags,
4691   _Inout_opt_ void *pvArg,
4692   __callback PFN_CRYPT_ENUM_OID_INFO pfnEnumOIDInfo);
4693 
4694 PCCRYPT_OID_INFO
4695 WINAPI
4696 CryptFindOIDInfo(
4697   _In_ DWORD dwKeyType,
4698   _In_ void *pvKey,
4699   _In_ DWORD dwGroupId);
4700 
4701 BOOL WINAPI CryptRegisterOIDInfo(_In_ PCCRYPT_OID_INFO pInfo, _In_ DWORD dwFlags);
4702 BOOL WINAPI CryptUnregisterOIDInfo(_In_ PCCRYPT_OID_INFO pInfo);
4703 
4704 LPCWSTR WINAPI CryptFindLocalizedName(_In_ LPCWSTR pwszCryptName);
4705 
4706 LPCSTR WINAPI CertAlgIdToOID(_In_ DWORD dwAlgId);
4707 DWORD WINAPI CertOIDToAlgId(_In_ LPCSTR pszObjId);
4708 
4709 /* cert store functions */
4710 _Must_inspect_result_
4711 HCERTSTORE
4712 WINAPI
4713 CertOpenStore(
4714   _In_ LPCSTR lpszStoreProvider,
4715   _In_ DWORD dwEncodingType,
4716   _In_opt_ HCRYPTPROV_LEGACY hCryptProv,
4717   _In_ DWORD dwFlags,
4718   _In_opt_ const void *pvPara);
4719 
4720 HCERTSTORE
4721 WINAPI
4722 CertOpenSystemStoreA(
4723   _In_opt_ HCRYPTPROV_LEGACY hProv,
4724   _In_ LPCSTR szSubsystemProtocol);
4725 
4726 HCERTSTORE
4727 WINAPI
4728 CertOpenSystemStoreW(
4729   _In_opt_ HCRYPTPROV_LEGACY hProv,
4730   _In_ LPCWSTR szSubSystemProtocol);
4731 
4732 #define CertOpenSystemStore WINELIB_NAME_AW(CertOpenSystemStore)
4733 
4734 PCCERT_CONTEXT
4735 WINAPI
4736 CertEnumCertificatesInStore(
4737   _In_ HCERTSTORE hCertStore,
4738   _In_opt_ PCCERT_CONTEXT pPrev);
4739 
4740 PCCRL_CONTEXT
4741 WINAPI
4742 CertEnumCRLsInStore(
4743   _In_ HCERTSTORE hCertStore,
4744   _In_opt_ PCCRL_CONTEXT pPrevCrlContext);
4745 
4746 PCCTL_CONTEXT
4747 WINAPI
4748 CertEnumCTLsInStore(
4749   _In_ HCERTSTORE hCertStore,
4750   _In_opt_ PCCTL_CONTEXT pPrevCtlContext);
4751 
4752 BOOL
4753 WINAPI
4754 CertEnumSystemStoreLocation(
4755   _In_ DWORD dwFlags,
4756   _Inout_opt_ void *pvArg,
4757   __callback PFN_CERT_ENUM_SYSTEM_STORE_LOCATION pfnEnum);
4758 
4759 BOOL
4760 WINAPI
4761 CertEnumSystemStore(
4762   _In_ DWORD dwFlags,
4763   _In_opt_ void *pvSystemStoreLocationPara,
4764   _Inout_opt_ void *pvArg,
4765   __callback PFN_CERT_ENUM_SYSTEM_STORE pfnEnum);
4766 
4767 BOOL
4768 WINAPI
4769 CertRegisterSystemStore(
4770   _In_ const void *pvSystemStore,
4771   _In_ DWORD dwFlags,
4772   _In_opt_ PCERT_SYSTEM_STORE_INFO pStoreInfo,
4773   _Reserved_ void *pvReserved);
4774 
4775 BOOL
4776 WINAPI
4777 CertUnregisterSystemStore(
4778   _In_ const void *pvSystemStore,
4779   _In_ DWORD dwFlags);
4780 
4781 BOOL
4782 WINAPI
4783 CertEnumPhysicalStore(
4784   _In_ const void *pvSystemStore,
4785   _In_ DWORD dwFlags,
4786   _Inout_opt_ void *pvArg,
4787   __callback PFN_CERT_ENUM_PHYSICAL_STORE pfnEnum);
4788 
4789 BOOL
4790 WINAPI
4791 CertRegisterPhysicalStore(
4792   _In_ const void *pvSystemStore,
4793   _In_ DWORD dwFlags,
4794   _In_ LPCWSTR pwszStoreName,
4795   _In_ PCERT_PHYSICAL_STORE_INFO pStoreInfo,
4796   _Reserved_ void *pvReserved);
4797 
4798 BOOL
4799 WINAPI
4800 CertSaveStore(
4801   _In_ HCERTSTORE hCertStore,
4802   _In_ DWORD dwEncodingType,
4803   _In_ DWORD dwSaveAs,
4804   _In_ DWORD dwSaveTo,
4805   _Inout_ void *pvSaveToPara,
4806   _In_ DWORD dwFlags);
4807 
4808 BOOL
4809 WINAPI
4810 CertAddStoreToCollection(
4811   _In_ HCERTSTORE hCollectionStore,
4812   _In_opt_ HCERTSTORE hSiblingStore,
4813   _In_ DWORD dwUpdateFlags,
4814   _In_ DWORD dwPriority);
4815 
4816 void
4817 WINAPI
4818 CertRemoveStoreFromCollection(
4819   _In_ HCERTSTORE hCollectionStore,
4820   _In_ HCERTSTORE hSiblingStore);
4821 
4822 _Success_(return != 0)
4823 BOOL
4824 WINAPI
4825 CertCreateCertificateChainEngine(
4826   _In_ PCERT_CHAIN_ENGINE_CONFIG pConfig,
4827   _Out_ HCERTCHAINENGINE *phChainEngine);
4828 
4829 BOOL WINAPI CertResyncCertificateChainEngine(_In_opt_ HCERTCHAINENGINE hChainEngine);
4830 
4831 VOID WINAPI CertFreeCertificateChainEngine(_In_opt_ HCERTCHAINENGINE hChainEngine);
4832 
4833 _Success_(return != 0)
4834 BOOL
4835 WINAPI
4836 CertGetCertificateChain(
4837   _In_opt_ HCERTCHAINENGINE hChainEngine,
4838   _In_ PCCERT_CONTEXT pCertContext,
4839   _In_opt_ LPFILETIME pTime,
4840   _In_opt_ HCERTSTORE hAdditionalStore,
4841   _In_ PCERT_CHAIN_PARA pChainPara,
4842   _In_ DWORD dwFlags,
4843   _Reserved_ LPVOID pvReserved,
4844   _Out_ PCCERT_CHAIN_CONTEXT* ppChainContext);
4845 
4846 PCCERT_CHAIN_CONTEXT
4847 WINAPI
4848 CertDuplicateCertificateChain(
4849   _In_ PCCERT_CHAIN_CONTEXT pChainContext);
4850 
4851 VOID WINAPI CertFreeCertificateChain(_In_ PCCERT_CHAIN_CONTEXT pChainContext);
4852 
4853 PCCERT_CHAIN_CONTEXT
4854 WINAPI
4855 CertFindChainInStore(
4856   _In_ HCERTSTORE hCertStore,
4857   _In_ DWORD dwCertEncodingType,
4858   _In_ DWORD dwFindFlags,
4859   _In_ DWORD dwFindType,
4860   _In_opt_ const void *pvFindPara,
4861   _In_opt_ PCCERT_CHAIN_CONTEXT pPrevChainContext);
4862 
4863 BOOL
4864 WINAPI
4865 CertVerifyCertificateChainPolicy(
4866   _In_ LPCSTR pszPolicyOID,
4867   _In_ PCCERT_CHAIN_CONTEXT pChainContext,
4868   _In_ PCERT_CHAIN_POLICY_PARA pPolicyPara,
4869   _Inout_ PCERT_CHAIN_POLICY_STATUS pPolicyStatus);
4870 
4871 DWORD
4872 WINAPI
4873 CertEnumCertificateContextProperties(
4874   _In_ PCCERT_CONTEXT pCertContext,
4875   _In_ DWORD dwPropId);
4876 
4877 BOOL
4878 WINAPI
4879 CertGetCertificateContextProperty(
4880   _In_ PCCERT_CONTEXT pCertContext,
4881   _In_ DWORD dwPropId,
4882   _Out_writes_bytes_to_opt_(*pcbData, *pcbData) void *pvData,
4883   _Inout_ DWORD *pcbData);
4884 
4885 BOOL
4886 WINAPI
4887 CertSetCertificateContextProperty(
4888   _In_ PCCERT_CONTEXT pCertContext,
4889   _In_ DWORD dwPropId,
4890   _In_ DWORD dwFlags,
4891   _In_opt_ const void *pvData);
4892 
4893 DWORD
4894 WINAPI
4895 CertEnumCRLContextProperties(
4896   _In_ PCCRL_CONTEXT pCRLContext,
4897   _In_ DWORD dwPropId);
4898 
4899 BOOL
4900 WINAPI
4901 CertGetCRLContextProperty(
4902   _In_ PCCRL_CONTEXT pCrlContext,
4903   _In_ DWORD dwPropId,
4904   _Out_writes_bytes_to_opt_(*pcbData, *pcbData) void *pvData,
4905   _Inout_ DWORD *pcbData);
4906 
4907 BOOL
4908 WINAPI
4909 CertSetCRLContextProperty(
4910   _In_ PCCRL_CONTEXT pCrlContext,
4911   _In_ DWORD dwPropId,
4912   _In_ DWORD dwFlags,
4913   _In_opt_ const void *pvData);
4914 
4915 DWORD
4916 WINAPI
4917 CertEnumCTLContextProperties(
4918   _In_ PCCTL_CONTEXT pCTLContext,
4919   _In_ DWORD dwPropId);
4920 
4921 BOOL
4922 WINAPI
4923 CertEnumSubjectInSortedCTL(
4924   _In_ PCCTL_CONTEXT pCtlContext,
4925   _Inout_ void **ppvNextSubject,
4926   _Out_opt_ PCRYPT_DER_BLOB pSubjectIdentifier,
4927   _Out_opt_ PCRYPT_DER_BLOB pEncodedAttributes);
4928 
4929 BOOL
4930 WINAPI
4931 CertGetCTLContextProperty(
4932   _In_ PCCTL_CONTEXT pCtlContext,
4933   _In_ DWORD dwPropId,
4934   _Out_writes_bytes_to_opt_(*pcbData, *pcbData) void *pvData,
4935   _Inout_ DWORD *pcbData);
4936 
4937 BOOL
4938 WINAPI
4939 CertSetCTLContextProperty(
4940   _In_ PCCTL_CONTEXT pCtlContext,
4941   _In_ DWORD dwPropId,
4942   _In_ DWORD dwFlags,
4943   _In_opt_ const void *pvData);
4944 
4945 _Success_(return != 0)
4946 BOOL
4947 WINAPI
4948 CertGetStoreProperty(
4949   _In_ HCERTSTORE hCertStore,
4950   _In_ DWORD dwPropId,
4951   _Out_writes_bytes_to_opt_(*pcbData, *pcbData) void *pvData,
4952   _Inout_ DWORD *pcbData);
4953 
4954 BOOL
4955 WINAPI
4956 CertSetStoreProperty(
4957   _In_ HCERTSTORE hCertStore,
4958   _In_ DWORD dwPropId,
4959   _In_ DWORD dwFlags,
4960   _In_opt_ const void *pvData);
4961 
4962 BOOL
4963 WINAPI
4964 CertControlStore(
4965   _In_ HCERTSTORE hCertStore,
4966   _In_ DWORD dwFlags,
4967   _In_ DWORD dwCtrlType,
4968   _In_opt_ void const *pvCtrlPara);
4969 
4970 HCERTSTORE WINAPI CertDuplicateStore(_In_ HCERTSTORE hCertStore);
4971 
4972 BOOL WINAPI CertCloseStore(_In_opt_ HCERTSTORE hCertStore, _In_ DWORD dwFlags);
4973 
4974 BOOL WINAPI CertFreeCertificateContext(_In_opt_ PCCERT_CONTEXT pCertContext);
4975 
4976 BOOL WINAPI CertFreeCRLContext(_In_opt_ PCCRL_CONTEXT pCrlContext);
4977 
4978 BOOL WINAPI CertFreeCTLContext(_In_opt_ PCCTL_CONTEXT pCtlContext);
4979 
4980 _Success_(return != 0)
4981 BOOL
4982 WINAPI
4983 CertAddCertificateContextToStore(
4984   _In_opt_ HCERTSTORE hCertStore,
4985   _In_ PCCERT_CONTEXT pCertContext,
4986   _In_ DWORD dwAddDisposition,
4987   _Outptr_opt_ PCCERT_CONTEXT *ppStoreContext);
4988 
4989 _Success_(return != 0)
4990 BOOL
4991 WINAPI
4992 CertAddCRLContextToStore(
4993   _In_opt_ HCERTSTORE hCertStore,
4994   _In_ PCCRL_CONTEXT pCrlContext,
4995   _In_ DWORD dwAddDisposition,
4996   _Outptr_opt_ PCCRL_CONTEXT *ppStoreContext);
4997 
4998 _Success_(return != 0)
4999 BOOL
5000 WINAPI
5001 CertAddCTLContextToStore(
5002   _In_opt_ HCERTSTORE hCertStore,
5003   _In_ PCCTL_CONTEXT pCtlContext,
5004   _In_ DWORD dwAddDisposition,
5005   _Outptr_opt_ PCCTL_CONTEXT *ppStoreContext);
5006 
5007 _Success_(return != 0)
5008 BOOL
5009 WINAPI
5010 CertAddCertificateLinkToStore(
5011   _In_ HCERTSTORE hCertStore,
5012   _In_ PCCERT_CONTEXT pCertContext,
5013   _In_ DWORD dwAddDisposition,
5014   _Outptr_opt_ PCCERT_CONTEXT *ppStoreContext);
5015 
5016 _Success_(return != 0)
5017 BOOL
5018 WINAPI
5019 CertAddCRLLinkToStore(
5020   _In_ HCERTSTORE hCertStore,
5021   _In_ PCCRL_CONTEXT pCrlContext,
5022   _In_ DWORD dwAddDisposition,
5023   _Outptr_opt_ PCCRL_CONTEXT *ppStoreContext);
5024 
5025 _Success_(return != 0)
5026 BOOL
5027 WINAPI
5028 CertAddCTLLinkToStore(
5029   _In_ HCERTSTORE hCertStore,
5030   _In_ PCCTL_CONTEXT pCtlContext,
5031   _In_ DWORD dwAddDisposition,
5032   _Outptr_opt_ PCCTL_CONTEXT *ppStoreContext);
5033 
5034 _Success_(return != 0)
5035 BOOL
5036 WINAPI
5037 CertAddEncodedCertificateToStore(
5038   _In_opt_ HCERTSTORE hCertStore,
5039   _In_ DWORD dwCertEncodingType,
5040   _In_reads_bytes_(cbCertEncoded) const BYTE *pbCertEncoded,
5041   _In_ DWORD cbCertEncoded,
5042   _In_ DWORD dwAddDisposition,
5043   _Outptr_opt_ PCCERT_CONTEXT *ppCertContext);
5044 
5045 BOOL
5046 WINAPI
5047 CertAddEncodedCertificateToSystemStoreA(
5048   _In_ LPCSTR szCertStoreName,
5049   _In_reads_bytes_(cbCertEncoded) const BYTE *pbCertEncoded,
5050   _In_ DWORD cbCertEncoded);
5051 
5052 BOOL
5053 WINAPI
5054 CertAddEncodedCertificateToSystemStoreW(
5055   _In_ LPCWSTR szCertStoreName,
5056   _In_reads_bytes_(cbCertEncoded) const BYTE *pbCertEncoded,
5057   _In_ DWORD cbCertEncoded);
5058 
5059 #define CertAddEncodedCertificateToSystemStore \
5060  WINELIB_NAME_AW(CertAddEncodedCertificateToSystemStore)
5061 
5062 _Success_(return != 0)
5063 BOOL
5064 WINAPI
5065 CertAddEncodedCRLToStore(
5066   _In_opt_ HCERTSTORE hCertStore,
5067   _In_ DWORD dwCertEncodingType,
5068   _In_reads_bytes_(cbCrlEncoded) const BYTE *pbCrlEncoded,
5069   _In_ DWORD cbCrlEncoded,
5070   _In_ DWORD dwAddDisposition,
5071   _Outptr_opt_ PCCRL_CONTEXT *ppCrlContext);
5072 
5073 _Success_(return != 0)
5074 BOOL
5075 WINAPI
5076 CertAddEncodedCTLToStore(
5077   _In_opt_ HCERTSTORE hCertStore,
5078   _In_ DWORD dwMsgAndCertEncodingType,
5079   _In_reads_bytes_(cbCtlEncoded) const BYTE *pbCtlEncoded,
5080   _In_ DWORD cbCtlEncoded,
5081   _In_ DWORD dwAddDisposition,
5082   _Outptr_opt_ PCCTL_CONTEXT *ppCtlContext);
5083 
5084 _Success_(return != 0)
5085 BOOL
5086 WINAPI
5087 CertAddSerializedElementToStore(
5088   _In_opt_ HCERTSTORE hCertStore,
5089   _In_reads_bytes_(cbElement) const BYTE *pbElement,
5090   _In_ DWORD cbElement,
5091   _In_ DWORD dwAddDisposition,
5092   _In_ DWORD dwFlags,
5093   _In_ DWORD dwContextTypeFlags,
5094   _Out_opt_ DWORD *pdwContextType,
5095   _Outptr_opt_ const void **ppvContext);
5096 
5097 BOOL
5098 WINAPI
5099 CertCompareCertificate(
5100   _In_ DWORD dwCertEncodingType,
5101   _In_ PCERT_INFO pCertId1,
5102   _In_ PCERT_INFO pCertId2);
5103 
5104 BOOL
5105 WINAPI
5106 CertCompareCertificateName(
5107   _In_ DWORD dwCertEncodingType,
5108   _In_ PCERT_NAME_BLOB pCertName1,
5109   _In_ PCERT_NAME_BLOB pCertName2);
5110 
5111 BOOL
5112 WINAPI
5113 CertCompareIntegerBlob(
5114   _In_ PCRYPT_INTEGER_BLOB pInt1,
5115   _In_ PCRYPT_INTEGER_BLOB pInt2);
5116 
5117 BOOL
5118 WINAPI
5119 CertComparePublicKeyInfo(
5120   _In_ DWORD dwCertEncodingType,
5121   _In_ PCERT_PUBLIC_KEY_INFO pPublicKey1,
5122   _In_ PCERT_PUBLIC_KEY_INFO pPublicKey2);
5123 
5124 DWORD
5125 WINAPI
5126 CertGetPublicKeyLength(
5127   _In_ DWORD dwCertEncodingType,
5128   _In_ PCERT_PUBLIC_KEY_INFO pPublicKey);
5129 
5130 const void *
5131 WINAPI
5132 CertCreateContext(
5133   _In_ DWORD dwContextType,
5134   _In_ DWORD dwEncodingType,
5135   _In_reads_bytes_(cbEncoded) const BYTE *pbEncoded,
5136   _In_ DWORD cbEncoded,
5137   _In_ DWORD dwFlags,
5138   _In_opt_ PCERT_CREATE_CONTEXT_PARA pCreatePara);
5139 
5140 PCCERT_CONTEXT
5141 WINAPI
5142 CertCreateCertificateContext(
5143   _In_ DWORD dwCertEncodingType,
5144   _In_reads_bytes_(cbCertEncoded) const BYTE *pbCertEncoded,
5145   _In_ DWORD cbCertEncoded);
5146 
5147 PCCRL_CONTEXT
5148 WINAPI
5149 CertCreateCRLContext(
5150   _In_ DWORD dwCertEncodingType,
5151   _In_reads_bytes_(cbCrlEncoded) const BYTE *pbCrlEncoded,
5152   _In_ DWORD cbCrlEncoded);
5153 
5154 PCCTL_CONTEXT
5155 WINAPI
5156 CertCreateCTLContext(
5157   _In_ DWORD dwMsgAndCertEncodingType,
5158   _In_reads_bytes_(cbCtlEncoded) const BYTE *pbCtlEncoded,
5159   _In_ DWORD cbCtlEncoded);
5160 
5161 PCCERT_CONTEXT
5162 WINAPI
5163 CertCreateSelfSignCertificate(
5164   _In_opt_ HCRYPTPROV_OR_NCRYPT_KEY_HANDLE hProv,
5165   _In_ PCERT_NAME_BLOB pSubjectIssuerBlob,
5166   _In_ DWORD dwFlags,
5167   _In_opt_ PCRYPT_KEY_PROV_INFO pKeyProvInfo,
5168   _In_opt_ PCRYPT_ALGORITHM_IDENTIFIER pSignatureAlgorithm,
5169   _In_opt_ PSYSTEMTIME pStartTime,
5170   _In_opt_ PSYSTEMTIME pEndTime,
5171   _In_opt_ PCERT_EXTENSIONS pExtensions);
5172 
5173 BOOL WINAPI CertDeleteCertificateFromStore(_In_ PCCERT_CONTEXT pCertContext);
5174 
5175 BOOL WINAPI CertDeleteCRLFromStore(_In_ PCCRL_CONTEXT pCrlContext);
5176 
5177 BOOL WINAPI CertDeleteCTLFromStore(_In_ PCCTL_CONTEXT pCtlContext);
5178 
5179 PCCERT_CONTEXT
5180 WINAPI
5181 CertDuplicateCertificateContext(
5182   _In_opt_ PCCERT_CONTEXT pCertContext);
5183 
5184 PCCRL_CONTEXT WINAPI CertDuplicateCRLContext(_In_opt_ PCCRL_CONTEXT pCrlContext);
5185 
5186 PCCTL_CONTEXT WINAPI CertDuplicateCTLContext(_In_opt_ PCCTL_CONTEXT pCtlContext);
5187 
5188 PCCERT_CONTEXT
5189 WINAPI
5190 CertFindCertificateInStore(
5191   _In_ HCERTSTORE hCertStore,
5192   _In_ DWORD dwCertEncodingType,
5193   _In_ DWORD dwFindFlags,
5194   _In_ DWORD dwFindType,
5195   _In_opt_ const void *pvFindPara,
5196   _In_opt_ PCCERT_CONTEXT pPrevCertContext);
5197 
5198 PCCRL_CONTEXT
5199 WINAPI
5200 CertFindCRLInStore(
5201   _In_ HCERTSTORE hCertStore,
5202   _In_ DWORD dwCertEncodingType,
5203   _In_ DWORD dwFindFlags,
5204   _In_ DWORD dwFindType,
5205   _In_opt_ const void *pvFindPara,
5206   _In_opt_ PCCRL_CONTEXT pPrevCrlContext);
5207 
5208 PCCTL_CONTEXT
5209 WINAPI
5210 CertFindCTLInStore(
5211   _In_ HCERTSTORE hCertStore,
5212   _In_ DWORD dwMsgAndCertEncodingType,
5213   _In_ DWORD dwFindFlags,
5214   _In_ DWORD dwFindType,
5215   _In_opt_ const void *pvFindPara,
5216   _In_opt_ PCCTL_CONTEXT pPrevCtlContext);
5217 
5218 PCCERT_CONTEXT
5219 WINAPI
5220 CertGetIssuerCertificateFromStore(
5221   _In_ HCERTSTORE hCertStore,
5222   _In_ PCCERT_CONTEXT pSubjectContext,
5223   _In_opt_ PCCERT_CONTEXT pPrevIssuerContext,
5224   _Inout_ DWORD *pdwFlags);
5225 
5226 PCCERT_CONTEXT
5227 WINAPI
5228 CertGetSubjectCertificateFromStore(
5229   _In_ HCERTSTORE hCertStore,
5230   _In_ DWORD dwCertEncodingType,
5231   _In_ PCERT_INFO pCertId);
5232 
5233 PCCRL_CONTEXT
5234 WINAPI
5235 CertGetCRLFromStore(
5236   _In_ HCERTSTORE hCertStore,
5237   _In_opt_ PCCERT_CONTEXT pIssuerContext,
5238   _In_opt_ PCCRL_CONTEXT pPrevCrlContext,
5239   _Inout_ DWORD *pdwFlags);
5240 
5241 BOOL
5242 WINAPI
5243 CertSerializeCertificateStoreElement(
5244   _In_ PCCERT_CONTEXT pCertContext,
5245   _In_ DWORD dwFlags,
5246   _Out_writes_bytes_to_opt_(*pcbElement, *pcbElement) BYTE *pbElement,
5247   _Inout_ DWORD *pcbElement);
5248 
5249 BOOL
5250 WINAPI
5251 CertSerializeCRLStoreElement(
5252   _In_ PCCRL_CONTEXT pCrlContext,
5253   _In_ DWORD dwFlags,
5254   _Out_writes_bytes_to_opt_(*pcbElement, *pcbElement) BYTE *pbElement,
5255   _Inout_ DWORD *pcbElement);
5256 
5257 BOOL
5258 WINAPI
5259 CertSerializeCTLStoreElement(
5260   _In_ PCCTL_CONTEXT pCtlContext,
5261   _In_ DWORD dwFlags,
5262   _Out_writes_bytes_to_opt_(*pcbElement, *pcbElement) BYTE *pbElement,
5263   _Inout_ DWORD *pcbElement);
5264 
5265 BOOL
5266 WINAPI
5267 CertGetIntendedKeyUsage(
5268   _In_ DWORD dwCertEncodingType,
5269   _In_ PCERT_INFO pCertInfo,
5270   _Out_writes_bytes_all_(cbKeyUsage) BYTE *pbKeyUsage,
5271   _In_ DWORD cbKeyUsage);
5272 
5273 BOOL
5274 WINAPI
5275 CertGetEnhancedKeyUsage(
5276   _In_ PCCERT_CONTEXT pCertContext,
5277   _In_ DWORD dwFlags,
5278   _Out_writes_bytes_to_opt_(*pcbUsage, *pcbUsage) PCERT_ENHKEY_USAGE pUsage,
5279   _Inout_ DWORD *pcbUsage);
5280 
5281 BOOL
5282 WINAPI
5283 CertSetEnhancedKeyUsage(
5284   _In_ PCCERT_CONTEXT pCertContext,
5285   _In_opt_ PCERT_ENHKEY_USAGE pUsage);
5286 
5287 BOOL
5288 WINAPI
5289 CertAddEnhancedKeyUsageIdentifier(
5290   _In_ PCCERT_CONTEXT pCertContext,
5291   _In_ LPCSTR pszUsageIdentifier);
5292 
5293 BOOL
5294 WINAPI
5295 CertRemoveEnhancedKeyUsageIdentifier(
5296   _In_ PCCERT_CONTEXT pCertContext,
5297   _In_ LPCSTR pszUsageIdentifier);
5298 
5299 _Success_(return != 0)
5300 BOOL
5301 WINAPI
5302 CertGetValidUsages(
5303   _In_ DWORD cCerts,
5304   _In_reads_(cCerts) PCCERT_CONTEXT *rghCerts,
5305   _Out_ int *cNumOIDs,
5306   _Out_writes_bytes_to_opt_(*pcbOIDs, *pcbOIDs) LPSTR *rghOIDs,
5307   _Inout_ DWORD *pcbOIDs);
5308 
5309 BOOL
5310 WINAPI
5311 CryptEncodeObject(
5312   _In_ DWORD dwCertEncodingType,
5313   _In_ LPCSTR lpszStructType,
5314   _In_ const void *pvStructInfo,
5315   _Out_writes_bytes_to_opt_(*pcbEncoded, *pcbEncoded) BYTE *pbEncoded,
5316   _Inout_ DWORD *pcbEncoded);
5317 
5318 BOOL
5319 WINAPI
5320 CryptEncodeObjectEx(
5321   _In_ DWORD dwCertEncodingType,
5322   _In_ LPCSTR lpszStructType,
5323   _In_ const void *pvStructInfo,
5324   _In_ DWORD dwFlags,
5325   _In_opt_ PCRYPT_ENCODE_PARA pEncodePara,
5326   _Out_opt_ void *pvEncoded,
5327   _Inout_ DWORD *pcbEncoded);
5328 
5329 BOOL
5330 WINAPI
5331 CryptDecodeObject(
5332   _In_ DWORD dwCertEncodingType,
5333   _In_ LPCSTR lpszStructType,
5334   _In_reads_bytes_(cbEncoded) const BYTE *pbEncoded,
5335   _In_ DWORD cbEncoded,
5336   _In_ DWORD dwFlags,
5337   _Out_writes_bytes_to_opt_(*pcbStructInfo, *pcbStructInfo) void *pvStructInfo,
5338   _Inout_ DWORD *pcbStructInfo);
5339 
5340 BOOL
5341 WINAPI
5342 CryptDecodeObjectEx(
5343   _In_ DWORD dwCertEncodingType,
5344   _In_ LPCSTR lpszStructType,
5345   _In_reads_bytes_(cbEncoded) const BYTE *pbEncoded,
5346   _In_ DWORD cbEncoded,
5347   _In_ DWORD dwFlags,
5348   _In_opt_ PCRYPT_DECODE_PARA pDecodePara,
5349   _Out_opt_ void *pvStructInfo,
5350   _Inout_ DWORD *pcbStructInfo);
5351 
5352 BOOL
5353 WINAPI
5354 CryptFormatObject(
5355   _In_ DWORD dwCertEncodingType,
5356   _In_ DWORD dwFormatType,
5357   _In_ DWORD dwFormatStrType,
5358   _In_opt_ void *pFormatStruct,
5359   _In_opt_ LPCSTR lpszStructType,
5360   _In_reads_bytes_(cbEncoded) const BYTE *pbEncoded,
5361   _In_ DWORD cbEncoded,
5362   _At_((WCHAR *) pbFormat, _Out_writes_bytes_to_opt_(*pcbFormat, *pcbFormat)) void *pbFormat,
5363   _Inout_ DWORD *pcbFormat);
5364 
5365 BOOL
5366 WINAPI
5367 CryptHashCertificate(
5368   _In_opt_ HCRYPTPROV_LEGACY hCryptProv,
5369   _In_ ALG_ID Algid,
5370   _In_ DWORD dwFlags,
5371   _In_reads_bytes_(cbEncoded) const BYTE *pbEncoded,
5372   _In_ DWORD cbEncoded,
5373   _Out_writes_bytes_to_opt_(*pcbComputedHash, *pcbComputedHash) BYTE *pbComputedHash,
5374   _Inout_ DWORD *pcbComputedHash);
5375 
5376 BOOL
5377 WINAPI
5378 CryptHashPublicKeyInfo(
5379   _In_opt_ HCRYPTPROV_LEGACY hCryptProv,
5380   _In_ ALG_ID Algid,
5381   _In_ DWORD dwFlags,
5382   _In_ DWORD dwCertEncodingType,
5383   _In_ PCERT_PUBLIC_KEY_INFO pInfo,
5384   _Out_writes_bytes_to_opt_(*pcbComputedHash, *pcbComputedHash) BYTE *pbComputedHash,
5385   _Inout_ DWORD *pcbComputedHash);
5386 
5387 BOOL
5388 WINAPI
5389 CryptHashToBeSigned(
5390   _In_opt_ HCRYPTPROV_LEGACY hCryptProv,
5391   _In_ DWORD dwCertEncodingType,
5392   _In_reads_bytes_(cbEncoded) const BYTE *pbEncoded,
5393   _In_ DWORD cbEncoded,
5394   _Out_writes_bytes_to_opt_(*pcbComputedHash, *pcbComputedHash) BYTE *pbComputedHash,
5395   _Inout_ DWORD *pcbComputedHash);
5396 
5397 BOOL
5398 WINAPI
5399 CryptQueryObject(
5400   _In_ DWORD dwObjectType,
5401   _In_ const void *pvObject,
5402   _In_ DWORD dwExpectedContentTypeFlags,
5403   _In_ DWORD dwExpectedFormatTypeFlags,
5404   _In_ DWORD dwFlags,
5405   _Out_opt_ DWORD *pdwMsgAndCertEncodingType,
5406   _Out_opt_ DWORD *pdwContentType,
5407   _Out_opt_ DWORD *pdwFormatType,
5408   _Out_opt_ HCERTSTORE *phCertStore,
5409   _Out_opt_ HCRYPTMSG *phMsg,
5410   _Outptr_opt_result_maybenull_ const void **ppvContext);
5411 
5412 BOOL
5413 WINAPI
5414 CryptSignCertificate(
5415   _In_opt_ HCRYPTPROV_OR_NCRYPT_KEY_HANDLE hCryptProvOrNCryptKey,
5416   _In_opt_ DWORD dwKeySpec,
5417   _In_ DWORD dwCertEncodingType,
5418   _In_reads_bytes_(cbEncodedToBeSigned) const BYTE *pbEncodedToBeSigned,
5419   _In_ DWORD cbEncodedToBeSigned,
5420   _In_ PCRYPT_ALGORITHM_IDENTIFIER pSignatureAlgorithm,
5421   _In_opt_ const void *pvHashAuxInfo,
5422   _Out_writes_bytes_to_opt_(*pcbSignature, *pcbSignature) BYTE *pbSignature,
5423   _Inout_ DWORD *pcbSignature);
5424 
5425 BOOL
5426 WINAPI
5427 CryptSignAndEncodeCertificate(
5428   _In_opt_ HCRYPTPROV_OR_NCRYPT_KEY_HANDLE hCryptProvOrNCryptKey,
5429   _In_opt_ DWORD dwKeySpec,
5430   _In_ DWORD dwCertEncodingType,
5431   _In_ LPCSTR lpszStructType,
5432   _In_ const void *pvStructInfo,
5433   _In_ PCRYPT_ALGORITHM_IDENTIFIER pSignatureAlgorithm,
5434   _In_opt_ const void *pvHashAuxInfo,
5435   _Out_writes_bytes_to_opt_(*pcbEncoded, *pcbEncoded) BYTE *pbEncoded,
5436   _Inout_ DWORD *pcbEncoded);
5437 
5438 _Must_inspect_result_
5439 BOOL
5440 WINAPI
5441 CryptVerifyCertificateSignature(
5442   _In_opt_ HCRYPTPROV_LEGACY hCryptProv,
5443   _In_ DWORD dwCertEncodingType,
5444   _In_reads_bytes_(cbEncoded) const BYTE *pbEncoded,
5445   _In_ DWORD cbEncoded,
5446   _In_ PCERT_PUBLIC_KEY_INFO pPublicKey);
5447 
5448 _Must_inspect_result_
5449 BOOL
5450 WINAPI
5451 CryptVerifyCertificateSignatureEx(
5452   _In_opt_ HCRYPTPROV_LEGACY hCryptProv,
5453   _In_ DWORD dwCertEncodingType,
5454   _In_ DWORD dwSubjectType,
5455   _In_ void *pvSubject,
5456   _In_ DWORD dwIssuerType,
5457   _In_opt_ void *pvIssuer,
5458   _In_ DWORD dwFlags,
5459   _Inout_opt_ void *pvExtra);
5460 
5461 PCRYPT_ATTRIBUTE
5462 WINAPI
5463 CertFindAttribute(
5464   _In_ LPCSTR pszObjId,
5465   _In_ DWORD cAttr,
5466   _In_reads_(cAttr) CRYPT_ATTRIBUTE rgAttr[]);
5467 
5468 PCERT_EXTENSION
5469 WINAPI
5470 CertFindExtension(
5471   _In_ LPCSTR pszObjId,
5472   _In_ DWORD cExtensions,
5473   _In_reads_(cExtensions) CERT_EXTENSION rgExtensions[]);
5474 
5475 PCERT_RDN_ATTR
5476 WINAPI
5477 CertFindRDNAttr(
5478   _In_ LPCSTR pszObjId,
5479   _In_ PCERT_NAME_INFO pName);
5480 
5481 BOOL
5482 WINAPI
5483 CertFindSubjectInSortedCTL(
5484   _In_ PCRYPT_DATA_BLOB pSubjectIdentifier,
5485   _In_ PCCTL_CONTEXT pCtlContext,
5486   _In_ DWORD dwFlags,
5487   _Reserved_ void *pvReserved,
5488   _Out_opt_ PCRYPT_DER_BLOB pEncodedAttributes);
5489 
5490 BOOL
5491 WINAPI
5492 CertIsRDNAttrsInCertificateName(
5493   _In_ DWORD dwCertEncodingType,
5494   _In_ DWORD dwFlags,
5495   _In_ PCERT_NAME_BLOB pCertName,
5496   _In_ PCERT_RDN pRDN);
5497 
5498 BOOL
5499 WINAPI
5500 CertIsValidCRLForCertificate(
5501   _In_ PCCERT_CONTEXT pCert,
5502   _In_ PCCRL_CONTEXT pCrl,
5503   _In_ DWORD dwFlags,
5504   _Reserved_ void *pvReserved);
5505 
5506 BOOL
5507 WINAPI
5508 CertFindCertificateInCRL(
5509   _In_ PCCERT_CONTEXT pCert,
5510   _In_ PCCRL_CONTEXT pCrlContext,
5511   _In_ DWORD dwFlags,
5512   _Reserved_ void *pvReserved,
5513   _Outptr_result_maybenull_ PCRL_ENTRY *ppCrlEntry);
5514 
5515 BOOL
5516 WINAPI
5517 CertVerifyCRLRevocation(
5518   _In_ DWORD dwCertEncodingType,
5519   _In_ PCERT_INFO pCertId,
5520   _In_ DWORD cCrlInfo,
5521   _In_reads_(cCrlInfo) PCRL_INFO rgpCrlInfo[]);
5522 
5523 BOOL
5524 WINAPI
5525 CertVerifySubjectCertificateContext(
5526   _In_ PCCERT_CONTEXT pSubject,
5527   _In_opt_ PCCERT_CONTEXT pIssuer,
5528   _Inout_ DWORD *pdwFlags);
5529 
5530 LONG
5531 WINAPI
5532 CertVerifyCRLTimeValidity(
5533   _In_opt_ LPFILETIME pTimeToVerify,
5534   _In_ PCRL_INFO pCrlInfo);
5535 
5536 LONG
5537 WINAPI
5538 CertVerifyTimeValidity(
5539   _In_opt_ LPFILETIME pTimeToVerify,
5540   _In_ PCERT_INFO pCertInfo);
5541 
5542 BOOL
5543 WINAPI
5544 CertVerifyValidityNesting(
5545   _In_ PCERT_INFO pSubjectInfo,
5546   _In_ PCERT_INFO pIssuerInfo);
5547 
5548 BOOL
5549 WINAPI
5550 CertVerifyCTLUsage(
5551   _In_ DWORD dwEncodingType,
5552   _In_ DWORD dwSubjectType,
5553   _In_ void *pvSubject,
5554   _In_ PCTL_USAGE pSubjectUsage,
5555   _In_ DWORD dwFlags,
5556   _In_opt_ PCTL_VERIFY_USAGE_PARA pVerifyUsagePara,
5557   _Inout_ PCTL_VERIFY_USAGE_STATUS pVerifyUsageStatus);
5558 
5559 BOOL
5560 WINAPI
5561 CertVerifyRevocation(
5562   _In_ DWORD dwEncodingType,
5563   _In_ DWORD dwRevType,
5564   _In_ DWORD cContext,
5565   _In_reads_(cContext) PVOID rgpvContext[],
5566   _In_ DWORD dwFlags,
5567   _In_opt_ PCERT_REVOCATION_PARA pRevPara,
5568   _Inout_ PCERT_REVOCATION_STATUS pRevStatus);
5569 
5570 BOOL
5571 WINAPI
5572 CryptExportPublicKeyInfo(
5573   _In_ HCRYPTPROV_OR_NCRYPT_KEY_HANDLE hCryptProvOrNCryptKey,
5574   _In_opt_ DWORD dwKeySpec,
5575   _In_ DWORD dwCertEncodingType,
5576   _Out_writes_bytes_to_opt_(*pcbInfo, *pcbInfo) PCERT_PUBLIC_KEY_INFO pInfo,
5577   _Inout_ DWORD *pcbInfo);
5578 
5579 BOOL
5580 WINAPI
5581 CryptExportPublicKeyInfoEx(
5582   _In_ HCRYPTPROV_OR_NCRYPT_KEY_HANDLE hCryptProvOrNCryptKey,
5583   _In_opt_ DWORD dwKeySpec,
5584   _In_ DWORD dwCertEncodingType,
5585   _In_opt_ LPSTR pszPublicKeyObjId,
5586   _In_ DWORD dwFlags,
5587   _In_opt_ void *pvAuxInfo,
5588   _Out_writes_bytes_to_opt_(*pcbInfo, *pcbInfo) PCERT_PUBLIC_KEY_INFO pInfo,
5589   _Inout_ DWORD *pcbInfo);
5590 
5591 BOOL
5592 WINAPI
5593 CryptImportPublicKeyInfo(
5594   _In_ HCRYPTPROV hCryptProv,
5595   _In_ DWORD dwCertEncodingType,
5596   _In_ PCERT_PUBLIC_KEY_INFO pInfo,
5597   _Out_ HCRYPTKEY *phKey);
5598 
5599 BOOL
5600 WINAPI
5601 CryptImportPublicKeyInfoEx(
5602   _In_ HCRYPTPROV hCryptProv,
5603   _In_ DWORD dwCertEncodingType,
5604   _In_ PCERT_PUBLIC_KEY_INFO pInfo,
5605   _In_ ALG_ID aiKeyAlg,
5606   _In_ DWORD dwFlags,
5607   _In_opt_ void *pvAuxInfo,
5608   _Out_ HCRYPTKEY *phKey);
5609 
5610 BOOL
5611 WINAPI
5612 CryptAcquireCertificatePrivateKey(
5613   _In_ PCCERT_CONTEXT pCert,
5614   _In_ DWORD dwFlags,
5615   _In_opt_ void *pvParameters,
5616   _Out_ HCRYPTPROV_OR_NCRYPT_KEY_HANDLE *phCryptProvOrNCryptKey,
5617   _Out_opt_ DWORD *pdwKeySpec,
5618   _Out_opt_ BOOL *pfCallerFreeProvOrNCryptKey);
5619 
5620 BOOL
5621 WINAPI
5622 CryptFindCertificateKeyProvInfo(
5623   _In_ PCCERT_CONTEXT pCert,
5624   _In_ DWORD dwFlags,
5625   _Reserved_ void *pvReserved);
5626 
5627 BOOL WINAPI CryptProtectData( DATA_BLOB* pDataIn, LPCWSTR szDataDescr,
5628  DATA_BLOB* pOptionalEntropy, PVOID pvReserved,
5629  CRYPTPROTECT_PROMPTSTRUCT* pPromptStruct, DWORD dwFlags, DATA_BLOB* pDataOut );
5630 
5631 BOOL WINAPI CryptUnprotectData( DATA_BLOB* pDataIn, LPWSTR* ppszDataDescr,
5632  DATA_BLOB* pOptionalEntropy, PVOID pvReserved,
5633  CRYPTPROTECT_PROMPTSTRUCT* pPromptStruct, DWORD dwFlags, DATA_BLOB* pDataOut );
5634 
5635 DWORD
5636 WINAPI
5637 CertGetNameStringA(
5638   _In_ PCCERT_CONTEXT pCertContext,
5639   _In_ DWORD dwType,
5640   _In_ DWORD dwFlags,
5641   _In_opt_ void *pvTypePara,
5642   _Out_writes_to_opt_(cchNameString, return) LPSTR pszNameString,
5643   _In_ DWORD cchNameString);
5644 
5645 DWORD
5646 WINAPI
5647 CertGetNameStringW(
5648   _In_ PCCERT_CONTEXT pCertContext,
5649   _In_ DWORD dwType,
5650   _In_ DWORD dwFlags,
5651   _In_opt_ void *pvTypePara,
5652   _Out_writes_to_opt_(cchNameString, return) LPWSTR pszNameString,
5653   _In_ DWORD cchNameString);
5654 
5655 #define CertGetNameString WINELIB_NAME_AW(CertGetNameString)
5656 
5657 DWORD
5658 WINAPI
5659 CertRDNValueToStrA(
5660   _In_ DWORD dwValueType,
5661   _In_ PCERT_RDN_VALUE_BLOB pValue,
5662   _Out_writes_to_opt_(csz, return) LPSTR psz,
5663   _In_ DWORD csz);
5664 
5665 DWORD
5666 WINAPI
5667 CertRDNValueToStrW(
5668   _In_ DWORD dwValueType,
5669   _In_ PCERT_RDN_VALUE_BLOB pValue,
5670   _Out_writes_to_opt_(csz, return) LPWSTR psz,
5671   _In_ DWORD csz);
5672 
5673 #define CertRDNValueToStr WINELIB_NAME_AW(CertRDNValueToStr)
5674 
5675 DWORD
5676 WINAPI
5677 CertNameToStrA(
5678   _In_ DWORD dwCertEncodingType,
5679   _In_ PCERT_NAME_BLOB pName,
5680   _In_ DWORD dwStrType,
5681   _Out_writes_to_opt_(csz, return) LPSTR psz,
5682   _In_ DWORD csz);
5683 
5684 DWORD
5685 WINAPI
5686 CertNameToStrW(
5687   _In_ DWORD dwCertEncodingType,
5688   _In_ PCERT_NAME_BLOB pName,
5689   _In_ DWORD dwStrType,
5690   _Out_writes_to_opt_(csz, return) LPWSTR psz,
5691   _In_ DWORD csz);
5692 
5693 #define CertNameToStr WINELIB_NAME_AW(CertNameToStr)
5694 
5695 BOOL
5696 WINAPI
5697 CertStrToNameA(
5698   _In_ DWORD dwCertEncodingType,
5699   _In_ LPCSTR pszX500,
5700   _In_ DWORD dwStrType,
5701   _Reserved_ void *pvReserved,
5702   _Out_writes_bytes_to_opt_(*pcbEncoded, *pcbEncoded) BYTE *pbEncoded,
5703   _Inout_ DWORD *pcbEncoded,
5704   _Outptr_opt_result_maybenull_ LPCSTR *ppszError);
5705 
5706 BOOL
5707 WINAPI
5708 CertStrToNameW(
5709   _In_ DWORD dwCertEncodingType,
5710   _In_ LPCWSTR pszX500,
5711   _In_ DWORD dwStrType,
5712   _Reserved_ void *pvReserved,
5713   _Out_writes_bytes_to_opt_(*pcbEncoded, *pcbEncoded) BYTE *pbEncoded,
5714   _Inout_ DWORD *pcbEncoded,
5715   _Outptr_opt_result_maybenull_ LPCWSTR *ppszError);
5716 
5717 #define CertStrToName WINELIB_NAME_AW(CertStrToName)
5718 
5719 DWORD
5720 WINAPI
5721 CryptMsgCalculateEncodedLength(
5722   _In_ DWORD dwMsgEncodingType,
5723   _In_ DWORD dwFlags,
5724   _In_ DWORD dwMsgType,
5725   _In_ void const *pvMsgEncodeInfo,
5726   _In_opt_ LPSTR pszInnerContentObjID,
5727   _In_ DWORD cbData);
5728 
5729 BOOL WINAPI CryptMsgClose(_In_opt_ HCRYPTMSG hCryptMsg);
5730 
5731 BOOL
5732 WINAPI
5733 CryptMsgControl(
5734   _In_ HCRYPTMSG hCryptMsg,
5735   _In_ DWORD dwFlags,
5736   _In_ DWORD dwCtrlType,
5737   _In_opt_ void const *pvCtrlPara);
5738 
5739 BOOL
5740 WINAPI
5741 CryptMsgCountersign(
5742   _In_ HCRYPTMSG hCryptMsg,
5743   _In_ DWORD dwIndex,
5744   _In_ DWORD cCountersigners,
5745   _In_reads_(cCountersigners) PCMSG_SIGNER_ENCODE_INFO rgCountersigners);
5746 
5747 BOOL
5748 WINAPI
5749 CryptMsgCountersignEncoded(
5750   _In_ DWORD dwEncodingType,
5751   _In_reads_bytes_(cbSignerInfo) PBYTE pbSignerInfo,
5752   _In_ DWORD cbSignerInfo,
5753   _In_ DWORD cCountersigners,
5754   _In_reads_(cCountersigners) PCMSG_SIGNER_ENCODE_INFO rgCountersigners,
5755   _Out_writes_bytes_to_opt_(*pcbCountersignature, *pcbCountersignature) PBYTE pbCountersignature,
5756   _Inout_ PDWORD pcbCountersignature);
5757 
5758 HCRYPTMSG WINAPI CryptMsgDuplicate(_In_opt_ HCRYPTMSG hCryptMsg);
5759 
5760 BOOL
5761 WINAPI
5762 CryptMsgEncodeAndSignCTL(
5763   _In_ DWORD dwMsgEncodingType,
5764   _In_ PCTL_INFO pCtlInfo,
5765   _In_ PCMSG_SIGNED_ENCODE_INFO pSignInfo,
5766   _In_ DWORD dwFlags,
5767   _Out_writes_bytes_to_opt_(*pcbEncoded, *pcbEncoded) BYTE *pbEncoded,
5768   _Inout_ DWORD *pcbEncoded);
5769 
5770 _Success_(return == 0)
5771 BOOL
5772 WINAPI
5773 CryptMsgGetAndVerifySigner(
5774   _In_ HCRYPTMSG hCryptMsg,
5775   _In_ DWORD cSignerStore,
5776   _In_reads_opt_(cSignerStore) HCERTSTORE *rghSignerStore,
5777   _In_ DWORD dwFlags,
5778   _Outptr_opt_ PCCERT_CONTEXT *ppSigner,
5779   _Inout_opt_ DWORD *pdwSignerIndex);
5780 
5781 BOOL
5782 WINAPI
5783 CryptMsgGetParam(
5784   _In_ HCRYPTMSG hCryptMsg,
5785   _In_ DWORD dwParamType,
5786   _In_ DWORD dwIndex,
5787   _Out_writes_bytes_to_opt_(*pcbData, *pcbData) void *pvData,
5788   _Inout_ DWORD *pcbData);
5789 
5790 HCRYPTMSG
5791 WINAPI
5792 CryptMsgOpenToDecode(
5793   _In_ DWORD dwMsgEncodingType,
5794   _In_ DWORD dwFlags,
5795   _In_ DWORD dwMsgType,
5796   _In_opt_ HCRYPTPROV_LEGACY hCryptProv,
5797   _Reserved_ PCERT_INFO pRecipientInfo,
5798   _In_opt_ PCMSG_STREAM_INFO pStreamInfo);
5799 
5800 HCRYPTMSG
5801 WINAPI
5802 CryptMsgOpenToEncode(
5803   _In_ DWORD dwMsgEncodingType,
5804   _In_ DWORD dwFlags,
5805   _In_ DWORD dwMsgType,
5806   _In_ void const *pvMsgEncodeInfo,
5807   _In_opt_ LPSTR pszInnerContentObjID,
5808   _In_opt_ PCMSG_STREAM_INFO pStreamInfo);
5809 
5810 BOOL
5811 WINAPI
5812 CryptMsgSignCTL(
5813   _In_ DWORD dwMsgEncodingType,
5814   _In_reads_bytes_(cbCtlContent) BYTE *pbCtlContent,
5815   _In_ DWORD cbCtlContent,
5816   _In_ PCMSG_SIGNED_ENCODE_INFO pSignInfo,
5817   _In_ DWORD dwFlags,
5818   _Out_writes_bytes_to_opt_(*pcbEncoded, *pcbEncoded) BYTE *pbEncoded,
5819   _Inout_ DWORD *pcbEncoded);
5820 
5821 BOOL
5822 WINAPI
5823 CryptMsgUpdate(
5824   _In_ HCRYPTMSG hCryptMsg,
5825   _In_reads_bytes_opt_(cbData) const BYTE *pbData,
5826   _In_ DWORD cbData,
5827   _In_ BOOL fFinal);
5828 
5829 BOOL
5830 WINAPI
5831 CryptMsgVerifyCountersignatureEncoded(
5832   _In_opt_ HCRYPTPROV_LEGACY hCryptProv,
5833   _In_ DWORD dwEncodingType,
5834   _In_reads_bytes_(cbSignerInfo) PBYTE pbSignerInfo,
5835   _In_ DWORD cbSignerInfo,
5836   _In_reads_bytes_(cbSignerInfoCountersignature) PBYTE pbSignerInfoCountersignature,
5837   _In_ DWORD cbSignerInfoCountersignature,
5838   _In_ PCERT_INFO pciCountersigner);
5839 
5840 BOOL
5841 WINAPI
5842 CryptMsgVerifyCountersignatureEncodedEx(
5843   _In_opt_ HCRYPTPROV_LEGACY hCryptProv,
5844   _In_ DWORD dwEncodingType,
5845   _In_reads_bytes_(cbSignerInfo) PBYTE pbSignerInfo,
5846   _In_ DWORD cbSignerInfo,
5847   _In_reads_bytes_(cbSignerInfoCountersignature) PBYTE pbSignerInfoCountersignature,
5848   _In_ DWORD cbSignerInfoCountersignature,
5849   _In_ DWORD dwSignerType,
5850   _In_ void *pvSigner,
5851   _In_ DWORD dwFlags,
5852   _Inout_opt_ void *pvExtra);
5853 
5854 BOOL
5855 WINAPI
5856 CryptSignMessage(
5857   _In_ PCRYPT_SIGN_MESSAGE_PARA pSignPara,
5858   _In_ BOOL fDetachedSignature,
5859   _In_ DWORD cToBeSigned,
5860   _In_reads_opt_(cToBeSigned) const BYTE *rgpbToBeSigned[],
5861   _In_reads_(cToBeSigned) DWORD rgcbToBeSigned[],
5862   _Out_writes_bytes_to_opt_(*pcbSignedBlob, *pcbSignedBlob) BYTE *pbSignedBlob,
5863   _Inout_ DWORD *pcbSignedBlob);
5864 
5865 BOOL
5866 WINAPI
5867 CryptSignMessageWithKey(
5868   _In_ PCRYPT_KEY_SIGN_MESSAGE_PARA pSignPara,
5869   _In_reads_bytes_(cbToBeSigned) const BYTE *pbToBeSigned,
5870   _In_ DWORD cbToBeSigned,
5871   _Out_writes_bytes_to_opt_(*pcbSignedBlob, *pcbSignedBlob) BYTE *pbSignedBlob,
5872   _Inout_ DWORD *pcbSignedBlob);
5873 
5874 BOOL
5875 WINAPI
5876 CryptVerifyMessageSignature(
5877   _In_ PCRYPT_VERIFY_MESSAGE_PARA pVerifyPara,
5878   _In_ DWORD dwSignerIndex,
5879   _In_reads_bytes_(cbSignedBlob) const BYTE *pbSignedBlob,
5880   _In_ DWORD cbSignedBlob,
5881   _Out_writes_bytes_to_opt_(*pcbDecoded, *pcbDecoded) BYTE *pbDecoded,
5882   _Inout_opt_ DWORD *pcbDecoded,
5883   _Outptr_opt_result_maybenull_ PCCERT_CONTEXT *ppSignerCert);
5884 
5885 BOOL
5886 WINAPI
5887 CryptVerifyMessageSignatureWithKey(
5888   _In_ PCRYPT_KEY_VERIFY_MESSAGE_PARA pVerifyPara,
5889   _In_opt_ PCERT_PUBLIC_KEY_INFO pPublicKeyInfo,
5890   _In_reads_bytes_(cbSignedBlob) const BYTE *pbSignedBlob,
5891   _In_ DWORD cbSignedBlob,
5892   _Out_writes_bytes_to_opt_(*pcbDecoded, *pcbDecoded) BYTE *pbDecoded,
5893   _Inout_opt_ DWORD *pcbDecoded);
5894 
5895 BOOL
5896 WINAPI
5897 CryptVerifyDetachedMessageSignature(
5898   _In_ PCRYPT_VERIFY_MESSAGE_PARA pVerifyPara,
5899   _In_ DWORD dwSignerIndex,
5900   _In_reads_bytes_(cbDetachedSignBlob) const BYTE *pbDetachedSignBlob,
5901   _In_ DWORD cbDetachedSignBlob,
5902   _In_ DWORD cToBeSigned,
5903   _In_reads_(cToBeSigned) const BYTE *rgpbToBeSigned[],
5904   _In_reads_(cToBeSigned) DWORD rgcbToBeSigned[],
5905   _Outptr_opt_result_maybenull_ PCCERT_CONTEXT *ppSignerCert);
5906 
5907 LONG
5908 WINAPI
5909 CryptGetMessageSignerCount(
5910   _In_ DWORD dwMsgEncodingType,
5911   _In_reads_bytes_(cbSignedBlob) const BYTE *pbSignedBlob,
5912   _In_ DWORD cbSignedBlob);
5913 
5914 BOOL
5915 WINAPI
5916 CryptEncryptMessage(
5917   _In_ PCRYPT_ENCRYPT_MESSAGE_PARA pEncryptPara,
5918   _In_ DWORD cRecipientCert,
5919   _In_reads_(cRecipientCert) PCCERT_CONTEXT rgpRecipientCert[],
5920   _In_reads_bytes_opt_(cbToBeEncrypted) const BYTE *pbToBeEncrypted,
5921   _In_ DWORD cbToBeEncrypted,
5922   _Out_writes_bytes_to_opt_(*pcbEncryptedBlob, *pcbEncryptedBlob) BYTE *pbEncryptedBlob,
5923   _Inout_ DWORD *pcbEncryptedBlob);
5924 
5925 BOOL
5926 WINAPI
5927 CryptDecryptMessage(
5928   _In_ PCRYPT_DECRYPT_MESSAGE_PARA pDecryptPara,
5929   _In_reads_bytes_(cbEncryptedBlob) const BYTE *pbEncryptedBlob,
5930   _In_ DWORD cbEncryptedBlob,
5931   _Out_writes_bytes_to_opt_(*pcbDecrypted, *pcbDecrypted) BYTE *pbDecrypted,
5932   _Inout_opt_ DWORD *pcbDecrypted,
5933   _Outptr_opt_result_maybenull_ PCCERT_CONTEXT *ppXchgCert);
5934 
5935 BOOL
5936 WINAPI
5937 CryptSignAndEncryptMessage(
5938   _In_ PCRYPT_SIGN_MESSAGE_PARA pSignPara,
5939   _In_ PCRYPT_ENCRYPT_MESSAGE_PARA pEncryptPara,
5940   _In_ DWORD cRecipientCert,
5941   _In_reads_(cRecipientCert) PCCERT_CONTEXT rgpRecipientCert[],
5942   _In_reads_bytes_(cbToBeSignedAndEncrypted) const BYTE *pbToBeSignedAndEncrypted,
5943   _In_ DWORD cbToBeSignedAndEncrypted,
5944   _Out_writes_bytes_to_opt_(*pcbSignedAndEncryptedBlob, *pcbSignedAndEncryptedBlob) BYTE *pbSignedAndEncryptedBlob,
5945   _Inout_ DWORD *pcbSignedAndEncryptedBlob);
5946 
5947 BOOL
5948 WINAPI
5949 CryptDecryptAndVerifyMessageSignature(
5950   _In_ PCRYPT_DECRYPT_MESSAGE_PARA pDecryptPara,
5951   _In_ PCRYPT_VERIFY_MESSAGE_PARA pVerifyPara,
5952   _In_ DWORD dwSignerIndex,
5953   _In_reads_bytes_(cbEncryptedBlob) const BYTE *pbEncryptedBlob,
5954   _In_ DWORD cbEncryptedBlob,
5955   _Out_writes_bytes_to_opt_(*pcbDecrypted, *pcbDecrypted) BYTE *pbDecrypted,
5956   _Inout_opt_ DWORD *pcbDecrypted,
5957   _Outptr_opt_result_maybenull_ PCCERT_CONTEXT *ppXchgCert,
5958   _Outptr_opt_result_maybenull_ PCCERT_CONTEXT *ppSignerCert);
5959 
5960 HCERTSTORE
5961 WINAPI
5962 CryptGetMessageCertificates(
5963   _In_ DWORD dwMsgAndCertEncodingType,
5964   _In_opt_ HCRYPTPROV_LEGACY hCryptProv,
5965   _In_ DWORD dwFlags,
5966   _In_reads_bytes_(cbSignedBlob) const BYTE *pbSignedBlob,
5967   _In_ DWORD cbSignedBlob);
5968 
5969 BOOL
5970 WINAPI
5971 CryptDecodeMessage(
5972   _In_ DWORD dwMsgTypeFlags,
5973   _In_opt_ PCRYPT_DECRYPT_MESSAGE_PARA pDecryptPara,
5974   _In_opt_ PCRYPT_VERIFY_MESSAGE_PARA pVerifyPara,
5975   _In_ DWORD dwSignerIndex,
5976   _In_reads_bytes_(cbEncodedBlob) const BYTE *pbEncodedBlob,
5977   _In_ DWORD cbEncodedBlob,
5978   _In_ DWORD dwPrevInnerContentType,
5979   _Out_opt_ DWORD *pdwMsgType,
5980   _Out_opt_ DWORD *pdwInnerContentType,
5981   _Out_writes_bytes_to_opt_(*pcbDecoded, *pcbDecoded) BYTE *pbDecoded,
5982   _Inout_opt_ DWORD *pcbDecoded,
5983   _Outptr_opt_result_maybenull_ PCCERT_CONTEXT *ppXchgCert,
5984   _Outptr_opt_result_maybenull_ PCCERT_CONTEXT *ppSignerCert);
5985 
5986 BOOL
5987 WINAPI
5988 CryptHashMessage(
5989   _In_ PCRYPT_HASH_MESSAGE_PARA pHashPara,
5990   _In_ BOOL fDetachedHash,
5991   _In_ DWORD cToBeHashed,
5992   _In_reads_(cToBeHashed) const BYTE *rgpbToBeHashed[],
5993   _In_reads_(cToBeHashed) DWORD rgcbToBeHashed[],
5994   _Out_writes_bytes_to_opt_(*pcbHashedBlob, *pcbHashedBlob) BYTE *pbHashedBlob,
5995   _Inout_opt_ DWORD *pcbHashedBlob,
5996   _Out_writes_bytes_to_opt_(*pcbComputedHash, *pcbComputedHash) BYTE *pbComputedHash,
5997   _Inout_opt_ DWORD *pcbComputedHash);
5998 
5999 BOOL
6000 WINAPI
6001 CryptVerifyMessageHash(
6002   _In_ PCRYPT_HASH_MESSAGE_PARA pHashPara,
6003   _In_reads_bytes_(cbHashedBlob) BYTE *pbHashedBlob,
6004   _In_ DWORD cbHashedBlob,
6005   _Out_writes_bytes_to_opt_(*pcbToBeHashed, *pcbToBeHashed) BYTE *pbToBeHashed,
6006   _Inout_opt_ DWORD *pcbToBeHashed,
6007   _Out_writes_bytes_to_opt_(*pcbComputedHash, *pcbComputedHash) BYTE *pbComputedHash,
6008   _Inout_opt_ DWORD *pcbComputedHash);
6009 
6010 BOOL
6011 WINAPI
6012 CryptVerifyDetachedMessageHash(
6013   _In_ PCRYPT_HASH_MESSAGE_PARA pHashPara,
6014   _In_reads_bytes_(cbDetachedHashBlob) BYTE *pbDetachedHashBlob,
6015   _In_ DWORD cbDetachedHashBlob,
6016   _In_ DWORD cToBeHashed,
6017   _In_reads_(cToBeHashed) const BYTE *rgpbToBeHashed[],
6018   _In_reads_(cToBeHashed) DWORD rgcbToBeHashed[],
6019   _Out_writes_bytes_to_opt_(*pcbComputedHash, *pcbComputedHash) BYTE *pbComputedHash,
6020   _Inout_opt_ DWORD *pcbComputedHash);
6021 
6022 /* PFX functions */
6023 HCERTSTORE
6024 WINAPI
6025 PFXImportCertStore(
6026   _In_ CRYPT_DATA_BLOB *pPFX,
6027   _In_ LPCWSTR szPassword,
6028   _In_ DWORD dwFlags);
6029 
6030 BOOL WINAPI PFXIsPFXBlob(_In_ CRYPT_DATA_BLOB *pPFX);
6031 
6032 BOOL
6033 WINAPI
6034 PFXVerifyPassword(
6035   _In_ CRYPT_DATA_BLOB *pPFX,
6036   _In_ LPCWSTR szPassword,
6037   _In_ DWORD dwFlags);
6038 
6039 BOOL
6040 WINAPI
6041 PFXExportCertStoreEx(
6042   _In_ HCERTSTORE hStore,
6043   _Inout_ CRYPT_DATA_BLOB* pPFX,
6044   _In_ LPCWSTR szPassword,
6045   _In_ void* pvPara,
6046   _In_ DWORD dwFlags);
6047 
6048 BOOL
6049 WINAPI
6050 PFXExportCertStore(
6051   _In_ HCERTSTORE hStore,
6052   _Inout_ CRYPT_DATA_BLOB* pPFX,
6053   _In_ LPCWSTR szPassword,
6054   _In_ DWORD dwFlags);
6055 
6056 BOOL WINAPI PFXVerifyPassword(CRYPT_DATA_BLOB *pPFX, LPCWSTR szPassword,
6057  DWORD dwFlags);
6058 
6059 /* cryptnet.dll functions */
6060 BOOL WINAPI CryptCancelAsyncRetrieval(_In_opt_ HCRYPTASYNC hAsyncRetrieval);
6061 
6062 BOOL
6063 WINAPI
6064 CryptGetObjectUrl(
6065   _In_ LPCSTR pszUrlOid,
6066   _In_ LPVOID pvPara,
6067   _In_ DWORD dwFlags,
6068   _Out_writes_bytes_to_opt_(*pcbUrlArray, *pcbUrlArray) PCRYPT_URL_ARRAY pUrlArray,
6069   _Inout_ DWORD* pcbUrlArray,
6070   _Out_writes_bytes_to_opt_(*pcbUrlInfo, *pcbUrlInfo) PCRYPT_URL_INFO pUrlInfo,
6071   _Inout_opt_ DWORD* pcbUrlInfo,
6072   _Reserved_ LPVOID pvReserved);
6073 
6074 _Success_(return != 0)
6075 BOOL
6076 WINAPI
6077 CryptGetTimeValidObject(
6078   _In_ LPCSTR pszTimeValidOid,
6079   _In_ void *pvPara,
6080   _In_ PCCERT_CONTEXT pIssuer,
6081   _In_opt_ LPFILETIME pftValidFor,
6082   _In_ DWORD dwFlags,
6083   _In_ DWORD dwTimeout,
6084   _Outptr_opt_ void **ppvObject,
6085   _In_opt_ PCRYPT_CREDENTIALS pCredentials,
6086   _Inout_opt_ void *pvReserved);
6087 
6088 BOOL
6089 WINAPI
6090 CryptFlushTimeValidObject(
6091   _In_ LPCSTR pszFlushTimeValidOid,
6092   _In_ void *pvPara,
6093   _In_ PCCERT_CONTEXT pIssuer,
6094   _In_ DWORD dwFlags,
6095   _Reserved_ void *pvReserved);
6096 
6097 BOOL
6098 WINAPI
6099 CryptInstallCancelRetrieval(
6100   __callback PFN_CRYPT_CANCEL_RETRIEVAL pfnCancel,
6101   _In_opt_ const void *pvArg,
6102   _In_ DWORD dwFlags,
6103   _Reserved_ void *pvReserved);
6104 
6105 BOOL
6106 WINAPI
6107 CryptUninstallCancelRetrieval(
6108   _In_ DWORD dwFlags,
6109   _Reserved_ void *pvReserved);
6110 
6111 _Success_(return != 0)
6112 BOOL
6113 WINAPI
6114 CryptRetrieveObjectByUrlA(
6115   _In_ LPCSTR pszUrl,
6116   _In_opt_ LPCSTR pszObjectOid,
6117   _In_ DWORD dwRetrievalFlags,
6118   _In_ DWORD dwTimeout,
6119   _Outptr_ LPVOID* ppvObject,
6120   _In_opt_ HCRYPTASYNC hAsyncRetrieve,
6121   _In_opt_ PCRYPT_CREDENTIALS pCredentials,
6122   _In_opt_ LPVOID pvVerify,
6123   _Inout_opt_ PCRYPT_RETRIEVE_AUX_INFO pAuxInfo);
6124 
6125 _Success_(return != 0)
6126 BOOL
6127 WINAPI
6128 CryptRetrieveObjectByUrlW(
6129   _In_ LPCWSTR pszUrl,
6130   _In_opt_ LPCSTR pszObjectOid,
6131   _In_ DWORD dwRetrievalFlags,
6132   _In_ DWORD dwTimeout,
6133   _Outptr_ LPVOID* ppvObject,
6134   _In_opt_ HCRYPTASYNC hAsyncRetrieve,
6135   _In_opt_ PCRYPT_CREDENTIALS pCredentials,
6136   _In_opt_ LPVOID pvVerify,
6137   _Inout_opt_ PCRYPT_RETRIEVE_AUX_INFO pAuxInfo);
6138 
6139 #define CryptRetrieveObjectByUrl WINELIB_NAME_AW(CryptRetrieveObjectByUrl)
6140 
6141 /* Not found in crypt32.dll but in softpub.dll */
6142 HRESULT
6143 WINAPI
6144 FindCertsByIssuer(
6145   _Out_writes_bytes_to_opt_(*pcbCertChains, *pcbCertChains) PCERT_CHAIN pCertChains,
6146   _Inout_ DWORD *pcbCertChains,
6147   _Out_ DWORD *pcCertChains,
6148   _In_reads_bytes_opt_(cbEncodedIssuerName) BYTE* pbEncodedIssuerName,
6149   _In_ DWORD cbEncodedIssuerName,
6150   _In_opt_ LPCWSTR pwszPurpose,
6151   _In_ DWORD dwKeySpec);
6152 
6153 #ifdef _MSC_VER
6154 #pragma warning(pop)
6155 #endif
6156 
6157 #ifdef __cplusplus
6158 }
6159 #endif
6160 
6161 #endif
6162