VirtualBox

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

Last change on this file since 19982 was 19678, checked in by vboxsync, 16 years ago

opengl: update wine to 1.1.21, add d3d9.dll to build list

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