VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/Wine/include/wincrypt.h@ 30705

Last change on this file since 30705 was 28475, checked in by vboxsync, 15 years ago

crOpenGL: update to wine 1.1.43

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

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette