[PSDK] Update bcrypt.h and wincrypt.h. CORE-14434
[reactos.git] / sdk / include / psdk / wincrypt.h
1 /*
2 * Copyright (C) 2002 Travis Michielsen
3 * Copyright (C) 2004-2005 Juan Lang
4 * Copyright (C) 2007 Vijay Kiran Kamuju
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21 #ifndef __WINE_WINCRYPT_H
22 #define __WINE_WINCRYPT_H
23
24 #include <specstrings.h>
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29
30 #ifdef _MSC_VER
31 #pragma warning(push)
32 #pragma warning(disable:4201)
33 #endif
34
35 #include <bcrypt.h>
36 /* FIXME: #include <ncrypt.h> */
37
38 #ifdef _ADVAPI32_
39 # define WINADVAPI
40 #else
41 # define WINADVAPI DECLSPEC_IMPORT
42 #endif
43
44 /* some typedefs for function parameters */
45 typedef unsigned int ALG_ID;
46 typedef ULONG_PTR HCRYPTPROV;
47 typedef ULONG_PTR HCRYPTPROV_OR_NCRYPT_KEY_HANDLE;
48 typedef ULONG_PTR HCRYPTPROV_LEGACY;
49 typedef ULONG_PTR HCRYPTKEY;
50 typedef ULONG_PTR HCRYPTHASH;
51 typedef void *HCERTSTORE;
52 typedef void *HCRYPTMSG;
53 typedef void *HCERTSTOREPROV;
54 typedef void *HCRYPTOIDFUNCSET;
55 typedef void *HCRYPTOIDFUNCADDR;
56 typedef void *HCRYPTDEFAULTCONTEXT;
57
58 /* CSP Structs */
59
60 typedef struct _PROV_ENUMALGS {
61 ALG_ID aiAlgid;
62 DWORD dwBitLen;
63 DWORD dwNameLen;
64 CHAR szName[20];
65 } PROV_ENUMALGS;
66
67 typedef struct _PROV_ENUMALGS_EX {
68 ALG_ID aiAlgid;
69 DWORD dwDefaultLen;
70 DWORD dwMinLen;
71 DWORD dwMaxLen;
72 DWORD dwProtocols;
73 DWORD dwNameLen;
74 CHAR szName[20];
75 DWORD dwLongNameLen;
76 CHAR szLongName[40];
77 } PROV_ENUMALGS_EX;
78
79 #define SCHANNEL_MAC_KEY 0
80 #define SCHANNEL_ENC_KEY 1
81
82 typedef struct _SCHANNEL_ALG {
83 DWORD dwUse;
84 ALG_ID Algid;
85 DWORD cBits;
86 DWORD dwFlags;
87 DWORD dwReserved;
88 } SCHANNEL_ALG, *PSCHANNEL_ALG;
89
90
91 #define CRYPT_IPSEC_HMAC_KEY 0x0100
92
93 typedef struct _HMAC_INFO {
94 ALG_ID HashAlgid;
95 BYTE* pbInnerString;
96 DWORD cbInnerString;
97 BYTE* pbOuterString;
98 DWORD cbOuterString;
99 } HMAC_INFO, *PHMAC_INFO;
100
101 typedef struct _CRYPTOAPI_BLOB {
102 DWORD cbData;
103 BYTE* pbData;
104 } CRYPT_INTEGER_BLOB, *PCRYPT_INTEGER_BLOB,
105 CRYPT_UINT_BLOB, *PCRYPT_UINT_BLOB,
106 CRYPT_OBJID_BLOB, *PCRYPT_OBJID_BLOB,
107 CERT_NAME_BLOB, *PCERT_NAME_BLOB,
108 CERT_RDN_VALUE_BLOB, *PCERT_RDN_VALUE_BLOB,
109 CERT_BLOB, *PCERT_BLOB,
110 CRL_BLOB, *PCRL_BLOB,
111 DATA_BLOB, *PDATA_BLOB,
112 CRYPT_DATA_BLOB, *PCRYPT_DATA_BLOB,
113 CRYPT_HASH_BLOB, *PCRYPT_HASH_BLOB,
114 CRYPT_DIGEST_BLOB, *PCRYPT_DIGEST_BLOB,
115 CRYPT_DER_BLOB, *PCRYPT_DER_BLOB,
116 CRYPT_ATTR_BLOB, *PCRYPT_ATTR_BLOB;
117
118 typedef struct _CRYPTPROTECT_PROMPTSTRUCT{
119 DWORD cbSize;
120 DWORD dwPromptFlags;
121 HWND hwndApp;
122 LPCWSTR szPrompt;
123 } CRYPTPROTECT_PROMPTSTRUCT, *PCRYPTPROTECT_PROMPTSTRUCT;
124
125 typedef struct _CRYPT_ALGORITHM_IDENTIFIER {
126 LPSTR pszObjId;
127 CRYPT_OBJID_BLOB Parameters;
128 } CRYPT_ALGORITHM_IDENTIFIER, *PCRYPT_ALGORITHM_IDENTIFIER;
129
130 typedef struct _CRYPT_ATTRIBUTE_TYPE_VALUE {
131 LPSTR pszObjId;
132 CRYPT_OBJID_BLOB Value;
133 } CRYPT_ATTRIBUTE_TYPE_VALUE, *PCRYPT_ATTRIBUTE_TYPE_VALUE;
134
135 typedef struct _PUBLICKEYSTRUC {
136 BYTE bType;
137 BYTE bVersion;
138 WORD reserved;
139 ALG_ID aiKeyAlg;
140 } BLOBHEADER, PUBLICKEYSTRUC;
141
142 typedef struct _RSAPUBKEY {
143 DWORD magic;
144 DWORD bitlen;
145 DWORD pubexp;
146 } RSAPUBKEY;
147
148 typedef struct _PUBKEY {
149 DWORD magic;
150 DWORD bitlen;
151 } DHPUBKEY, DSSPUBKEY, KEAPUBKEY, TEKPUBKEY;
152
153 typedef struct _DSSSEED {
154 DWORD counter;
155 BYTE seed[20];
156 } DSSSEED;
157
158 typedef struct _PUBKEYVER3 {
159 DWORD magic;
160 DWORD bitlenP;
161 DWORD bitlenQ;
162 DWORD bitlenJ;
163 DSSSEED DSSSeed;
164 } DHPUBKEY_VER3, DSSPUBKEY_VER3;
165
166 typedef struct _PRIVKEYVER3 {
167 DWORD magic;
168 DWORD bitlenP;
169 DWORD bitlenQ;
170 DWORD bitlenJ;
171 DWORD bitlenX;
172 DSSSEED DSSSeed;
173 } DHPRIVKEY_VER3, DSSPRIVKEY_VER3;
174
175 typedef struct _KEY_TYPE_SUBTYPE {
176 DWORD dwKeySpec;
177 GUID Type;
178 GUID SubType;
179 } KEY_TYPE_SUBTYPE, *PKEY_TYPE_SUBTYPE;
180
181 typedef struct _CERT_FORTEZZA_DATA_PROP {
182 unsigned char SerialNumber[8];
183 int CertIndex;
184 unsigned char CertLabel[36];
185 } CERT_FORTEZZA_DATA_PROP;
186
187 typedef struct _CMS_DH_KEY_INFO {
188 DWORD dwVersion;
189 ALG_ID Algid;
190 LPSTR pszContentEncObjId;
191 CRYPT_DATA_BLOB PubInfo;
192 void *pReserved;
193 } CMS_DH_KEY_INFO, *PCMS_DH_KEY_INFO;
194
195 typedef struct _CRYPT_BIT_BLOB {
196 DWORD cbData;
197 BYTE *pbData;
198 DWORD cUnusedBits;
199 } CRYPT_BIT_BLOB, *PCRYPT_BIT_BLOB;
200
201 typedef struct _CRYPT_KEY_PROV_PARAM {
202 DWORD dwParam;
203 BYTE *pbData;
204 DWORD cbData;
205 DWORD dwFlags;
206 } CRYPT_KEY_PROV_PARAM, *PCRYPT_KEY_PROV_PARAM;
207
208 typedef struct _CRYPT_KEY_PROV_INFO {
209 LPWSTR pwszContainerName;
210 LPWSTR pwszProvName;
211 DWORD dwProvType;
212 DWORD dwFlags;
213 DWORD cProvParam;
214 PCRYPT_KEY_PROV_PARAM rgProvParam;
215 DWORD dwKeySpec;
216 } CRYPT_KEY_PROV_INFO, *PCRYPT_KEY_PROV_INFO;
217
218 typedef struct _CERT_KEY_CONTEXT {
219 DWORD cbSize;
220 HCRYPTPROV hCryptProv;
221 DWORD dwKeySpec;
222 } CERT_KEY_CONTEXT, *PCERT_KEY_CONTEXT;
223
224 typedef struct _CERT_PUBLIC_KEY_INFO {
225 CRYPT_ALGORITHM_IDENTIFIER Algorithm;
226 CRYPT_BIT_BLOB PublicKey;
227 } CERT_PUBLIC_KEY_INFO, *PCERT_PUBLIC_KEY_INFO;
228
229 typedef struct _CERT_EXTENSION {
230 LPSTR pszObjId;
231 BOOL fCritical;
232 CRYPT_OBJID_BLOB Value;
233 } CERT_EXTENSION, *PCERT_EXTENSION;
234
235 typedef struct _CERT_EXTENSIONS {
236 DWORD cExtension;
237 PCERT_EXTENSION rgExtension;
238 } CERT_EXTENSIONS, *PCERT_EXTENSIONS;
239
240 typedef struct _CERT_INFO {
241 DWORD dwVersion;
242 CRYPT_INTEGER_BLOB SerialNumber;
243 CRYPT_ALGORITHM_IDENTIFIER SignatureAlgorithm;
244 CERT_NAME_BLOB Issuer;
245 FILETIME NotBefore;
246 FILETIME NotAfter;
247 CERT_NAME_BLOB Subject;
248 CERT_PUBLIC_KEY_INFO SubjectPublicKeyInfo;
249 CRYPT_BIT_BLOB IssuerUniqueId;
250 CRYPT_BIT_BLOB SubjectUniqueId;
251 DWORD cExtension;
252 PCERT_EXTENSION rgExtension;
253 } CERT_INFO, *PCERT_INFO;
254
255 typedef struct _CERT_RDN_ATTR {
256 LPSTR pszObjId;
257 DWORD dwValueType;
258 CERT_RDN_VALUE_BLOB Value;
259 } CERT_RDN_ATTR, *PCERT_RDN_ATTR;
260
261 typedef struct _CERT_RDN {
262 DWORD cRDNAttr;
263 PCERT_RDN_ATTR rgRDNAttr;
264 } CERT_RDN, *PCERT_RDN;
265
266 typedef struct _CERT_NAME_INFO {
267 DWORD cRDN;
268 PCERT_RDN rgRDN;
269 } CERT_NAME_INFO, *PCERT_NAME_INFO;
270
271 typedef struct _CERT_NAME_VALUE {
272 DWORD dwValueType;
273 CERT_RDN_VALUE_BLOB Value;
274 } CERT_NAME_VALUE, *PCERT_NAME_VALUE;
275
276 typedef struct _CERT_ENCRYPTED_PRIVATE_KEY_INFO {
277 CRYPT_ALGORITHM_IDENTIFIER EncryptionAlgorithm;
278 CRYPT_DATA_BLOB EncryptedPrivateKey;
279 } CERT_ENCRYPTED_PRIVATE_KEY_INFO, *PCERT_ENCRYPTED_PRIVATE_KEY_INFO;
280
281 typedef struct _CERT_AUTHORITY_KEY_ID_INFO {
282 CRYPT_DATA_BLOB KeyId;
283 CERT_NAME_BLOB CertIssuer;
284 CRYPT_INTEGER_BLOB CertSerialNumber;
285 } CERT_AUTHORITY_KEY_ID_INFO, *PCERT_AUTHORITY_KEY_ID_INFO;
286
287 typedef struct _CERT_PRIVATE_KEY_VALIDITY {
288 FILETIME NotBefore;
289 FILETIME NotAfter;
290 } CERT_PRIVATE_KEY_VALIDITY, *PCERT_PRIVATE_KEY_VALIDITY;
291
292 typedef struct _CERT_KEY_ATTRIBUTES_INFO {
293 CRYPT_DATA_BLOB KeyId;
294 CRYPT_BIT_BLOB IntendedKeyUsage;
295 PCERT_PRIVATE_KEY_VALIDITY pPrivateKeyUsagePeriod;
296 } CERT_KEY_ATTRIBUTES_INFO, *PCERT_KEY_ATTRIBUTES_INFO;
297
298 typedef struct _CERT_ECC_SIGNATURE {
299 CRYPT_UINT_BLOB r;
300 CRYPT_UINT_BLOB s;
301 } CERT_ECC_SIGNATURE, *PCERT_ECC_SIGNATURE;
302
303 /* byte 0 */
304 #define CERT_DIGITAL_SIGNATURE_KEY_USAGE 0x80
305 #define CERT_NON_REPUDIATION_KEY_USAGE 0x40
306 #define CERT_KEY_ENCIPHERMENT_KEY_USAGE 0x20
307 #define CERT_DATA_ENCIPHERMENT_KEY_USAGE 0x10
308 #define CERT_KEY_AGREEMENT_KEY_USAGE 0x08
309 #define CERT_KEY_CERT_SIGN_KEY_USAGE 0x04
310 #define CERT_OFFLINE_CRL_SIGN_KEY_USAGE 0x02
311 #define CERT_CRL_SIGN_KEY_USAGE 0x02
312 #define CERT_ENCIPHER_ONLY_KEY_USAGE 0x01
313 /* byte 1 */
314 #define CERT_DECIPHER_ONLY_KEY_USAGE 0x80
315
316 typedef struct _CERT_POLICY_ID {
317 DWORD cCertPolicyElementId;
318 LPSTR *rgbszCertPolicyElementId;
319 } CERT_POLICY_ID, *PCERT_POLICY_ID;
320
321 typedef struct _CERT_KEY_USAGE_RESTRICTION_INFO {
322 DWORD cCertPolicyId;
323 PCERT_POLICY_ID rgCertPolicyId;
324 CRYPT_BIT_BLOB RestrictedKeyUsage;
325 } CERT_KEY_USAGE_RESTRICTION_INFO, *PCERT_KEY_USAGE_RESTRICTION_INFO;
326
327 typedef struct _CERT_OTHER_NAME {
328 LPSTR pszObjId;
329 CRYPT_OBJID_BLOB Value;
330 } CERT_OTHER_NAME, *PCERT_OTHER_NAME;
331
332 typedef struct _CERT_ALT_NAME_ENTRY {
333 DWORD dwAltNameChoice;
334 union {
335 PCERT_OTHER_NAME pOtherName;
336 LPWSTR pwszRfc822Name;
337 LPWSTR pwszDNSName;
338 CERT_NAME_BLOB DirectoryName;
339 LPWSTR pwszURL;
340 CRYPT_DATA_BLOB IPAddress;
341 LPSTR pszRegisteredID;
342 } DUMMYUNIONNAME;
343 } CERT_ALT_NAME_ENTRY, *PCERT_ALT_NAME_ENTRY;
344
345 #define CERT_ALT_NAME_OTHER_NAME 1
346 #define CERT_ALT_NAME_RFC822_NAME 2
347 #define CERT_ALT_NAME_DNS_NAME 3
348 #define CERT_ALT_NAME_X400_ADDRESS 4
349 #define CERT_ALT_NAME_DIRECTORY_NAME 5
350 #define CERT_ALT_NAME_EDI_PARTY_NAME 6
351 #define CERT_ALT_NAME_URL 7
352 #define CERT_ALT_NAME_IP_ADDRESS 8
353 #define CERT_ALT_NAME_REGISTERED_ID 9
354
355 typedef struct _CERT_ALT_NAME_INFO {
356 DWORD cAltEntry;
357 PCERT_ALT_NAME_ENTRY rgAltEntry;
358 } CERT_ALT_NAME_INFO, *PCERT_ALT_NAME_INFO;
359
360 #define CERT_ALT_NAME_ENTRY_ERR_INDEX_MASK 0xff
361 #define CERT_ALT_NAME_ENTRY_ERR_INDEX_SHIFT 16
362 #define CERT_ALT_NAME_VALUE_ERR_INDEX_MASK 0x0000ffff
363 #define CERT_ALT_NAME_VALUE_ERR_INDEX_SHIFT 0
364 #define GET_CERT_ALT_NAME_ENTRY_ERR_INDEX(x) \
365 (((x) >> CERT_ALT_NAME_ENTRY_ERR_INDEX_SHIFT) & \
366 CERT_ALT_NAME_ENTRY_ERR_INDEX_MASK)
367 #define GET_CERT_ALT_NAME_VALUE_ERR_INDEX(x) \
368 ((x) & CERT_ALT_NAME_VALUE_ERR_INDEX_MASK)
369
370 typedef struct _CERT_BASIC_CONSTRAINTS_INFO {
371 CRYPT_BIT_BLOB SubjectType;
372 BOOL fPathLenConstraint;
373 DWORD dwPathLenConstraint;
374 DWORD cSubtreesConstraint;
375 CERT_NAME_BLOB *rgSubtreesConstraint;
376 } CERT_BASIC_CONSTRAINTS_INFO, *PCERT_BASIC_CONSTRAINTS_INFO;
377
378 #define CERT_CA_SUBJECT_FLAG 0x80
379 #define CERT_END_ENTITY_SUBJECT_FLAG 0x40
380
381 typedef struct _CERT_BASIC_CONSTRAINTS2_INFO {
382 BOOL fCA;
383 BOOL fPathLenConstraint;
384 DWORD dwPathLenConstraint;
385 } CERT_BASIC_CONSTRAINTS2_INFO, *PCERT_BASIC_CONSTRAINTS2_INFO;
386
387 typedef struct _CERT_POLICY_QUALIFIER_INFO {
388 LPSTR pszPolicyQualifierId;
389 CRYPT_OBJID_BLOB Qualifier;
390 } CERT_POLICY_QUALIFIER_INFO, *PCERT_POLICY_QUALIFIER_INFO;
391
392 typedef struct _CERT_POLICY_INFO {
393 LPSTR pszPolicyIdentifier;
394 DWORD cPolicyQualifier;
395 CERT_POLICY_QUALIFIER_INFO *rgPolicyQualifier;
396 } CERT_POLICY_INFO, *PCERT_POLICY_INFO;
397
398 typedef struct _CERT_POLICIES_INFO {
399 DWORD cPolicyInfo;
400 CERT_POLICY_INFO *rgPolicyInfo;
401 } CERT_POLICIES_INFO, *PCERT_POLICIES_INFO;
402
403 typedef struct _CERT_POLICY_QUALIFIER_NOTICE_REFERENCE {
404 LPSTR pszOrganization;
405 DWORD cNoticeNumbers;
406 int *rgNoticeNumbers;
407 } CERT_POLICY_QUALIFIER_NOTICE_REFERENCE,
408 *PCERT_POLICY_QUALIFIER_NOTICE_REFERENCE;
409
410 typedef struct _CERT_POLICY_QUALIFIER_USER_NOTICE {
411 CERT_POLICY_QUALIFIER_NOTICE_REFERENCE *pNoticeReference;
412 LPWSTR pszDisplayText;
413 } CERT_POLICY_QUALIFIER_USER_NOTICE, *PCERT_POLICY_QUALIFIER_USER_NOTICE;
414
415 typedef struct _CPS_URLS {
416 LPWSTR pszURL;
417 CRYPT_ALGORITHM_IDENTIFIER *pAlgorithm;
418 CRYPT_DATA_BLOB *pDigest;
419 } CPS_URLS, *PCPS_URLS;
420
421 typedef struct _CERT_POLICY95_QUALIFIER1 {
422 LPWSTR pszPracticesReference;
423 LPSTR pszNoticeIdentifier;
424 LPSTR pszNSINoticeIdentifier;
425 DWORD cCPSURLs;
426 CPS_URLS *rgCPSURLs;
427 } CERT_POLICY95_QUALIFIER1, *PCERT_POLICY95_QUALIFIER1;
428
429 typedef struct _CERT_POLICY_MAPPING {
430 LPSTR pszIssuerDomainPolicy;
431 LPSTR pszSubjectDomainPolicy;
432 } CERT_POLICY_MAPPING, *PCERT_POLICY_MAPPING;
433
434 typedef struct _CERT_POLICY_MAPPINGS_INFO {
435 DWORD cPolicyMapping;
436 PCERT_POLICY_MAPPING rgPolicyMapping;
437 } CERT_POLICY_MAPPINGS_INFO, *PCERT_POLICY_MAPPINGS_INFO;
438
439 typedef struct _CERT_POLICY_CONSTRAINTS_INFO {
440 BOOL fRequireExplicitPolicy;
441 DWORD dwRequireExplicitPolicySkipCerts;
442 BOOL fInhibitPolicyMapping;
443 DWORD dwInhibitPolicyMappingSkipCerts;
444 } CERT_POLICY_CONSTRAINTS_INFO, *PCERT_POLICY_CONSTRAINTS_INFO;
445
446 typedef struct _CRYPT_CONTENT_INFO_SEQUENCE_OF_ANY {
447 LPSTR pszObjId;
448 DWORD cValue;
449 PCRYPT_DER_BLOB rgValue;
450 } CRYPT_CONTENT_INFO_SEQUENCE_OF_ANY, *PCRYPT_CONTENT_INFO_SEQUENCE_OF_ANY;
451
452 typedef struct _CRYPT_CONTENT_INFO {
453 LPSTR pszObjId;
454 CRYPT_DER_BLOB Content;
455 } CRYPT_CONTENT_INFO, *PCRYPT_CONTENT_INFO;
456
457 typedef struct _CRYPT_SEQUENCE_OF_ANY {
458 DWORD cValue;
459 PCRYPT_DER_BLOB rgValue;
460 } CRYPT_SEQUENCE_OF_ANY, *PCRYPT_SEQUENCE_OF_ANY;
461
462 typedef struct _CERT_AUTHORITY_KEY_ID2_INFO {
463 CRYPT_DATA_BLOB KeyId;
464 CERT_ALT_NAME_INFO AuthorityCertIssuer;
465 CRYPT_INTEGER_BLOB AuthorityCertSerialNumber;
466 } CERT_AUTHORITY_KEY_ID2_INFO, *PCERT_AUTHORITY_KEY_ID2_INFO;
467
468 typedef struct _CERT_ACCESS_DESCRIPTION {
469 LPSTR pszAccessMethod;
470 CERT_ALT_NAME_ENTRY AccessLocation;
471 } CERT_ACCESS_DESCRIPTION, *PCERT_ACCESS_DESCRIPTION;
472
473 typedef struct _CERT_AUTHORITY_INFO_ACCESS {
474 DWORD cAccDescr;
475 PCERT_ACCESS_DESCRIPTION rgAccDescr;
476 } CERT_AUTHORITY_INFO_ACCESS, *PCERT_AUTHORITY_INFO_ACCESS;
477
478 typedef struct _CERT_CONTEXT {
479 DWORD dwCertEncodingType;
480 BYTE *pbCertEncoded;
481 DWORD cbCertEncoded;
482 PCERT_INFO pCertInfo;
483 HCERTSTORE hCertStore;
484 } CERT_CONTEXT, *PCERT_CONTEXT;
485 typedef const CERT_CONTEXT *PCCERT_CONTEXT;
486
487 typedef struct _CRL_ENTRY {
488 CRYPT_INTEGER_BLOB SerialNumber;
489 FILETIME RevocationDate;
490 DWORD cExtension;
491 PCERT_EXTENSION rgExtension;
492 } CRL_ENTRY, *PCRL_ENTRY;
493
494 typedef struct _CRL_INFO {
495 DWORD dwVersion;
496 CRYPT_ALGORITHM_IDENTIFIER SignatureAlgorithm;
497 CERT_NAME_BLOB Issuer;
498 FILETIME ThisUpdate;
499 FILETIME NextUpdate;
500 DWORD cCRLEntry;
501 PCRL_ENTRY rgCRLEntry;
502 DWORD cExtension;
503 PCERT_EXTENSION rgExtension;
504 } CRL_INFO, *PCRL_INFO;
505
506 typedef struct _CRL_DIST_POINT_NAME {
507 DWORD dwDistPointNameChoice;
508 union {
509 CERT_ALT_NAME_INFO FullName;
510 } DUMMYUNIONNAME;
511 } CRL_DIST_POINT_NAME, *PCRL_DIST_POINT_NAME;
512
513 #define CRL_DIST_POINT_NO_NAME 0
514 #define CRL_DIST_POINT_FULL_NAME 1
515 #define CRL_DIST_POINT_ISSUER_RDN_NAME 2
516
517 typedef struct _CRL_DIST_POINT {
518 CRL_DIST_POINT_NAME DistPointName;
519 CRYPT_BIT_BLOB ReasonFlags;
520 CERT_ALT_NAME_INFO CRLIssuer;
521 } CRL_DIST_POINT, *PCRL_DIST_POINT;
522
523 #define CRL_REASON_UNUSED_FLAG 0x80
524 #define CRL_REASON_KEY_COMPROMISE_FLAG 0x40
525 #define CRL_REASON_CA_COMPROMISE_FLAG 0x20
526 #define CRL_REASON_AFFILIATION_CHANGED_FLAG 0x10
527 #define CRL_REASON_SUPERSEDED_FLAG 0x08
528 #define CRL_REASON_CESSATION_OF_OPERATION_FLAG 0x04
529 #define CRL_REASON_CERTIFICATE_HOLD_FLAG 0x02
530
531 typedef struct _CRL_DIST_POINTS_INFO {
532 DWORD cDistPoint;
533 PCRL_DIST_POINT rgDistPoint;
534 } CRL_DIST_POINTS_INFO, *PCRL_DIST_POINTS_INFO;
535
536 #define CRL_DIST_POINT_ERR_INDEX_MASK 0x7f
537 #define CRL_DIST_POINT_ERR_INDEX_SHIFT 24
538 #define GET_CRL_DIST_POINT_ERR_INDEX(x) \
539 (((x) >> CRL_DIST_POINT_ERR_INDEX_SHIFT) & CRL_DIST_POINT_ERR_INDEX_MASK)
540
541 #define CRL_DIST_POINT_ERR_CRL_ISSUER_BIT 0x80000000L
542 #define IS_CRL_DIST_POINT_ERR_CRL_ISSUER(x) \
543 ((x) & CRL_DIST_POINT_ERR_CRL_ISSUER_BIT)
544
545 typedef struct _CROSS_CERT_DIST_POINTS_INFO {
546 DWORD dwSyncDeltaTime;
547 DWORD cDistPoint;
548 PCERT_ALT_NAME_INFO rgDistPoint;
549 } CROSS_CERT_DIST_POINTS_INFO, *PCROSS_CERT_DIST_POINTS_INFO;
550
551 #define CROSS_CERT_DIST_POINT_ERR_INDEX_MASK 0xff
552 #define CROSS_CERT_DIST_POINT_ERR_INDEX_SHIFT 24
553 #define GET_CROSS_CERT_DIST_POINT_ERR_INDEX(x) \
554 (((x) >> CROSS_CERT_DIST_POINT_ERR_INDEX_SHIFT) & \
555 CROSS_CERT_DIST_POINT_ERR_INDEX_MASK)
556
557 typedef struct _CERT_PAIR {
558 CERT_BLOB Forward;
559 CERT_BLOB Reverse;
560 } CERT_PAIR, *PCERT_PAIR;
561
562 typedef struct _CRL_ISSUING_DIST_POINT {
563 CRL_DIST_POINT_NAME DistPointName;
564 BOOL fOnlyContainsUserCerts;
565 BOOL fOnlyContainsCACerts;
566 CRYPT_BIT_BLOB OnlySomeReasonFlags;
567 BOOL fIndirectCRL;
568 } CRL_ISSUING_DIST_POINT, *PCRL_ISSUING_DIST_POINT;
569
570 typedef struct _CERT_GENERAL_SUBTREE {
571 CERT_ALT_NAME_ENTRY Base;
572 DWORD dwMinimum;
573 BOOL fMaximum;
574 DWORD dwMaximum;
575 } CERT_GENERAL_SUBTREE, *PCERT_GENERAL_SUBTREE;
576
577 typedef struct _CERT_NAME_CONSTRAINTS_INFO {
578 DWORD cPermittedSubtree;
579 PCERT_GENERAL_SUBTREE rgPermittedSubtree;
580 DWORD cExcludedSubtree;
581 PCERT_GENERAL_SUBTREE rgExcludedSubtree;
582 } CERT_NAME_CONSTRAINTS_INFO, *PCERT_NAME_CONSTRAINTS_INFO;
583
584 #define CERT_EXCLUDED_SUBTREE_BIT 0x80000000L
585 #define IS_CERT_EXCLUDED_SUBTREE(x) ((x) & CERT_EXCLUDED_SUBTREE_BIT)
586
587 typedef struct _CRYPT_ATTRIBUTE {
588 LPSTR pszObjId;
589 DWORD cValue;
590 PCRYPT_DATA_BLOB rgValue;
591 } CRYPT_ATTRIBUTE, *PCRYPT_ATTRIBUTE;
592
593 typedef struct _CRYPT_ATTRIBUTES {
594 DWORD cAttr;
595 PCRYPT_ATTRIBUTE rgAttr;
596 } CRYPT_ATTRIBUTES, *PCRYPT_ATTRIBUTES;
597
598 typedef struct _CERT_REQUEST_INFO {
599 DWORD dwVersion;
600 CERT_NAME_BLOB Subject;
601 CERT_PUBLIC_KEY_INFO SubjectPublicKeyInfo;
602 DWORD cAttribute;
603 PCRYPT_ATTRIBUTE rgAttribute;
604 } CERT_REQUEST_INFO, *PCERT_REQUEST_INFO;
605
606 typedef struct _CERT_KEYGEN_REQUEST_INFO {
607 DWORD dwVersion;
608 CERT_PUBLIC_KEY_INFO SubjectPublicKeyInfo;
609 LPWSTR pwszChallengeString;
610 } CERT_KEYGEN_REQUEST_INFO, *PCERT_KEYGEN_REQUEST_INFO;
611
612 typedef struct _CERT_SIGNED_CONTENT_INFO {
613 CRYPT_DER_BLOB ToBeSigned;
614 CRYPT_ALGORITHM_IDENTIFIER SignatureAlgorithm;
615 CRYPT_BIT_BLOB Signature;
616 } CERT_SIGNED_CONTENT_INFO, *PCERT_SIGNED_CONTENT_INFO;
617
618 typedef struct _CRL_CONTEXT {
619 DWORD dwCertEncodingType;
620 BYTE *pbCrlEncoded;
621 DWORD cbCrlEncoded;
622 PCRL_INFO pCrlInfo;
623 HCERTSTORE hCertStore;
624 } CRL_CONTEXT, *PCRL_CONTEXT;
625 typedef const CRL_CONTEXT *PCCRL_CONTEXT;
626
627 #define SORTED_CTL_EXT_FLAGS_OFFSET (0*4)
628 #define SORTED_CTL_EXT_COUNT_OFFSET (1*4)
629 #define SORTED_CTL_EXT_MAX_COLLISION_OFFSET (2*4)
630 #define SORTED_CTL_EXT_HASH_BUCKET_OFFSET (3*4)
631
632 #define SORTED_CTL_EXT_HASHED_SUBJECT_IDENTIFIER_FLAG 0x1
633
634 typedef struct _CERT_DSS_PARAMETERS {
635 CRYPT_UINT_BLOB p;
636 CRYPT_UINT_BLOB q;
637 CRYPT_UINT_BLOB g;
638 } CERT_DSS_PARAMETERS, *PCERT_DSS_PARAMETERS;
639
640 #define CERT_DSS_R_LEN 20
641 #define CERT_DSS_S_LEN 20
642 #define CERT_DSS_SIGNATURE_LEN (CERT_DSS_R_LEN + CERT_DSS_S_LEN)
643
644 #define CERT_MAX_ENCODED_DSS_SIGNATURE_LEN (2 + 2*(2 + 20 +1))
645
646 typedef struct _CERT_DH_PARAMETERS {
647 CRYPT_UINT_BLOB p;
648 CRYPT_UINT_BLOB g;
649 } CERT_DH_PARAMETERS, *PCERT_DH_PARAMETERS;
650
651 typedef struct _CERT_X942_DH_VALIDATION_PARAMS {
652 CRYPT_BIT_BLOB seed;
653 DWORD pgenCounter;
654 } CERT_X942_DH_VALIDATION_PARAMS, *PCERT_X942_DH_VALIDATION_PARAMS;
655
656 typedef struct _CERT_X942_DH_PARAMETERS {
657 CRYPT_UINT_BLOB p;
658 CRYPT_UINT_BLOB g;
659 CRYPT_UINT_BLOB q;
660 CRYPT_UINT_BLOB j;
661 PCERT_X942_DH_VALIDATION_PARAMS pValidationParams;
662 } CERT_X942_DH_PARAMETERS, *PCERT_X942_DH_PARAMETERS;
663
664 #define CRYPT_X942_COUNTER_BYTE_LENGTH 4
665 #define CRYPT_X942_KEY_LENGTH_BYTE_LENGTH 4
666 #define CRYPT_X942_PUB_INFO_BYTE_LENGTH (512/8)
667
668 typedef struct _CRYPT_X942_OTHER_INFO {
669 LPSTR pszContentEncryptionObjId;
670 BYTE rgbCounter[CRYPT_X942_COUNTER_BYTE_LENGTH];
671 BYTE rgbKeyLength[CRYPT_X942_KEY_LENGTH_BYTE_LENGTH];
672 CRYPT_DATA_BLOB PubInfo;
673 } CRYPT_X942_OTHER_INFO, *PCRYPT_X942_OTHER_INFO;
674
675 typedef struct _CRYPT_RC2_CBC_PARAMETERS {
676 DWORD dwVersion;
677 BOOL fIV;
678 BYTE rgbIV[4];
679 } CRYPT_RC2_CBC_PARAMETERS, *PCRYPT_RC2_CBC_PARAMETERS;
680
681 #define CRYPT_RC2_40BIT_VERSION 160
682 #define CRYPT_RC2_56BIT_VERSION 52
683 #define CRYPT_RC2_64BIT_VERSION 120
684 #define CRYPT_RC2_128BIT_VERSION 58
685
686 typedef struct _CRYPT_SMIME_CAPABILITY {
687 LPSTR pszObjId;
688 CRYPT_OBJID_BLOB Parameters;
689 } CRYPT_SMIME_CAPABILITY, *PCRYPT_SMIME_CAPABILITY;
690
691 typedef struct _CRYPT_SMIME_CAPABILITIES {
692 DWORD cCapability;
693 PCRYPT_SMIME_CAPABILITY rgCapability;
694 } CRYPT_SMIME_CAPABILITIES, *PCRYPT_SMIME_CAPABILITIES;
695
696 typedef struct _VTableProvStruc {
697 DWORD Version;
698 #ifdef WINE_STRICT_PROTOTYPES
699 BOOL (WINAPI *FuncVerifyImage)(LPCSTR,BYTE*);
700 void (WINAPI *FuncReturnhWnd)(HWND*);
701 #else
702 FARPROC FuncVerifyImage;
703 FARPROC FuncReturnhWnd;
704 #endif
705 DWORD dwProvType;
706 BYTE *pbContextInfo;
707 DWORD cbContextInfo;
708 LPSTR pszProvName;
709 } VTableProvStruc, *PVTableProvStruc;
710
711 typedef struct _CERT_PRIVATE_KEY_INFO {
712 DWORD Version;
713 CRYPT_ALGORITHM_IDENTIFIER Algorithm;
714 CRYPT_DER_BLOB PrivateKey;
715 PCRYPT_ATTRIBUTES pAttributes;
716 } CERT_PRIVATE_KEY_INFO, *PCERT_PRIVATE_KEY_INFO;
717
718 typedef struct _CTL_USAGE {
719 DWORD cUsageIdentifier;
720 LPSTR *rgpszUsageIdentifier;
721 } CTL_USAGE, *PCTL_USAGE, CERT_ENHKEY_USAGE, *PCERT_ENHKEY_USAGE;
722
723 typedef struct _CTL_ENTRY {
724 CRYPT_DATA_BLOB SubjectIdentifier;
725 DWORD cAttribute;
726 PCRYPT_ATTRIBUTE rgAttribute;
727 } CTL_ENTRY, *PCTL_ENTRY;
728
729 typedef struct _CTL_INFO {
730 DWORD dwVersion;
731 CTL_USAGE SubjectUsage;
732 CRYPT_DATA_BLOB ListIdentifier;
733 CRYPT_INTEGER_BLOB SequenceNumber;
734 FILETIME ThisUpdate;
735 FILETIME NextUpdate;
736 CRYPT_ALGORITHM_IDENTIFIER SubjectAlgorithm;
737 DWORD cCTLEntry;
738 PCTL_ENTRY rgCTLEntry;
739 DWORD cExtension;
740 PCERT_EXTENSION rgExtension;
741 } CTL_INFO, *PCTL_INFO;
742
743 typedef struct _CTL_CONTEXT {
744 DWORD dwMsgAndCertEncodingType;
745 BYTE *pbCtlEncoded;
746 DWORD cbCtlEncoded;
747 PCTL_INFO pCtlInfo;
748 HCERTSTORE hCertStore;
749 HCRYPTMSG hCryptMsg;
750 BYTE *pbCtlContext;
751 DWORD cbCtlContext;
752 } CTL_CONTEXT, *PCTL_CONTEXT;
753 typedef const CTL_CONTEXT *PCCTL_CONTEXT;
754
755 typedef struct _CRYPT_TIME_STAMP_REQUEST_INFO {
756 LPSTR pszTimeStampAlgorithm;
757 LPSTR pszContentType;
758 CRYPT_OBJID_BLOB Content;
759 DWORD cAttribute;
760 PCRYPT_ATTRIBUTE rgAttribute;
761 } CRYPT_TIME_STAMP_REQUEST_INFO, *PCRYPT_TIME_STAMP_REQUEST_INFO;
762
763 typedef struct _CRYPT_ENROLLMENT_NAME_VALUE_PAIR {
764 LPWSTR pwszName;
765 LPWSTR pwszValue;
766 } CRYPT_ENROLLMENT_NAME_VALUE_PAIR, *PCRYPT_ENROLLMENT_NAME_VALUE_PAIR;
767
768 typedef struct _CMSG_SIGNER_INFO {
769 DWORD dwVersion;
770 CERT_NAME_BLOB Issuer;
771 CRYPT_INTEGER_BLOB SerialNumber;
772 CRYPT_ALGORITHM_IDENTIFIER HashAlgorithm;
773 CRYPT_ALGORITHM_IDENTIFIER HashEncryptionAlgorithm;
774 CRYPT_DATA_BLOB EncryptedHash;
775 CRYPT_ATTRIBUTES AuthAttrs;
776 CRYPT_ATTRIBUTES UnauthAttrs;
777 } CMSG_SIGNER_INFO, *PCMSG_SIGNER_INFO;
778
779 #define CMSG_VERIFY_SIGNER_PUBKEY 1
780 #define CMSG_VERIFY_SIGNER_CERT 2
781 #define CMSG_VERIFY_SIGNER_CHAIN 3
782 #define CMSG_VERIFY_SIGNER_NULL 4
783
784 typedef struct _CERT_REVOCATION_CRL_INFO {
785 DWORD cbSize;
786 PCCRL_CONTEXT pBaseCrlContext;
787 PCCRL_CONTEXT pDeltaCrlContext;
788 PCRL_ENTRY pCrlEntry;
789 BOOL fDeltaCrlEntry;
790 } CERT_REVOCATION_CRL_INFO, *PCERT_REVOCATION_CRL_INFO;
791
792 typedef struct _CERT_REVOCATION_INFO {
793 DWORD cbSize;
794 DWORD dwRevocationResult;
795 LPCSTR pszRevocationOid;
796 LPVOID pvOidSpecificInfo;
797 BOOL fHasFreshnessTime;
798 DWORD dwFreshnessTime;
799 PCERT_REVOCATION_CRL_INFO pCrlInfo;
800 } CERT_REVOCATION_INFO, *PCERT_REVOCATION_INFO;
801
802 typedef struct _CERT_REVOCATION_PARA {
803 DWORD cbSize;
804 PCCERT_CONTEXT pIssuerCert;
805 DWORD cCertStore;
806 HCERTSTORE *rgCertStore;
807 HCERTSTORE hCrlStore;
808 LPFILETIME pftTimeToUse;
809 #ifdef CERT_REVOCATION_PARA_HAS_EXTRA_FIELDS
810 DWORD dwUrlRetrievalTimeout;
811 BOOL fCheckFreshnessTime;
812 DWORD dwFreshnessTime;
813 LPFILETIME pftCurrentTime;
814 PCERT_REVOCATION_CRL_INFO pCrlInfo;
815 #endif
816 } CERT_REVOCATION_PARA, *PCERT_REVOCATION_PARA;
817
818 #define CERT_CONTEXT_REVOCATION_TYPE 1
819 #define CERT_VERIFY_REV_CHAIN_FLAG 0x00000001
820 #define CERT_VERIFY_CACHE_ONLY_BASED_REVOCATION 0x00000002
821 #define CERT_VERIFY_REV_ACCUMULATIVE_TIMEOUT_FLAG 0x00000004
822
823 typedef struct _CTL_VERIFY_USAGE_PARA {
824 DWORD cbSize;
825 CRYPT_DATA_BLOB ListIdentifier;
826 DWORD cCtlStore;
827 HCERTSTORE *rghCtlStore;
828 DWORD cSignerStore;
829 HCERTSTORE *rghSignerStore;
830 } CTL_VERIFY_USAGE_PARA, *PCTL_VERIFY_USAGE_PARA;
831
832 typedef struct _CTL_VERIFY_USAGE_STATUS {
833 DWORD cbSize;
834 DWORD dwError;
835 DWORD dwFlags;
836 PCCTL_CONTEXT *ppCtl;
837 DWORD dwCtlEntryIndex;
838 PCCERT_CONTEXT *ppSigner;
839 DWORD dwSignerIndex;
840 } CTL_VERIFY_USAGE_STATUS, *PCTL_VERIFY_USAGE_STATUS;
841
842 #define CERT_VERIFY_INHIBIT_CTL_UPDATE_FLAG 0x1
843 #define CERT_VERIFY_TRUSTED_SIGNERS_FLAG 0x2
844 #define CERT_VERIFY_NO_TIME_CHECK_FLAG 0x4
845 #define CERT_VERIFY_ALLOW_MORE_USAGE_FLAG 0x8
846 #define CERT_VERIFY_UPDATED_CTL_FLAG 0x1
847
848 typedef struct _CERT_CHAIN {
849 DWORD cCerts;
850 PCERT_BLOB certs;
851 CRYPT_KEY_PROV_INFO keyLocatorInfo;
852 } CERT_CHAIN, *PCERT_CHAIN;
853
854 typedef struct _CERT_REVOCATION_STATUS {
855 DWORD cbSize;
856 DWORD dwIndex;
857 DWORD dwError;
858 DWORD dwReason;
859 BOOL fHasFreshnessTime;
860 DWORD dwFreshnessTime;
861 } CERT_REVOCATION_STATUS, *PCERT_REVOCATION_STATUS;
862
863 typedef struct _CERT_TRUST_LIST_INFO {
864 DWORD cbSize;
865 PCTL_ENTRY pCtlEntry;
866 PCCTL_CONTEXT pCtlContext;
867 } CERT_TRUST_LIST_INFO, *PCERT_TRUST_LIST_INFO;
868
869 #define CERT_TRUST_NO_ERROR 0x00000000
870 #define CERT_TRUST_IS_NOT_TIME_VALID 0x00000001
871 #define CERT_TRUST_IS_NOT_TIME_NESTED 0x00000002
872 #define CERT_TRUST_IS_REVOKED 0x00000004
873 #define CERT_TRUST_IS_NOT_SIGNATURE_VALID 0x00000008
874 #define CERT_TRUST_IS_NOT_VALID_FOR_USAGE 0x00000010
875 #define CERT_TRUST_IS_UNTRUSTED_ROOT 0x00000020
876 #define CERT_TRUST_REVOCATION_STATUS_UNKNOWN 0x00000040
877 #define CERT_TRUST_IS_CYCLIC 0x00000080
878 #define CERT_TRUST_INVALID_EXTENSION 0x00000100
879 #define CERT_TRUST_INVALID_POLICY_CONSTRAINTS 0x00000200
880 #define CERT_TRUST_INVALID_BASIC_CONSTRAINTS 0x00000400
881 #define CERT_TRUST_INVALID_NAME_CONSTRAINTS 0x00000800
882 #define CERT_TRUST_HAS_NOT_SUPPORTED_NAME_CONSTRAINT 0x00001000
883 #define CERT_TRUST_HAS_NOT_DEFINED_NAME_CONSTRAINT 0x00002000
884 #define CERT_TRUST_HAS_NOT_PERMITTED_NAME_CONSTRAINT 0x00004000
885 #define CERT_TRUST_HAS_EXCLUDED_NAME_CONSTRAINT 0x00008000
886 #define CERT_TRUST_IS_OFFLINE_REVOCATION 0x01000000
887 #define CERT_TRUST_NO_ISSUANCE_CHAIN_POLICY 0x02000000
888 #define CERT_TRUST_IS_EXPLICIT_DISTRUST 0x04000000
889 #define CERT_TRUST_HAS_NOT_SUPPORTED_CRITICAL_EXT 0x08000000
890
891 #define CERT_TRUST_IS_PARTIAL_CHAIN 0x00010000
892 #define CERT_TRUST_CTL_IS_NOT_TIME_VALID 0x00020000
893 #define CERT_TRUST_CTL_IS_NOT_SIGNATURE_VALID 0x00040000
894 #define CERT_TRUST_CTL_IS_NOT_VALID_FOR_USAGE 0x00080000
895
896 #define CERT_TRUST_HAS_EXACT_MATCH_ISSUER 0x00000001
897 #define CERT_TRUST_HAS_KEY_MATCH_ISSUER 0x00000002
898 #define CERT_TRUST_HAS_NAME_MATCH_ISSUER 0x00000004
899 #define CERT_TRUST_IS_SELF_SIGNED 0x00000008
900
901 #define CERT_TRUST_HAS_PREFERRED_ISSUER 0x00000100
902 #define CERT_TRUST_HAS_ISSUANCE_CHAIN_POLICY 0x00000200
903 #define CERT_TRUST_HAS_VALID_NAME_CONSTRAINTS 0x00000400
904 #define CERT_TRUST_IS_PEER_TRUSTED 0x00000800
905 #define CERT_TRUST_HAS_CRL_VALIDITY_EXTENDED 0x00001000
906
907 #define CERT_TRUST_IS_COMPLEX_CHAIN 0x00010000
908
909 typedef struct _CERT_TRUST_STATUS {
910 DWORD dwErrorStatus;
911 DWORD dwInfoStatus;
912 } CERT_TRUST_STATUS, *PCERT_TRUST_STATUS;
913
914 typedef struct _CERT_CHAIN_ELEMENT {
915 DWORD cbSize;
916 PCCERT_CONTEXT pCertContext;
917 CERT_TRUST_STATUS TrustStatus;
918 PCERT_REVOCATION_INFO pRevocationInfo;
919 PCERT_ENHKEY_USAGE pIssuanceUsage;
920 PCERT_ENHKEY_USAGE pApplicationUsage;
921 LPCWSTR pwszExtendedErrorInfo;
922 } CERT_CHAIN_ELEMENT, *PCERT_CHAIN_ELEMENT;
923
924 typedef struct _CERT_SIMPLE_CHAIN {
925 DWORD cbSize;
926 CERT_TRUST_STATUS TrustStatus;
927 DWORD cElement;
928 PCERT_CHAIN_ELEMENT *rgpElement;
929 PCERT_TRUST_LIST_INFO pTrustListInfo;
930 BOOL fHasRevocationFreshnessTime;
931 DWORD dwRevocationFreshnessTime;
932 } CERT_SIMPLE_CHAIN, *PCERT_SIMPLE_CHAIN;
933
934 typedef struct _CERT_CHAIN_CONTEXT CERT_CHAIN_CONTEXT, *PCERT_CHAIN_CONTEXT;
935 typedef const CERT_CHAIN_CONTEXT *PCCERT_CHAIN_CONTEXT;
936
937 struct _CERT_CHAIN_CONTEXT {
938 DWORD cbSize;
939 CERT_TRUST_STATUS TrustStatus;
940 DWORD cChain;
941 PCERT_SIMPLE_CHAIN *rgpChain;
942 DWORD cLowerQualityChainContext;
943 PCCERT_CHAIN_CONTEXT *rgpLowerQualityChainContext;
944 BOOL fHasRevocationFreshnessTime;
945 DWORD dwRevocationFreshnessTime;
946 };
947
948 typedef struct _CERT_CHAIN_POLICY_PARA {
949 DWORD cbSize;
950 DWORD dwFlags;
951 void *pvExtraPolicyPara;
952 } CERT_CHAIN_POLICY_PARA, *PCERT_CHAIN_POLICY_PARA;
953
954 typedef struct _CERT_CHAIN_POLICY_STATUS {
955 DWORD cbSize;
956 DWORD dwError;
957 LONG lChainIndex;
958 LONG lElementIndex;
959 void *pvExtraPolicyStatus;
960 } CERT_CHAIN_POLICY_STATUS, *PCERT_CHAIN_POLICY_STATUS;
961
962 #define CERT_CHAIN_POLICY_BASE ((LPCSTR)1)
963 #define CERT_CHAIN_POLICY_AUTHENTICODE ((LPCSTR)2)
964 #define CERT_CHAIN_POLICY_AUTHENTICODE_TS ((LPCSTR)3)
965 #define CERT_CHAIN_POLICY_SSL ((LPCSTR)4)
966 #define CERT_CHAIN_POLICY_BASIC_CONSTRAINTS ((LPCSTR)5)
967 #define CERT_CHAIN_POLICY_NT_AUTH ((LPCSTR)6)
968 #define CERT_CHAIN_POLICY_MICROSOFT_ROOT ((LPCSTR)7)
969
970 #define CERT_CHAIN_POLICY_IGNORE_NOT_TIME_VALID_FLAG 0x00000001
971 #define CERT_CHAIN_POLICY_IGNORE_CTL_NOT_TIME_VALID_FLAG 0x00000002
972 #define CERT_CHAIN_POLICY_IGNORE_NOT_TIME_NESTED_FLAG 0x00000004
973 #define CERT_CHAIN_POLICY_IGNORE_INVALID_BASIC_CONSTRAINTS_FLAG 0x00000008
974
975 #define CERT_CHAIN_POLICY_IGNORE_ALL_NOT_TIME_VALID_FLAGS ( \
976 CERT_CHAIN_POLICY_IGNORE_NOT_TIME_VALID_FLAG \
977 CERT_CHAIN_POLICY_IGNORE_CTL_NOT_TIME_VALID_FLAG \
978 CERT_CHAIN_POLICY_IGNORE_NOT_TIME_NESTED_FLAG )
979
980 #define CERT_CHAIN_POLICY_ALLOW_UNKNOWN_CA_FLAG 0x00000010
981 #define CERT_CHAIN_POLICY_IGNORE_WRONG_USAGE_FLAG 0x00000020
982 #define CERT_CHAIN_POLICY_IGNORE_INVALID_NAME_FLAG 0x00000040
983 #define CERT_CHAIN_POLICY_IGNORE_INVALID_POLICY_FLAG 0x00000080
984
985 #define CERT_CHAIN_POLICY_IGNORE_END_REV_UNKNOWN_FLAG 0x00000100
986 #define CERT_CHAIN_POLICY_IGNORE_CTL_SIGNER_REV_UNKNOWN_FLAG 0x00000200
987 #define CERT_CHAIN_POLICY_IGNORE_CA_REV_UNKNOWN_FLAG 0x00000400
988 #define CERT_CHAIN_POLICY_IGNORE_ROOT_REV_UNKNOWN_FLAG 0x00000800
989
990 #define CERT_CHAIN_POLICY_IGNORE_ALL_REV_UNKNOWN_FLAGS ( \
991 CERT_CHAIN_POLICY_IGNORE_END_REV_UNKNOWN_FLAG \
992 CERT_CHAIN_POLICY_IGNORE_CTL_SIGNER_REV_UNKNOWN_FLAG \
993 CERT_CHAIN_POLICY_IGNORE_CA_REV_UNKNOWN_FLAG \
994 CERT_CHAIN_POLICY_IGNORE_ROOT_REV_UNKNOWN_FLAG )
995
996 #define CERT_CHAIN_POLICY_IGNORE_PEER_TRUST_FLAG 0x00001000
997 #define CERT_CHAIN_POLICY_IGNORE_NOT_SUPPORTED_CRITICAL_EXT_FLAG 0x00002000
998 #define CERT_CHAIN_POLICY_TRUST_TESTROOT_FLAG 0x00004000
999 #define CERT_CHAIN_POLICY_ALLOW_TESTROOT_FLAG 0x00008000
1000 #define MICROSOFT_ROOT_CERT_CHAIN_POLICY_ENABLE_TEST_ROOT_FLAG 0x00010000
1001
1002 typedef struct _AUTHENTICODE_EXTRA_CERT_CHAIN_POLICY_PARA {
1003 DWORD cbSize;
1004 DWORD dwRegPolicySettings;
1005 PCMSG_SIGNER_INFO pSignerInfo;
1006 } AUTHENTICODE_EXTRA_CERT_CHAIN_POLICY_PARA,
1007 *PAUTHENTICODE_EXTRA_CERT_CHAIN_POLICY_PARA;
1008
1009 typedef struct _AUTHENTICODE_EXTRA_CERT_CHAIN_POLICY_STATUS {
1010 DWORD cbSize;
1011 BOOL fCommercial;
1012 } AUTHENTICODE_EXTRA_CERT_CHAIN_POLICY_STATUS,
1013 *PAUTHENTICODE_EXTRA_CERT_CHAIN_POLICY_STATUS;
1014
1015 typedef struct _AUTHENTICODE_TS_EXTRA_CERT_CHAIN_POLICY_PARA {
1016 DWORD cbSize;
1017 DWORD dwRegPolicySettings;
1018 BOOL fCommercial;
1019 } AUTHENTICODE_TS_EXTRA_CERT_CHAIN_POLICY_PARA,
1020 *PAUTHENTICODE_TS_EXTRA_CERT_CHAIN_POLICY_PARA;
1021
1022 typedef struct _HTTPSPolicyCallbackData {
1023 union {
1024 DWORD cbStruct;
1025 DWORD cbSize;
1026 } DUMMYUNIONNAME;
1027 DWORD dwAuthType;
1028 DWORD fdwChecks;
1029 WCHAR *pwszServerName;
1030 } HTTPSPolicyCallbackData, *PHTTPSPolicyCallbackData,
1031 SSL_EXTRA_CERT_CHAIN_POLICY_PARA, *PSSL_EXTRA_CERT_CHAIN_POLICY_PARA;
1032
1033 /* Values for HTTPSPolicyCallbackData's dwAuthType */
1034 #define AUTHTYPE_CLIENT 1
1035 #define AUTHTYPE_SERVER 2
1036 /* Values for HTTPSPolicyCallbackData's fdwChecks are defined in wininet.h */
1037
1038 #define BASIC_CONSTRAINTS_CERT_CHAIN_POLICY_CA_FLAG 0x80000000
1039 #define BASIC_CONSTRAINTS_CERT_CHAIN_POLICY_END_ENTITY_FLAG 0x40000000
1040
1041 #define MICROSOFT_ROOT_CERT_CHAIN_POLICY_ENABLE_TEST_ROOT_FLAG 0x00010000
1042
1043 #define USAGE_MATCH_TYPE_AND 0x00000000
1044 #define USAGE_MATCH_TYPE_OR 0x00000001
1045
1046 typedef struct _CERT_USAGE_MATCH {
1047 DWORD dwType;
1048 CERT_ENHKEY_USAGE Usage;
1049 } CERT_USAGE_MATCH, *PCERT_USAGE_MATCH;
1050
1051 typedef struct _CTL_USAGE_MATCH {
1052 DWORD dwType;
1053 CTL_USAGE Usage;
1054 } CTL_USAGE_MATCH, *PCTL_USAGE_MATCH;
1055
1056 #define CERT_CHAIN_REVOCATION_CHECK_END_CERT 0x10000000
1057 #define CERT_CHAIN_REVOCATION_CHECK_CHAIN 0x20000000
1058 #define CERT_CHAIN_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT 0x40000000
1059 #define CERT_CHAIN_REVOCATION_CHECK_CACHE_ONLY 0x80000000
1060
1061 #define CERT_CHAIN_REVOCATION_ACCUMULATIVE_TIMEOUT 0x08000000
1062
1063 #define CERT_CHAIN_DISABLE_PASS1_QUALITY_FILTERING 0x00000040
1064 #define CERT_CHAIN_RETURN_LOWER_QUALITY_CONTEXTS 0x00000080
1065 #define CERT_CHAIN_DISABLE_AUTH_ROOT_AUTO_UPDATE 0x00000100
1066 #define CERT_CHAIN_TIMESTAMP_TIME 0x00000200
1067
1068 typedef struct _CERT_CHAIN_PARA {
1069 DWORD cbSize;
1070 CERT_USAGE_MATCH RequestedUsage;
1071 #ifdef CERT_CHAIN_PARA_HAS_EXTRA_FIELDS
1072 CERT_USAGE_MATCH RequestedIssuancePolicy;
1073 DWORD dwUrlRetrievalTimeout;
1074 BOOL fCheckRevocationFreshnessTime;
1075 DWORD dwRevocationFreshnessTime;
1076 LPFILETIME pftCacheResync;
1077 #endif
1078 } CERT_CHAIN_PARA, *PCERT_CHAIN_PARA;
1079
1080 typedef struct _CERT_SYSTEM_STORE_INFO {
1081 DWORD cbSize;
1082 } CERT_SYSTEM_STORE_INFO, *PCERT_SYSTEM_STORE_INFO;
1083
1084 typedef struct _CERT_PHYSICAL_STORE_INFO {
1085 DWORD cbSize;
1086 LPSTR pszOpenStoreProvider;
1087 DWORD dwOpenEncodingType;
1088 DWORD dwOpenFlags;
1089 CRYPT_DATA_BLOB OpenParameters;
1090 DWORD dwFlags;
1091 DWORD dwPriority;
1092 } CERT_PHYSICAL_STORE_INFO, *PCERT_PHYSICAL_STORE_INFO;
1093
1094 typedef struct _CERT_SYSTEM_STORE_RELOCATE_PARA {
1095 union {
1096 HKEY hKeyBase;
1097 VOID *pvBase;
1098 } DUMMYUNIONNAME;
1099 union {
1100 void *pvSystemStore;
1101 LPCSTR pszSystemStore;
1102 LPCWSTR pwszSystemStore;
1103 } DUMMYUNIONNAME2;
1104 } CERT_SYSTEM_STORE_RELOCATE_PARA, *PCERT_SYSTEM_STORE_RELOCATE_PARA;
1105
1106 typedef BOOL
1107 (WINAPI *PFN_CERT_ENUM_SYSTEM_STORE_LOCATION)(
1108 _In_ LPCWSTR pwszStoreLocation,
1109 _In_ DWORD dwFlags,
1110 _Reserved_ void *pvReserved,
1111 _Inout_opt_ void *pvArg);
1112
1113 typedef BOOL
1114 (WINAPI *PFN_CERT_ENUM_SYSTEM_STORE)(
1115 _In_ const void *pvSystemStore,
1116 _In_ DWORD dwFlags,
1117 _In_ PCERT_SYSTEM_STORE_INFO pStoreInfo,
1118 _Reserved_ void *pvReserved,
1119 _Inout_opt_ void *pvArg);
1120
1121 typedef BOOL
1122 (WINAPI *PFN_CERT_ENUM_PHYSICAL_STORE)(
1123 _In_ const void *pvSystemStore,
1124 _In_ DWORD dwFlags,
1125 _In_ LPCWSTR pwszStoreName,
1126 _In_ PCERT_PHYSICAL_STORE_INFO pStoreInfo,
1127 _Reserved_ void *pvReserved,
1128 _Inout_opt_ void *pvArg);
1129
1130 /* Encode/decode object */
1131 typedef LPVOID (__WINE_ALLOC_SIZE(1) WINAPI *PFN_CRYPT_ALLOC)(_In_ size_t cbsize);
1132 typedef VOID(WINAPI *PFN_CRYPT_FREE)(_In_ LPVOID pv);
1133
1134 typedef struct _CRYPT_ENCODE_PARA {
1135 DWORD cbSize;
1136 PFN_CRYPT_ALLOC pfnAlloc;
1137 PFN_CRYPT_FREE pfnFree;
1138 } CRYPT_ENCODE_PARA, *PCRYPT_ENCODE_PARA;
1139
1140 typedef struct _CRYPT_DECODE_PARA {
1141 DWORD cbSize;
1142 PFN_CRYPT_ALLOC pfnAlloc;
1143 PFN_CRYPT_FREE pfnFree;
1144 } CRYPT_DECODE_PARA, *PCRYPT_DECODE_PARA;
1145
1146 typedef struct _CERT_STORE_PROV_INFO {
1147 DWORD cbSize;
1148 DWORD cStoreProvFunc;
1149 void **rgpvStoreProvFunc;
1150 HCERTSTOREPROV hStoreProv;
1151 DWORD dwStoreProvFlags;
1152 HCRYPTOIDFUNCADDR hStoreProvFuncAddr2;
1153 } CERT_STORE_PROV_INFO, *PCERT_STORE_PROV_INFO;
1154
1155 typedef BOOL
1156 (WINAPI *PFN_CERT_DLL_OPEN_STORE_PROV_FUNC)(
1157 _In_ LPCSTR lpszStoreProvider,
1158 _In_ DWORD dwEncodingType,
1159 _In_opt_ HCRYPTPROV_LEGACY hCryptProv,
1160 _In_ DWORD dwFlags,
1161 _In_opt_ const void *pvPara,
1162 _In_ HCERTSTORE hCertStore,
1163 _Inout_ PCERT_STORE_PROV_INFO pStoreProvInfo);
1164
1165 typedef void
1166 (WINAPI *PFN_CERT_STORE_PROV_CLOSE)(
1167 _Inout_opt_ HCERTSTOREPROV hStoreProv,
1168 _In_ DWORD dwFlags);
1169
1170 typedef
1171 _Success_(return != 0)
1172 BOOL
1173 (WINAPI *PFN_CERT_STORE_PROV_READ_CERT)(
1174 _Inout_ HCERTSTOREPROV hStoreProv,
1175 _In_ PCCERT_CONTEXT pStoreCertContext,
1176 _In_ DWORD dwFlags,
1177 _Outptr_ PCCERT_CONTEXT *ppProvCertContext);
1178
1179 typedef BOOL
1180 (WINAPI *PFN_CERT_STORE_PROV_WRITE_CERT)(
1181 _Inout_ HCERTSTOREPROV hStoreProv,
1182 _In_ PCCERT_CONTEXT pCertContext,
1183 _In_ DWORD dwFlags);
1184
1185 typedef BOOL
1186 (WINAPI *PFN_CERT_STORE_PROV_DELETE_CERT)(
1187 _Inout_ HCERTSTOREPROV hStoreProv,
1188 _In_ PCCERT_CONTEXT pCertContext,
1189 _In_ DWORD dwFlags);
1190
1191 typedef BOOL
1192 (WINAPI *PFN_CERT_STORE_PROV_SET_CERT_PROPERTY)(
1193 _Inout_ HCERTSTOREPROV hStoreProv,
1194 _In_ PCCERT_CONTEXT pCertContext,
1195 _In_ DWORD dwPropId,
1196 _In_ DWORD dwFlags,
1197 _In_opt_ const void *pvData);
1198
1199 typedef
1200 _Success_(return != 0)
1201 BOOL
1202 (WINAPI *PFN_CERT_STORE_PROV_READ_CRL)(
1203 _Inout_ HCERTSTOREPROV hStoreProv,
1204 _In_ PCCRL_CONTEXT pStoreCrlContext,
1205 _In_ DWORD dwFlags,
1206 _Outptr_ PCCRL_CONTEXT *ppProvCrlContext);
1207
1208 typedef BOOL
1209 (WINAPI *PFN_CERT_STORE_PROV_WRITE_CRL)(
1210 _Inout_ HCERTSTOREPROV hStoreProv,
1211 _In_ PCCRL_CONTEXT pCrlContext,
1212 _In_ DWORD dwFlags);
1213
1214 typedef BOOL
1215 (WINAPI *PFN_CERT_STORE_PROV_DELETE_CRL)(
1216 _Inout_ HCERTSTOREPROV hStoreProv,
1217 _In_ PCCRL_CONTEXT pCrlContext,
1218 _In_ DWORD dwFlags);
1219
1220 typedef BOOL
1221 (WINAPI *PFN_CERT_STORE_PROV_SET_CRL_PROPERTY)(
1222 _Inout_ HCERTSTOREPROV hStoreProv,
1223 _In_ PCCRL_CONTEXT pCrlContext,
1224 _In_ DWORD dwPropId,
1225 _In_ DWORD dwFlags,
1226 _In_opt_ const void *pvData);
1227
1228 typedef
1229 _Success_(return != 0)
1230 BOOL
1231 (WINAPI *PFN_CERT_STORE_PROV_READ_CTL)(
1232 _Inout_ HCERTSTOREPROV hStoreProv,
1233 _In_ PCCTL_CONTEXT pStoreCtlContext,
1234 _In_ DWORD dwFlags,
1235 _Outptr_ PCCTL_CONTEXT *ppProvCtlContext);
1236
1237 typedef BOOL
1238 (WINAPI *PFN_CERT_STORE_PROV_WRITE_CTL)(
1239 _Inout_ HCERTSTOREPROV hStoreProv,
1240 _In_ PCCTL_CONTEXT pCtlContext,
1241 _In_ DWORD dwFlags);
1242
1243 typedef BOOL
1244 (WINAPI *PFN_CERT_STORE_PROV_DELETE_CTL)(
1245 _Inout_ HCERTSTOREPROV hStoreProv,
1246 _In_ PCCTL_CONTEXT pCtlContext,
1247 _In_ DWORD dwFlags);
1248
1249 typedef BOOL
1250 (WINAPI *PFN_CERT_STORE_PROV_SET_CTL_PROPERTY)(
1251 _Inout_ HCERTSTOREPROV hStoreProv,
1252 _In_ PCCTL_CONTEXT pCtlContext,
1253 _In_ DWORD dwPropId,
1254 _In_ DWORD dwFlags,
1255 _In_opt_ const void *pvData);
1256
1257 typedef BOOL
1258 (WINAPI *PFN_CERT_STORE_PROV_CONTROL)(
1259 _Inout_ HCERTSTOREPROV hStoreProv,
1260 _In_ DWORD dwFlags,
1261 _In_ DWORD dwCtrlType,
1262 _In_opt_ void const *pvCtrlPara);
1263
1264 typedef struct _CERT_STORE_PROV_FIND_INFO {
1265 DWORD cbSize;
1266 DWORD dwMsgAndCertEncodingType;
1267 DWORD dwFindFlags;
1268 DWORD dwFindType;
1269 const void *pvFindPara;
1270 } CERT_STORE_PROV_FIND_INFO, *PCERT_STORE_PROV_FIND_INFO;
1271 typedef const CERT_STORE_PROV_FIND_INFO CCERT_STORE_PROV_FIND_INFO,
1272 *PCCERT_STORE_PROV_FIND_INFO;
1273
1274 typedef
1275 _Success_(return != 0)
1276 BOOL
1277 (WINAPI *PFN_CERT_STORE_PROV_FIND_CERT)(
1278 _Inout_ HCERTSTOREPROV hStoreProv,
1279 _In_ PCCERT_STORE_PROV_FIND_INFO pFindInfo,
1280 _In_ PCCERT_CONTEXT pPrevCertContext,
1281 _In_ DWORD dwFlags,
1282 _Inout_ void **ppvStoreProvFindInfo,
1283 _Outptr_ PCCERT_CONTEXT *ppProvCertContext);
1284
1285 typedef BOOL
1286 (WINAPI *PFN_CERT_STORE_PROV_FREE_FIND_CERT)(
1287 _Inout_ HCERTSTOREPROV hStoreProv,
1288 _In_ PCCERT_CONTEXT pCertContext,
1289 _In_ void *pvStoreProvFindInfo,
1290 _In_ DWORD dwFlags);
1291
1292 typedef BOOL
1293 (WINAPI *PFN_CERT_STORE_PROV_GET_CERT_PROPERTY)(
1294 _Inout_ HCERTSTOREPROV hStoreProv,
1295 _In_ PCCERT_CONTEXT pCertContext,
1296 _In_ DWORD dwPropId,
1297 _In_ DWORD dwFlags,
1298 _Out_writes_bytes_to_opt_(*pcbData, *pcbData) void *pvData,
1299 _Inout_ DWORD *pcbData);
1300
1301 typedef
1302 _Success_(return != 0)
1303 BOOL
1304 (WINAPI *PFN_CERT_STORE_PROV_FIND_CRL)(
1305 _Inout_ HCERTSTOREPROV hStoreProv,
1306 _In_ PCCERT_STORE_PROV_FIND_INFO pFindInfo,
1307 _In_ PCCRL_CONTEXT pPrevCrlContext,
1308 _In_ DWORD dwFlags,
1309 _Inout_ void **ppvStoreProvFindInfo,
1310 _Outptr_ PCCRL_CONTEXT *ppProvCrlContext);
1311
1312 typedef BOOL
1313 (WINAPI *PFN_CERT_STORE_PROV_FREE_FIND_CRL)(
1314 _Inout_ HCERTSTOREPROV hStoreProv,
1315 _In_ PCCRL_CONTEXT pCrlContext,
1316 _In_ void *pvStoreProvFindInfo,
1317 _In_ DWORD dwFlags);
1318
1319 typedef BOOL
1320 (WINAPI *PFN_CERT_STORE_PROV_GET_CRL_PROPERTY)(
1321 _Inout_ HCERTSTOREPROV hStoreProv,
1322 _In_ PCCRL_CONTEXT pCrlContext,
1323 _In_ DWORD dwPropId,
1324 _In_ DWORD dwFlags,
1325 _Out_writes_bytes_to_opt_(*pcbData, *pcbData) void *pvData,
1326 _Inout_ DWORD *pcbData);
1327
1328 typedef
1329 _Success_(return != 0)
1330 BOOL
1331 (WINAPI *PFN_CERT_STORE_PROV_FIND_CTL)(
1332 _In_ HCERTSTOREPROV hStoreProv,
1333 _In_ PCCERT_STORE_PROV_FIND_INFO pFindInfo,
1334 _In_ PCCTL_CONTEXT pPrevCtlContext,
1335 _In_ DWORD dwFlags,
1336 _Inout_ void **ppvStoreProvFindInfo,
1337 _Outptr_ PCCTL_CONTEXT *ppProvCtlContext);
1338
1339 typedef BOOL
1340 (WINAPI *PFN_CERT_STORE_PROV_GET_CTL_PROPERTY)(
1341 _Inout_ HCERTSTOREPROV hStoreProv,
1342 _In_ PCCTL_CONTEXT pCtlContext,
1343 _In_ DWORD dwPropId,
1344 _In_ DWORD dwFlags,
1345 _Out_writes_bytes_to_opt_(*pcbData, *pcbData) void *pvData,
1346 _Inout_ DWORD *pcbData);
1347
1348 typedef struct _CERT_CREATE_CONTEXT_PARA {
1349 DWORD cbSize;
1350 PFN_CRYPT_FREE pfnFree;
1351 void *pvFree;
1352 } CERT_CREATE_CONTEXT_PARA, *PCERT_CREATE_CONTEXT_PARA;
1353
1354 typedef struct _CRYPT_OID_FUNC_ENTRY {
1355 LPCSTR pszOID;
1356 void *pvFuncAddr;
1357 } CRYPT_OID_FUNC_ENTRY, *PCRYPT_OID_FUNC_ENTRY;
1358
1359 typedef BOOL
1360 (WINAPI *PFN_CRYPT_ENUM_OID_FUNC)(
1361 _In_ DWORD dwEncodingType,
1362 _In_ LPCSTR pszFuncName,
1363 _In_ LPCSTR pszOID,
1364 _In_ DWORD cValue,
1365 _In_reads_(cValue) const DWORD rgdwValueType[],
1366 _In_reads_(cValue) LPCWSTR const rgpwszValueName[],
1367 _In_reads_(cValue) const BYTE * const rgpbValueData[],
1368 _In_reads_(cValue) const DWORD rgcbValueData[],
1369 _Inout_opt_ void *pvArg);
1370
1371 #define CRYPT_MATCH_ANY_ENCODING_TYPE 0xffffffff
1372
1373 #define CALG_OID_INFO_CNG_ONLY 0xffffffff
1374 #define CALG_OID_INFO_PARAMETERS 0xfffffffe
1375
1376 #define CRYPT_OID_INFO_HASH_PARAMETERS_ALGORITHM (const WCHAR []){'C','r','y','p','t','O','I','D','I','n','f','o','H','a','s','h','P','a','r','a','m','e','t','e','r','s',0}
1377 #define CRYPT_OID_INFO_ECC_PARAMETERS_ALGORITHM (const WCHAR []){'C','r','y','p','t','O','I','D','I','n','f','o','E','C','C','P','a','r','a','m','e','t','e','r','s',0}
1378 #define CRYPT_OID_INFO_MGF1_PARAMETERS_ALGORITHM (const WCHAR []){'C','r','y','p','t','O','I','D','I','n','f','o','M','g','f','1','P','a','r','a','m','e','t','e','r','s',0}
1379 #define CRYPT_OID_INFO_NO_SIGN_ALGORITHM (const WCHAR []){'C','r','y','p','t','O','I','D','I','n','f','o','N','o','S','i','g','n',0}
1380 #define CRYPT_OID_INFO_OAEP_PARAMETERS_ALGORITHM (const WCHAR []){'C','r','y','p','t','O','I','D','I','n','f','o','O','A','E','P','P','a','r','a','m','e','t','e','r','s',0}
1381 #define CRYPT_OID_INFO_ECC_WRAP_PARAMETERS_ALGORITHM (const WCHAR []){'C','r','y','p','t','O','I','D','I','n','f','o','E','C','C','W','r','a','p','P','a','r','a','m','e','t','e','r','s',0}
1382 #define CRYPT_OID_INFO_NO_PARAMETERS_ALGORITHM (const WCHAR []){'C','r','y','p','t','O','I','D','I','n','f','o','N','o','P','a','r','a','m','e','t','e','r','s',0}
1383
1384 typedef struct _CRYPT_OID_INFO {
1385 DWORD cbSize;
1386 LPCSTR pszOID;
1387 LPCWSTR pwszName;
1388 DWORD dwGroupId;
1389 union {
1390 DWORD dwValue;
1391 ALG_ID Algid;
1392 DWORD dwLength;
1393 } DUMMYUNIONNAME;
1394 CRYPT_DATA_BLOB ExtraInfo;
1395 #ifdef CRYPT_OID_INFO_HAS_EXTRA_FIELDS
1396 LPCWSTR pwszCNGAlgid;
1397 LPCWSTR pwszCNGExtraAlgid;
1398 #endif
1399 } CRYPT_OID_INFO, *PCRYPT_OID_INFO;
1400 typedef const CRYPT_OID_INFO CCRYPT_OID_INFO, *PCCRYPT_OID_INFO;
1401
1402 typedef BOOL
1403 (WINAPI *PFN_CRYPT_ENUM_OID_INFO)(
1404 _In_ PCCRYPT_OID_INFO pInfo,
1405 _Inout_opt_ void *pvArg);
1406
1407 typedef struct _CRYPT_SIGN_MESSAGE_PARA {
1408 DWORD cbSize;
1409 DWORD dwMsgEncodingType;
1410 PCCERT_CONTEXT pSigningCert;
1411 CRYPT_ALGORITHM_IDENTIFIER HashAlgorithm;
1412 void * pvHashAuxInfo;
1413 DWORD cMsgCert;
1414 PCCERT_CONTEXT *rgpMsgCert;
1415 DWORD cMsgCrl;
1416 PCCRL_CONTEXT *rgpMsgCrl;
1417 DWORD cAuthAttr;
1418 PCRYPT_ATTRIBUTE rgAuthAttr;
1419 DWORD cUnauthAttr;
1420 PCRYPT_ATTRIBUTE rgUnauthAttr;
1421 DWORD dwFlags;
1422 DWORD dwInnerContentType;
1423 #ifdef CRYPT_SIGN_MESSAGE_PARA_HAS_CMS_FIELDS
1424 CRYPT_ALGORITHM_IDENTIFIER HashEncryptionAlgorithm;
1425 void * pvHashEncryptionAuxInfo;
1426 #endif
1427 } CRYPT_SIGN_MESSAGE_PARA, *PCRYPT_SIGN_MESSAGE_PARA;
1428
1429 #define CRYPT_MESSAGE_BARE_CONTENT_OUT_FLAG 0x00000001
1430 #define CRYPT_MESSAGE_ENCAPSULATED_CONTENT_OUT_FLAG 0x00000002
1431 #define CRYPT_MESSAGE_KEYID_SIGNER_FLAG 0x00000004
1432 #define CRYPT_MESSAGE_SILENT_KEYSET_FLAG 0x00000008
1433
1434 typedef PCCERT_CONTEXT
1435 (WINAPI *PFN_CRYPT_GET_SIGNER_CERTIFICATE)(
1436 _Inout_opt_ void *pvGetArg,
1437 _In_ DWORD dwCertEncodingType,
1438 _In_ PCERT_INFO pSignerId,
1439 _In_ HCERTSTORE hMsgCertStore);
1440
1441 typedef struct _CRYPT_VERIFY_MESSAGE_PARA {
1442 DWORD cbSize;
1443 DWORD dwMsgAndCertEncodingType;
1444 HCRYPTPROV_LEGACY hCryptProv;
1445 PFN_CRYPT_GET_SIGNER_CERTIFICATE pfnGetSignerCertificate;
1446 void * pvGetArg;
1447 } CRYPT_VERIFY_MESSAGE_PARA, *PCRYPT_VERIFY_MESSAGE_PARA;
1448
1449 typedef struct _CRYPT_ENCRYPT_MESSAGE_PARA {
1450 DWORD cbSize;
1451 DWORD dwMsgEncodingType;
1452 HCRYPTPROV_LEGACY hCryptProv;
1453 CRYPT_ALGORITHM_IDENTIFIER ContentEncryptionAlgorithm;
1454 void * pvEncryptionAuxInfo;
1455 DWORD dwFlags;
1456 DWORD dwInnerContentType;
1457 } CRYPT_ENCRYPT_MESSAGE_PARA, *PCRYPT_ENCRYPT_MESSAGE_PARA;
1458
1459 #define CRYPT_MESSAGE_KEYID_RECIPIENT_FLAG 0x00000004
1460
1461 typedef struct _CRYPT_DECRYPT_MESSAGE_PARA {
1462 DWORD cbSize;
1463 DWORD dwMsgAndCertEncodingType;
1464 DWORD cCertStore;
1465 HCERTSTORE *rghCertStore;
1466 #ifdef CRYPT_DECRYPT_MESSAGE_PARA_HAS_EXTRA_FIELDS
1467 DWORD dwFlags;
1468 #endif
1469 } CRYPT_DECRYPT_MESSAGE_PARA, *PCRYPT_DECRYPT_MESSAGE_PARA;
1470
1471 typedef struct _CRYPT_HASH_MESSAGE_PARA {
1472 DWORD cbSize;
1473 DWORD dwMsgEncodingType;
1474 HCRYPTPROV_LEGACY hCryptProv;
1475 CRYPT_ALGORITHM_IDENTIFIER HashAlgorithm;
1476 void * pvHashAuxInfo;
1477 } CRYPT_HASH_MESSAGE_PARA, *PCRYPT_HASH_MESSAGE_PARA;
1478
1479 typedef struct _CRYPT_KEY_SIGN_MESSAGE_PARA {
1480 DWORD cbSize;
1481 DWORD dwMsgAndCertEncodingType;
1482 HCRYPTPROV hCryptProv;
1483 DWORD dwKeySpec;
1484 CRYPT_ALGORITHM_IDENTIFIER HashAlgorithm;
1485 void * pvHashAuxInfo;
1486 } CRYPT_KEY_SIGN_MESSAGE_PARA, *PCRYPT_KEY_SIGN_MESSAGE_PARA;
1487
1488 typedef struct _CRYPT_KEY_VERIFY_MESSAGE_PARA {
1489 DWORD cbSize;
1490 DWORD dwMsgEncodingType;
1491 HCRYPTPROV_LEGACY hCryptProv;
1492 } CRYPT_KEY_VERIFY_MESSAGE_PARA, *PCRYPT_KEY_VERIFY_MESSAGE_PARA;
1493
1494 typedef struct _CRYPT_URL_ARRAY {
1495 DWORD cUrl;
1496 LPWSTR *rgwszUrl;
1497 } CRYPT_URL_ARRAY, *PCRYPT_URL_ARRAY;
1498
1499 typedef struct _CRYPT_URL_INFO {
1500 DWORD cbSize;
1501 DWORD dwSyncDeltaTime;
1502 DWORD cGroup;
1503 DWORD *rgcGroupEntry;
1504 } CRYPT_URL_INFO, *PCRYPT_URL_INFO;
1505
1506 #define URL_OID_CERTIFICATE_ISSUER ((LPCSTR)1)
1507 #define URL_OID_CERTIFICATE_CRL_DIST_POINT ((LPCSTR)2)
1508 #define URL_OID_CTL_ISSUER ((LPCSTR)3)
1509 #define URL_OID_CTL_NEXT_UPDATE ((LPCSTR)4)
1510 #define URL_OID_CRL_ISSUER ((LPCSTR)5)
1511 #define URL_OID_CERTIFICATE_FRESHEST_CRL ((LPCSTR)6)
1512 #define URL_OID_CRL_FRESHEST_CRL ((LPCSTR)7)
1513 #define URL_OID_CROSS_CERT_DIST_POINT ((LPCSTR)8)
1514 #define URL_OID_CERTIFICATE_OCSP ((LPCSTR)9)
1515 #define URL_OID_CERTIFICATE_OCSP_AND_CRL_DIST_POINT ((LPCSTR)10)
1516 #define URL_OID_CERTIFICATE_CRL_DIST_POINT_AND_OCSP ((LPCSTR)11)
1517 #define URL_OID_CROSS_CERT_SUBJECT_INFO_ACCESS ((LPCSTR)12)
1518
1519 #define URL_OID_GET_OBJECT_URL_FUNC "UrlDllGetObjectUrl"
1520
1521 typedef HANDLE HCRYPTASYNC, *PHCRYPTASYNC;
1522
1523 typedef void
1524 (WINAPI *PFN_CRYPT_ASYNC_PARAM_FREE_FUNC)(
1525 _In_ LPSTR pszParamOid,
1526 _In_ LPVOID pvParam);
1527
1528 #define CRYPT_PARAM_ASYNC_RETRIEVAL_COMPLETION ((LPCSTR)1)
1529 #define CRYPT_PARAM_CANCEL_ASYNC_RETRIEVAL ((LPCSTR)2)
1530
1531 typedef void
1532 (WINAPI *PFN_CRYPT_ASYNC_RETRIEVAL_COMPLETION_FUNC)(
1533 _Inout_opt_ void *pvCompletion,
1534 _In_ DWORD dwCompletionCode,
1535 _In_ LPCSTR pszURL,
1536 _In_opt_ LPSTR pszObjectOid,
1537 _In_ void *pvObject);
1538
1539 typedef struct _CRYPT_ASYNC_RETRIEVAL_COMPLETION {
1540 __callback PFN_CRYPT_ASYNC_RETRIEVAL_COMPLETION_FUNC pfnCompletion;
1541 _Inout_opt_ void *pvCompletion;
1542 } CRYPT_ASYNC_RETRIEVAL_COMPLETION, *PCRYPT_ASYNC_RETRIEVAL_COMPLETION;
1543
1544 typedef BOOL
1545 (WINAPI *PFN_CANCEL_ASYNC_RETRIEVAL_FUNC)(
1546 _In_opt_ HCRYPTASYNC hAsyncRetrieve);
1547
1548 typedef struct _CRYPT_BLOB_ARRAY
1549 {
1550 DWORD cBlob;
1551 PCRYPT_DATA_BLOB rgBlob;
1552 } CRYPT_BLOB_ARRAY, *PCRYPT_BLOB_ARRAY;
1553
1554 typedef struct _CRYPT_CREDENTIALS {
1555 DWORD cbSize;
1556 LPCSTR pszCredentialsOid;
1557 LPVOID pvCredentials;
1558 } CRYPT_CREDENTIALS, *PCRYPT_CREDENTIALS;
1559
1560 #define CREDENTIAL_OID_PASSWORD_CREDENTIALS_A ((LPCSTR)1)
1561 #define CREDENTIAL_OID_PASSWORD_CREDENTIALS_W ((LPCSTR)2)
1562 #define CREDENTIAL_OID_PASSWORD_CREDENTIALS \
1563 WINELIB_NAME_AW(CREDENTIAL_OID_PASSWORD_CREDENTIALS_)
1564
1565 typedef struct _CRYPT_PASSWORD_CREDENTIALSA {
1566 DWORD cbSize;
1567 LPSTR pszUsername;
1568 LPSTR pszPassword;
1569 } CRYPT_PASSWORD_CREDENTIALSA, *PCRYPT_PASSWORD_CREDENTIALSA;
1570
1571 typedef struct _CRYPT_PASSWORD_CREDENTIALSW {
1572 DWORD cbSize;
1573 LPWSTR pszUsername;
1574 LPWSTR pszPassword;
1575 } CRYPT_PASSWORD_CREDENTIALSW, *PCRYPT_PASSWORD_CREDENTIALSW;
1576 #define CRYPT_PASSWORD_CREDENTIALS WINELIB_NAME_AW(CRYPT_PASSWORD_CREDENTIALS)
1577 #define PCRYPT_PASSWORD_CREDENTIALS WINELIB_NAME_AW(PCRYPT_PASSWORD_CREDENTIALS)
1578
1579 typedef struct _CRYPT_RETRIEVE_AUX_INFO {
1580 DWORD cbSize;
1581 FILETIME *pLastSyncTime;
1582 DWORD dwMaxUrlRetrievalByteCount;
1583 } CRYPT_RETRIEVE_AUX_INFO, *PCRYPT_RETRIEVE_AUX_INFO;
1584
1585 typedef void
1586 (WINAPI *PFN_FREE_ENCODED_OBJECT_FUNC)(
1587 _In_opt_ LPCSTR pszObjectOid,
1588 _Inout_ PCRYPT_BLOB_ARRAY pObject,
1589 _Inout_opt_ void *pvFreeContext);
1590
1591 #define SCHEME_OID_RETRIEVE_ENCODED_OBJECT_FUNC \
1592 "SchemeDllRetrieveEncodedObject"
1593 #define SCHEME_OID_RETRIEVE_ENCODED_OBJECTW_FUNC \
1594 "SchemeDllRetrieveEncodedObjectW"
1595 /* The signature of SchemeDllRetrieveEncodedObjectW is:
1596 BOOL WINAPI SchemeDllRetrieveEncodedObjectW(LPCWSTR pwszUrl,
1597 LPCSTR pszObjectOid, DWORD dwRetrievalFlags, DWORD dwTimeout,
1598 PCRYPT_BLOB_ARRAY pObject, PFN_FREE_ENCODED_OBJECT_FUNC *ppfnFreeObject,
1599 void **ppvFreeContext, HCRYPTASYNC hAsyncRetrieve,
1600 PCRYPT_CREDENTIALS pCredentials, PCRYPT_RETRIEVE_AUX_INFO pAuxInfo);
1601 */
1602
1603 #define CONTEXT_OID_CREATE_OBJECT_CONTEXT_FUNC "ContextDllCreateObjectContext"
1604 /* The signature of ContextDllCreateObjectContext is:
1605 BOOL WINAPI ContextDllCreateObjectContext(LPCSTR pszObjectOid,
1606 DWORD dwRetrievalFlags, PCRYPT_BLOB_ARRAY pObject, void **ppvContxt);
1607 */
1608
1609 #define CONTEXT_OID_CERTIFICATE ((LPCSTR)1)
1610 #define CONTEXT_OID_CRL ((LPCSTR)2)
1611 #define CONTEXT_OID_CTL ((LPCSTR)3)
1612 #define CONTEXT_OID_PKCS7 ((LPCSTR)4)
1613 #define CONTEXT_OID_CAPI2_ANY ((LPCSTR)5)
1614
1615 #define CRYPT_RETRIEVE_MULTIPLE_OBJECTS 0x00000001
1616 #define CRYPT_CACHE_ONLY_RETRIEVAL 0x00000002
1617 #define CRYPT_WIRE_ONLY_RETRIEVAL 0x00000004
1618 #define CRYPT_DONT_CACHE_RESULT 0x00000008
1619 #define CRYPT_ASYNC_RETRIEVAL 0x00000010
1620 #define CRYPT_STICKY_CACHE_RETRIEVAL 0x00001000
1621 #define CRYPT_LDAP_SCOPE_BASE_ONLY_RETRIEVAL 0x00002000
1622 #define CRYPT_OFFLINE_CHECK_RETRIEVAL 0x00004000
1623 #define CRYPT_LDAP_INSERT_ENTRY_ATTRIBUTE 0x00008000
1624 #define CRYPT_LDAP_SIGN_RETRIEVAL 0x00010000
1625 #define CRYPT_NO_AUTH_RETRIEVAL 0x00020000
1626 #define CRYPT_LDAP_AREC_EXCLUSIVE_RETRIEVAL 0x00040000
1627 #define CRYPT_AIA_RETRIEVAL 0x00080000
1628
1629 #define CRYPT_VERIFY_CONTEXT_SIGNATURE 0x00000020
1630 #define CRYPT_VERIFY_DATA_HASH 0x00000040
1631 #define CRYPT_KEEP_TIME_VALID 0x00000080
1632 #define CRYPT_DONT_VERIFY_SIGNATURE 0x00000100
1633 #define CRYPT_DONT_CHECK_TIME_VALIDITY 0x00000200
1634 #define CRYPT_CHECK_FRESHNESS_TIME_VALIDITY 0x00000400
1635 #define CRYPT_ACCUMULATIVE_TIMEOUT 0x00000800
1636
1637 typedef BOOL
1638 (WINAPI *PFN_CRYPT_CANCEL_RETRIEVAL)(
1639 _In_ DWORD dwFlags,
1640 _Inout_opt_ void *pvArg);
1641
1642 typedef struct _CERT_CRL_CONTEXT_PAIR
1643 {
1644 PCCERT_CONTEXT pCertContext;
1645 PCCRL_CONTEXT pCrlContext;
1646 } CERT_CRL_CONTEXT_PAIR, *PCERT_CRL_CONTEXT_PAIR;
1647 typedef const CERT_CRL_CONTEXT_PAIR *PCCERT_CRL_CONTEXT_PAIR;
1648
1649 #define TIME_VALID_OID_GET_OBJECT_FUNC "TimeValidDllGetObject"
1650
1651 #define TIME_VALID_OID_GET_CTL ((LPCSTR)1)
1652 #define TIME_VALID_OID_GET_CRL ((LPCSTR)2)
1653 #define TIME_VALID_OID_GET_CRL_FROM_CERT ((LPCSTR)3)
1654 #define TIME_VALID_OID_GET_FRESHEST_CRL_FROM_CERT ((LPCSTR)4)
1655 #define TIME_VALID_OID_GET_FRESHEST_CRL_FROM_CRL ((LPCSTR)5)
1656
1657 #define TIME_VALID_OID_FLUSH_OBJECT_FUNC "TimeValidDllFlushObject"
1658
1659 #define TIME_VALID_OID_FLUSH_CTL ((LPCSTR)1)
1660 #define TIME_VALID_OID_FLUSH_CRL ((LPCSTR)2)
1661 #define TIME_VALID_OID_FLUSH_CRL_FROM_CERT ((LPCSTR)3)
1662 #define TIME_VALID_OID_FLUSH_FRESHEST_CRL_FROM_CERT ((LPCSTR)4)
1663 #define TIME_VALID_OID_FLUSH_FRESHEST_CRL_FROM_CRL ((LPCSTR)5)
1664
1665 /* OID group IDs */
1666 #define CRYPT_HASH_ALG_OID_GROUP_ID 1
1667 #define CRYPT_ENCRYPT_ALG_OID_GROUP_ID 2
1668 #define CRYPT_PUBKEY_ALG_OID_GROUP_ID 3
1669 #define CRYPT_SIGN_ALG_OID_GROUP_ID 4
1670 #define CRYPT_RDN_ATTR_OID_GROUP_ID 5
1671 #define CRYPT_EXT_OR_ATTR_OID_GROUP_ID 6
1672 #define CRYPT_ENHKEY_USAGE_OID_GROUP_ID 7
1673 #define CRYPT_POLICY_OID_GROUP_ID 8
1674 #define CRYPT_TEMPLATE_OID_GROUP_ID 9
1675 #define CRYPT_LAST_OID_GROUP_ID 9
1676
1677 #define CRYPT_FIRST_ALG_OID_GROUP_ID CRYPT_HASH_ALG_OID_GROUP_ID
1678 #define CRYPT_LAST_ALG_OID_GROUP_ID CRYPT_SIGN_ALG_OID_GROUP_ID
1679
1680 #define CRYPT_OID_INHIBIT_SIGNATURE_FORMAT_FLAG 0x1
1681 #define CRYPT_OID_USE_PUBKEY_PARA_FOR_PKCS7_FLAG 0x2
1682 #define CRYPT_OID_NO_NULL_ALGORITHM_PARA_FLAG 0x4
1683
1684 #define CRYPT_OID_INFO_OID_KEY 1
1685 #define CRYPT_OID_INFO_NAME_KEY 2
1686 #define CRYPT_OID_INFO_ALGID_KEY 3
1687 #define CRYPT_OID_INFO_SIGN_KEY 4
1688
1689 /* Algorithm IDs */
1690
1691 #define GET_ALG_CLASS(x) (x & (7 << 13))
1692 #define GET_ALG_TYPE(x) (x & (15 << 9))
1693 #define GET_ALG_SID(x) (x & (511))
1694
1695 /* Algorithm Classes */
1696 #define ALG_CLASS_ANY (0)
1697 #define ALG_CLASS_SIGNATURE (1 << 13)
1698 #define ALG_CLASS_MSG_ENCRYPT (2 << 13)
1699 #define ALG_CLASS_DATA_ENCRYPT (3 << 13)
1700 #define ALG_CLASS_HASH (4 << 13)
1701 #define ALG_CLASS_KEY_EXCHANGE (5 << 13)
1702 #define ALG_CLASS_ALL (7 << 13)
1703 /* Algorithm types */
1704 #define ALG_TYPE_ANY (0)
1705 #define ALG_TYPE_DSS (1 << 9)
1706 #define ALG_TYPE_RSA (2 << 9)
1707 #define ALG_TYPE_BLOCK (3 << 9)
1708 #define ALG_TYPE_STREAM (4 << 9)
1709 #define ALG_TYPE_DH (5 << 9)
1710 #define ALG_TYPE_SECURECHANNEL (6 << 9)
1711 #define ALG_TYPE_DH_EPHEM (7 << 9) /* FIXME: find the real TYPE name */
1712
1713 /* SIDs */
1714 #define ALG_SID_ANY (0)
1715 /* RSA SIDs */
1716 #define ALG_SID_RSA_ANY 0
1717 #define ALG_SID_RSA_PKCS 1
1718 #define ALG_SID_RSA_MSATWORK 2
1719 #define ALG_SID_RSA_ENTRUST 3
1720 #define ALG_SID_RSA_PGP 4
1721 /* DSS SIDs */
1722 #define ALG_SID_DSS_ANY 0
1723 #define ALG_SID_DSS_PKCS 1
1724 #define ALG_SID_DSS_DMS 2
1725 #define ALG_SID_ECDSA 3
1726
1727 /* DES SIDs */
1728 #define ALG_SID_DES 1
1729 #define ALG_SID_3DES 3
1730 #define ALG_SID_DESX 4
1731 #define ALG_SID_IDEA 5
1732 #define ALG_SID_CAST 6
1733 #define ALG_SID_SAFERSK64 7
1734 #define ALG_SID_SAFERSK128 8
1735 #define ALG_SID_3DES_112 9
1736 #define ALG_SID_CYLINK_MEK 12
1737 #define ALG_SID_RC5 13
1738 #define ALG_SID_AES_128 14
1739 #define ALG_SID_AES_192 15
1740 #define ALG_SID_AES_256 16
1741 #define ALG_SID_AES 17
1742 /* Fortezza */
1743 #define ALG_SID_SKIPJACK 10
1744 #define ALG_SID_TEK 11
1745 /* Diffie-Hellman SIDs */
1746 #define ALG_SID_DH_SANDF 1
1747 #define ALG_SID_DH_EPHEM 2
1748 #define ALG_SID_AGREED_KEY_ANY 3
1749 #define ALG_SID_KEA 4
1750 #define ALG_SID_ECDH 5
1751 #define ALG_SID_ECDH_EPHEM 6 /* FIXME: find the real SID name */
1752 /* RC2 SIDs */
1753 #define ALG_SID_RC4 1
1754 #define ALG_SID_RC2 2
1755 #define ALG_SID_SEAL 2
1756 /* Hash SIDs */
1757 #define ALG_SID_MD2 1
1758 #define ALG_SID_MD4 2
1759 #define ALG_SID_MD5 3
1760 #define ALG_SID_SHA 4
1761 #define ALG_SID_SHA1 ALG_SID_SHA
1762 #define ALG_SID_MAC 5
1763 #define ALG_SID_RIPEMD 6
1764 #define ALG_SID_RIPEMD160 7
1765 #define ALG_SID_SSL3SHAMD5 8
1766 #define ALG_SID_HMAC 9
1767 #define ALG_SID_TLS1PRF 10
1768 #define ALG_SID_HASH_REPLACE_OWF 11
1769 #define ALG_SID_SHA_256 12
1770 #define ALG_SID_SHA_384 13
1771 #define ALG_SID_SHA_512 14
1772 /* SCHANNEL SIDs */
1773 #define ALG_SID_SSL3_MASTER 1
1774 #define ALG_SID_SCHANNEL_MASTER_HASH 2
1775 #define ALG_SID_SCHANNEL_MAC_KEY 3
1776 #define ALG_SID_PCT1_MASTER 4
1777 #define ALG_SID_SSL2_MASTER 5
1778 #define ALG_SID_TLS1_MASTER 6
1779 #define ALG_SID_SCHANNEL_ENC_KEY 7
1780 #define ALG_SID_EXAMPLE 80
1781
1782 #define ALG_SID_ECMQV 1
1783
1784 /* Algorithm Definitions */
1785 #define CALG_MD2 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MD2)
1786 #define CALG_MD4 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MD4)
1787 #define CALG_MD5 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MD5)
1788 #define CALG_SHA (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA)
1789 #define CALG_SHA1 CALG_SHA
1790 #define CALG_MAC (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MAC)
1791 #define CALG_SSL3_SHAMD5 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SSL3SHAMD5)
1792 #define CALG_HMAC (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_HMAC)
1793 #define CALG_TLS1PRF (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_TLS1PRF)
1794 #define CALG_HASH_REPLACE_OWF (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_HASH_REPLACE_OWF)
1795 #define CALG_SHA_256 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA_256)
1796 #define CALG_SHA_384 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA_384)
1797 #define CALG_SHA_512 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA_512)
1798 #define CALG_RSA_SIGN (ALG_CLASS_SIGNATURE | ALG_TYPE_RSA | ALG_SID_RSA_ANY)
1799 #define CALG_DSS_SIGN (ALG_CLASS_SIGNATURE | ALG_TYPE_DSS | ALG_SID_DSS_ANY)
1800 #define CALG_NO_SIGN (ALG_CLASS_SIGNATURE | ALG_TYPE_ANY | ALG_SID_ANY)
1801 #define CALG_DH_SF (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_DH | ALG_SID_DH_SANDF)
1802 #define CALG_DH_EPHEM (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_DH | ALG_SID_DH_EPHEM)
1803 #define CALG_AGREEDKEY_ANY (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_DH | ALG_SID_AGREED_KEY_ANY)
1804 #define CALG_KEA_KEYX (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_DH | ALG_SID_KEA)
1805 #define CALG_HUGHES_MD5 (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_ANY | ALG_SID_MD5)
1806 #define CALG_RSA_KEYX (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_RSA | ALG_SID_RSA_ANY)
1807 #define CALG_ECDH (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_DH | ALG_SID_ECDH)
1808 #define CALG_ECDH_EPHEM (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_DH_EPHEM | ALG_SID_ECDH_EPHEM) /* FIXME: find the original TYPE and SID names */
1809 #define CALG_ECMQV (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_ANY | ALG_SID_ECMQV)
1810 #define CALG_DES (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_DES)
1811 #define CALG_RC2 (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_RC2)
1812 #define CALG_3DES (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_3DES)
1813 #define CALG_3DES_112 (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_3DES_112)
1814 #define CALG_DESX (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_DESX)
1815 #define CALG_AES_128 (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_AES_128)
1816 #define CALG_AES_192 (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_AES_192)
1817 #define CALG_AES_256 (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_AES_256)
1818 #define CALG_AES (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_AES)
1819 #define CALG_RC4 (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_STREAM | ALG_SID_RC4)
1820 #define CALG_SEAL (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_STREAM | ALG_SID_SEAL)
1821 #define CALG_RC5 (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_STREAM | ALG_SID_RC5)
1822 #define CALG_SKIPJACK (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_SKIPJACK)
1823 #define CALG_TEK (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_TEK)
1824 #define CALG_CYLINK_MEK (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_CYLINK_MEK)
1825 #define CALG_SSL3_MASTER (ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL | ALG_SID_SSL3_MASTER)
1826 #define CALG_SCHANNEL_MASTER_HASH (ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL | ALG_SID_SCHANNEL_MASTER_HASH)
1827 #define CALG_SCHANNEL_MAC_KEY (ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL | ALG_SID_SCHANNEL_MAC_KEY)
1828 #define CALG_SCHANNEL_ENC_KEY (ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL | ALG_SID_SCHANNEL_ENC_KEY)
1829 #define CALG_PCT1_MASTER (ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL | ALG_SID_PCT1_MASTER)
1830 #define CALG_SSL2_MASTER (ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL | ALG_SID_SSL2_MASTER)
1831 #define CALG_TLS1_MASTER (ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL | ALG_SID_TLS1_MASTER)
1832 #define CALG_ECDSA (ALG_CLASS_SIGNATURE | ALG_TYPE_DSS | ALG_SID_ECDSA)
1833 /* Protocol Flags */
1834 #define CRYPT_FLAG_PCT1 0x0001
1835 #define CRYPT_FLAG_SSL2 0x0002
1836 #define CRYPT_FLAG_SSL3 0x0004
1837 #define CRYPT_FLAG_TLS1 0x0008
1838 #define CRYPT_FLAG_IPSEC 0x0010
1839 #define CRYPT_FLAG_SIGNING 0x0020
1840
1841 /* Provider names */
1842 #define MS_DEF_PROV_A "Microsoft Base Cryptographic Provider v1.0"
1843 #if defined(__GNUC__)
1844 # define MS_DEF_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
1845 'B','a','s','e',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ', \
1846 'P','r','o','v','i','d','e','r',' ','v','1','.','0',0 }
1847 #elif defined(_MSC_VER)
1848 # define MS_DEF_PROV_W L"Microsoft Base Cryptographic Provider v1.0"
1849 #else
1850 static const WCHAR MS_DEF_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
1851 'B','a','s','e',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ',
1852 'P','r','o','v','i','d','e','r',' ','v','1','.','0',0 };
1853 #endif
1854 #define MS_DEF_PROV WINELIB_NAME_AW(MS_DEF_PROV_)
1855
1856 #define MS_ENHANCED_PROV_A "Microsoft Enhanced Cryptographic Provider v1.0"
1857 #if defined(__GNUC__)
1858 # define MS_ENHANCED_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
1859 'E','n','h','a','n','c','e','d',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ', \
1860 'P','r','o','v','i','d','e','r',' ','v','1','.','0',0 }
1861 #elif defined(_MSC_VER)
1862 # define MS_ENHANCED_PROV_W L"Microsoft Enhanced Cryptographic Provider v1.0"
1863 #else
1864 static const WCHAR MS_ENHANCED_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
1865 'E','n','h','a','n','c','e','d',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ',
1866 'P','r','o','v','i','d','e','r',' ','v','1','.','0',0 };
1867 #endif
1868 #define MS_ENHANCED_PROV WINELIB_NAME_AW(MS_ENHANCED_PROV_)
1869
1870 #define MS_STRONG_PROV_A "Microsoft Strong Cryptographic Provider"
1871 #if defined(__GNUC__)
1872 # define MS_STRONG_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
1873 'S','t','r','o','n','g',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ', \
1874 'P','r','o','v','i','d','e','r',0 }
1875 #elif defined(_MSC_VER)
1876 # define MS_STRONG_PROV_W L"Microsoft Strong Cryptographic Provider"
1877 #else
1878 static const WCHAR MS_STRONG_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
1879 'S','t','r','o','n','g',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ',
1880 'P','r','o','v','i','d','e','r',0 };
1881 #endif
1882 #define MS_STRONG_PROV WINELIB_NAME_AW(MS_STRONG_PROV_)
1883
1884 #define MS_DEF_RSA_SIG_PROV_A "Microsoft RSA Signature Cryptographic Provider"
1885 #if defined(__GNUC__)
1886 # define MS_DEF_RSA_SIG_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
1887 'R','S','A',' ','S','i','g','n','a','t','u','r','e',' ', \
1888 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
1889 #elif defined(_MSC_VER)
1890 # define MS_DEF_RSA_SIG_PROV_W L"Microsoft RSA Signature Cryptographic Provider"
1891 #else
1892 static const WCHAR MS_DEF_RSA_SIG_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
1893 'R','S','A',' ','S','i','g','n','a','t','u','r','e',' ',
1894 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
1895 #endif
1896 #define MS_DEF_RSA_SIG_PROV WINELIB_NAME_AW(MS_DEF_RSA_SIG_PROV_)
1897
1898 #define MS_DEF_RSA_SCHANNEL_PROV_A "Microsoft RSA SChannel Cryptographic Provider"
1899 #if defined(__GNUC__)
1900 # define MS_DEF_RSA_SCHANNEL_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
1901 'R','S','A',' ','S','C','h','a','n','n','e','l',' ', \
1902 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
1903 #elif defined(_MSC_VER)
1904 # define MS_DEF_RSA_SCHANNEL_PROV_W L"Microsoft RSA SChannel Cryptographic Provider"
1905 #else
1906 static const WCHAR MS_DEF_RSA_SCHANNEL_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
1907 'R','S','A',' ','S','C','h','a','n','n','e','l',' ',
1908 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
1909 #endif
1910 #define MS_DEF_RSA_SCHANNEL_PROV WINELIB_NAME_AW(MS_DEF_RSA_SCHANNEL_PROV_)
1911
1912 #define MS_DEF_DSS_PROV_A "Microsoft Base DSS Cryptographic Provider"
1913 #if defined(__GNUC__)
1914 # define MS_DEF_DSS_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
1915 'B','a','s','e',' ','D','S','S',' ', \
1916 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
1917 #elif defined(_MSC_VER)
1918 # define MS_DEF_DSS_PROV_W L"Microsoft Base DSS Cryptographic Provider"
1919 #else
1920 static const WCHAR MS_DEF_DSS_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
1921 'B','a','s','e',' ','D','S','S',' ',
1922 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
1923 #endif
1924 #define MS_DEF_DSS_PROV WINELIB_NAME_AW(MS_DEF_DSS_PROV_)
1925
1926 #define MS_DEF_DSS_DH_PROV_A "Microsoft Base DSS and Diffie-Hellman Cryptographic Provider"
1927 #if defined(__GNUC__)
1928 # define MS_DEF_DSS_DH_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
1929 'B','a','s','e',' ','D','S','S',' ','a','n','d',' ', \
1930 'D','i','f','f','i','e','-','H','e','l','l','m','a','n',' ', \
1931 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
1932 #elif defined(_MSC_VER)
1933 # define MS_DEF_DSS_DH_PROV_W L"Microsoft Base DSS and Diffie-Hellman Cryptographic Provider"
1934 #else
1935 static const WCHAR MS_DEF_DSS_DH_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
1936 'B','a','s','e',' ','D','S','S',' ','a','n','d',' ',
1937 'D','i','f','f','i','e','-','H','e','l','l','m','a','n',' ',
1938 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
1939 #endif
1940 #define MS_DEF_DSS_DH_PROV WINELIB_NAME_AW(MS_DEF_DSS_DH_PROV_)
1941
1942 #define MS_ENH_DSS_DH_PROV_A "Microsoft Enhanced DSS and Diffie-Hellman Cryptographic Provider"
1943 #if defined(__GNUC__)
1944 # define MS_ENH_DSS_DH_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
1945 'E','n','h','a','n','c','e','d',' ','D','S','S',' ','a','n','d',' ', \
1946 'D','i','f','f','i','e','-','H','e','l','l','m','a','n',' ', \
1947 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
1948 #elif defined(_MSC_VER)
1949 # define MS_ENH_DSS_DH_PROV_W L"Microsoft Enhanced DSS and Diffie-Hellman Cryptographic Provider"
1950 #else
1951 static const WCHAR MS_ENH_DSS_DH_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
1952 'E','n','h','a','n','c','e','d',' ','D','S','S',' ','a','n','d',' ',
1953 'D','i','f','f','i','e','-','H','e','l','l','m','a','n',' ',
1954 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
1955 #endif
1956 #define MS_ENH_DSS_DH_PROV WINELIB_NAME_AW(MS_ENH_DSS_DH_PROV_)
1957
1958 #define MS_DEF_DH_SCHANNEL_PROV_A "Microsoft DH SChannel Cryptographic Provider"
1959 #if defined(__GNUC__)
1960 # define MS_DEF_DH_SCHANNEL_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
1961 'D','H',' ','S','C','h','a','n','n','e','l',' ', \
1962 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
1963 #elif defined(_MSC_VER)
1964 # define MS_DEF_DH_SCHANNEL_PROV_W L"Microsoft DH SChannel Cryptographic Provider"
1965 #else
1966 static const WCHAR MS_DEF_DH_SCHANNEL_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
1967 'D','H',' ','S','C','h','a','n','n','e','l',' ',
1968 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
1969 #endif
1970 #define MS_DEF_DH_SCHANNEL_PROV WINELIB_NAME_AW(MS_DEF_DH_SCHANNEL_PROV_)
1971
1972 #define MS_SCARD_PROV_A "Microsoft Base Smart Card Cryptographic Provider"
1973 #if defined(__GNUC__)
1974 # define MS_SCARD_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
1975 'B','a','s','e',' ','S','m','a','r','t',' ','C','a','r','d',' ', \
1976 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
1977 #elif defined(_MSC_VER)
1978 # define MS_SCARD_PROV_W L"Microsoft Base Smart Card Cryptographic Provider"
1979 #else
1980 static const WCHAR MS_SCARD_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
1981 'B','a','s','e',' ','S','m','a','r','t',' ','C','a','r','d',' ',
1982 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
1983 #endif
1984 #define MS_SCARD_PROV WINELIB_NAME_AW(MS_SCARD_PROV_)
1985
1986 #define MS_ENH_RSA_AES_PROV_A "Microsoft Enhanced RSA and AES Cryptographic Provider"
1987 #if defined(__GNUC__)
1988 # define MS_ENH_RSA_AES_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
1989 'E','n','h','a','n','c','e','d',' ','R','S','A',' ','a','n','d',' ','A','E','S',' ',\
1990 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
1991 #elif defined(_MSC_VER)
1992 # define MS_ENH_RSA_AES_PROV_W L"Microsoft Enhanced RSA and AES Cryptographic Provider"
1993 #else
1994 static const WCHAR MS_ENH_RSA_AES_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
1995 'E','n','h','a','n','c','e','d',' ','R','S','A',' ','a','n','d',' ','A','E','S',' ',
1996 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
1997 #endif
1998 #define MS_ENH_RSA_AES_PROV WINELIB_NAME_AW(MS_ENH_RSA_AES_PROV_)
1999
2000 #define MS_ENH_RSA_AES_PROV_XP_A "Microsoft Enhanced RSA and AES Cryptographic Provider (Prototype)"
2001 #if defined(__GNUC__)
2002 # define MS_ENH_RSA_AES_PROV_XP_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
2003 'E','n','h','a','n','c','e','d',' ','R','S','A',' ','a','n','d',' ','A','E','S',' ',\
2004 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',' ',\
2005 '(','P','r','o','t','o','t','y','p','e',')',0 }
2006 #elif defined(_MSC_VER)
2007 # define MS_ENH_RSA_AES_PROV_XP_W L"Microsoft Enhanced RSA and AES Cryptographic Provider (Prototype)"
2008 #else
2009 static const WCHAR MS_ENH_RSA_AES_PROV_XP_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
2010 'E','n','h','a','n','c','e','d',' ','R','S','A',' ','a','n','d',' ','A','E','S',' ',
2011 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',' ',
2012 '(','P','r','o','t','o','t','y','p','e',')',0 };
2013 #endif
2014 #define MS_ENH_RSA_AES_PROV_XP WINELIB_NAME_AW(MS_ENH_RSA_AES_PROV_XP_)
2015
2016 /* Key Specs*/
2017 #define AT_KEYEXCHANGE 1
2018 #define AT_SIGNATURE 2
2019
2020 /* Provider Types */
2021 #define PROV_RSA_FULL 1
2022 #define PROV_RSA_SIG 2
2023 #define PROV_DSS 3
2024 #define PROV_FORTEZZA 4
2025 #define PROV_MS_EXCHANGE 5
2026 #define PROV_SSL 6
2027 #define PROV_RSA_SCHANNEL 12
2028 #define PROV_DSS_DH 13
2029 #define PROV_EC_ECDSA_SIG 14
2030 #define PROV_EC_ECNRA_SIG 15
2031 #define PROV_EC_ECDSA_FULL 16
2032 #define PROV_EC_ECNRA_FULL 17
2033 #define PROV_DH_SCHANNEL 18
2034 #define PROV_SPYRUS_LYNKS 20
2035 #define PROV_RNG 21
2036 #define PROV_INTEL_SEC 22
2037 #define PROV_REPLACE_OWF 23
2038 #define PROV_RSA_AES 24
2039
2040 /* FLAGS Section */
2041
2042 #define CRYPT_FIRST 1
2043 #define CRYPT_NEXT 2
2044
2045 #define CRYPT_IMPL_HARDWARE 1
2046 #define CRYPT_IMPL_SOFTWARE 2
2047 #define CRYPT_IMPL_MIXED 3
2048 #define CRYPT_IMPL_UNKNOWN 4
2049
2050 /* CryptAcquireContext */
2051 #define CRYPT_VERIFYCONTEXT 0xF0000000
2052 #define CRYPT_NEWKEYSET 0x00000008
2053 #define CRYPT_DELETEKEYSET 0x00000010
2054 #define CRYPT_MACHINE_KEYSET 0x00000020
2055 #define CRYPT_SILENT 0x00000040
2056
2057 /* Crypt{Get|Set}Provider */
2058 #define CRYPT_MACHINE_DEFAULT 0x00000001
2059 #define CRYPT_USER_DEFAULT 0x00000002
2060 #define CRYPT_DELETE_DEFAULT 0x00000004
2061
2062 /* Crypt{Get/Set}ProvParam */
2063 #define PP_CLIENT_HWND 1
2064 #define PP_ENUMALGS 1
2065 #define PP_ENUMCONTAINERS 2
2066 #define PP_IMPTYPE 3
2067 #define PP_NAME 4
2068 #define PP_VERSION 5
2069 #define PP_CONTAINER 6
2070 #define PP_CHANGE_PASSWORD 7
2071 #define PP_KEYSET_SEC_DESCR 8
2072 #define PP_KEY_TYPE_SUBTYPE 10
2073 #define PP_CONTEXT_INFO 11
2074 #define PP_KEYEXCHANGE_KEYSIZE 12
2075 #define PP_SIGNATURE_KEYSIZE 13
2076 #define PP_KEYEXCHANGE_ALG 14
2077 #define PP_SIGNATURE_ALG 15
2078 #define PP_PROVTYPE 16
2079 #define PP_KEYSTORAGE 17
2080 #define PP_SYM_KEYSIZE 19
2081 #define PP_SESSION_KEYSIZE 20
2082 #define PP_UI_PROMPT 21
2083 #define PP_ENUMALGS_EX 22
2084 #define PP_DELETEKEY 24
2085 #define PP_ENUMMANDROOTS 25
2086 #define PP_ENUMELECTROOTS 26
2087 #define PP_KEYSET_TYPE 27
2088 #define PP_ADMIN_PIN 31
2089 #define PP_KEYEXCHANGE_PIN 32
2090 #define PP_SIGNATURE_PIN 33
2091 #define PP_SIG_KEYSIZE_INC 34
2092 #define PP_KEYX_KEYSIZE_INC 35
2093 #define PP_UNIQUE_CONTAINER 36
2094 #define PP_SGC_INFO 37
2095 #define PP_USE_HARDWARE_RNG 38
2096 #define PP_KEYSPEC 39
2097 #define PP_ENUMEX_SIGNING_PROT 40
2098 #define PP_CRYPT_COUNT_KEY_USE 41
2099 #define PP_USER_CERTSTORE 42
2100 #define PP_SMARTCARD_READER 43
2101 #define PP_SMARTCARD_GUID 45
2102 #define PP_ROOT_CERTSTORE 46
2103
2104 /* Values returned by CryptGetProvParam of PP_KEYSTORAGE */
2105 #define CRYPT_SEC_DESCR 0x00000001
2106 #define CRYPT_PSTORE 0x00000002
2107 #define CRYPT_UI_PROMPT 0x00000004
2108
2109 /* Crypt{Get/Set}KeyParam */
2110 #define KP_IV 1
2111 #define KP_SALT 2
2112 #define KP_PADDING 3
2113 #define KP_MODE 4
2114 #define KP_MODE_BITS 5
2115 #define KP_PERMISSIONS 6
2116 #define KP_ALGID 7
2117 #define KP_BLOCKLEN 8
2118 #define KP_KEYLEN 9
2119 #define KP_SALT_EX 10
2120 #define KP_P 11
2121 #define KP_G 12
2122 #define KP_Q 13
2123 #define KP_X 14
2124 #define KP_Y 15
2125 #define KP_RA 16
2126 #define KP_RB 17
2127 #define KP_INFO 18
2128 #define KP_EFFECTIVE_KEYLEN 19
2129 #define KP_SCHANNEL_ALG 20
2130 #define KP_CLIENT_RANDOM 21
2131 #define KP_SERVER_RANDOM 22
2132 #define KP_RP 23
2133 #define KP_PRECOMP_MD5 24
2134 #define KP_PRECOMP_SHA 25
2135 #define KP_CERTIFICATE 26
2136 #define KP_CLEAR_KEY 27
2137 #define KP_PUB_EX_LEN 28
2138 #define KP_PUB_EX_VAL 29
2139 #define KP_KEYVAL 30
2140 #define KP_ADMIN_PIN 31
2141 #define KP_KEYEXCHANGE_PIN 32
2142 #define KP_SIGNATURE_PIN 33
2143 #define KP_PREHASH 34
2144 #define KP_ROUNDS 35
2145 #define KP_OAEP_PARAMS 36
2146 #define KP_CMS_KEY_INFO 37
2147 #define KP_CMS_DH_KEY_INFO 38
2148 #define KP_PUB_PARAMS 39
2149 #define KP_VERIFY_PARAMS 40
2150 #define KP_HIGHEST_VERSION 41
2151 #define KP_GET_USE_COUNT 42
2152
2153 /* Values for KP_PADDING */
2154 #define PKCS5_PADDING 1
2155 #define RANDOM_PADDING 2
2156 #define ZERO_PADDING 3
2157
2158 /* CryptSignHash/CryptVerifySignature */
2159 #define CRYPT_NOHASHOID 0x00000001
2160 #define CRYPT_TYPE2_FORMAT 0x00000002
2161 #define CRYPT_X931_FORMAT 0x00000004
2162
2163 /* Crypt{Get,Set}HashParam */
2164 #define HP_ALGID 0x0001
2165 #define HP_HASHVAL 0x0002
2166 #define HP_HASHSIZE 0x0004
2167 #define HP_HMAC_INFO 0x0005
2168 #define HP_TLS1PRF_LABEL 0x0006
2169 #define HP_TLS1PRF_SEED 0x0007
2170
2171 /* Crypt{Get,Set}KeyParam */
2172 #define CRYPT_MODE_CBC 1
2173 #define CRYPT_MODE_ECB 2
2174 #define CRYPT_MODE_OFB 3
2175 #define CRYPT_MODE_CFB 4
2176
2177 #define CRYPT_ENCRYPT 0x0001
2178 #define CRYPT_DECRYPT 0x0002
2179 #define CRYPT_EXPORT 0x0004
2180 #define CRYPT_READ 0x0008
2181 #define CRYPT_WRITE 0x0010
2182 #define CRYPT_MAC 0x0020
2183 #define CRYPT_EXPORT_KEY 0x0040
2184 #define CRYPT_IMPORT_KEY 0x0080
2185 #define CRYPT_ARCHIVE 0x0100
2186
2187 /* Crypt*Key */
2188 #define CRYPT_EXPORTABLE 0x00000001
2189 #define CRYPT_USER_PROTECTED 0x00000002
2190 #define CRYPT_CREATE_SALT 0x00000004
2191 #define CRYPT_UPDATE_KEY 0x00000008
2192 #define CRYPT_NO_SALT 0x00000010
2193 #define CRYPT_PREGEN 0x00000040
2194 #define CRYPT_SERVER 0x00000400
2195 #define CRYPT_ARCHIVABLE 0x00004000
2196
2197 /* CryptExportKey */
2198 #define CRYPT_SSL2_FALLBACK 0x00000002
2199 #define CRYPT_DESTROYKEY 0x00000004
2200 #define CRYPT_OAEP 0x00000040
2201
2202 /* CryptHashSessionKey */
2203 #define CRYPT_LITTLE_ENDIAN 0x00000001
2204
2205 /* Crypt{Protect,Unprotect}Data PROMPTSTRUCT flags */
2206 #define CRYPTPROTECT_PROMPT_ON_PROTECT 0x0001
2207 #define CRYPTPROTECT_PROMPT_ON_UNPROTECT 0x0002
2208 /* Crypt{Protect,Unprotect}Data flags */
2209 #define CRYPTPROTECT_UI_FORBIDDEN 0x0001
2210 #define CRYPTPROTECT_LOCAL_MACHINE 0x0004
2211 #define CRYPTPROTECT_AUDIT 0x0010
2212 #define CRYPTPROTECT_VERIFY_PROTECTION 0x0040
2213
2214 /* Crypt{Protect,Unprotect}Memory */
2215 #define CRYPTPROTECTMEMORY_BLOCK_SIZE 16
2216 #define CRYPTPROTECTMEMORY_SAME_PROCESS 0x0000
2217 #define CRYPTPROTECTMEMORY_CROSS_PROCESS 0x0001
2218 #define CRYPTPROTECTMEMORY_SAME_LOGON 0x0002
2219
2220 /* Blob Types */
2221 #define SIMPLEBLOB 0x1
2222 #define PUBLICKEYBLOB 0x6
2223 #define PRIVATEKEYBLOB 0x7
2224 #define PLAINTEXTKEYBLOB 0x8
2225 #define OPAQUEKEYBLOB 0x9
2226 #define PUBLICKEYBLOBEX 0xA
2227 #define SYMMETRICWRAPKEYBLOB 0xB
2228
2229 #define CUR_BLOB_VERSION 2
2230
2231 /* cert store provider types */
2232 #define CERT_STORE_PROV_MSG ((LPCSTR)1)
2233 #define CERT_STORE_PROV_MEMORY ((LPCSTR)2)
2234 #define CERT_STORE_PROV_FILE ((LPCSTR)3)
2235 #define CERT_STORE_PROV_REG ((LPCSTR)4)
2236 #define CERT_STORE_PROV_PKCS7 ((LPCSTR)5)
2237 #define CERT_STORE_PROV_SERIALIZED ((LPCSTR)6)
2238 #define CERT_STORE_PROV_FILENAME_A ((LPCSTR)7)
2239 #define CERT_STORE_PROV_FILENAME_W ((LPCSTR)8)
2240 #define CERT_STORE_PROV_SYSTEM_A ((LPCSTR)9)
2241 #define CERT_STORE_PROV_SYSTEM_W ((LPCSTR)10)
2242 #define CERT_STORE_PROV_SYSTEM CERT_STORE_PROV_SYSTEM_W
2243 #define CERT_STORE_PROV_COLLECTION ((LPCSTR)11)
2244 #define CERT_STORE_PROV_SYSTEM_REGISTRY_A ((LPCSTR)12)
2245 #define CERT_STORE_PROV_SYSTEM_REGISTRY_W ((LPCSTR)13)
2246 #define CERT_STORE_PROV_SYSTEM_REGISTRY CERT_STORE_PROV_SYSTEM_REGISTRY_W
2247 #define CERT_STORE_PROV_PHYSICAL_W ((LPCSTR)14)
2248 #define CERT_STORE_PROV_PHYSICAL CERT_STORE_PROV_PHYSICAL_W
2249 #define CERT_STORE_PROV_SMART_CARD_W ((LPCSTR)15)
2250 #define CERT_STORE_PROV_SMART_CARD CERT_STORE_PROV_SMART_CARD_W
2251 #define CERT_STORE_PROV_LDAP_W ((LPCSTR)16)
2252 #define CERT_STORE_PROV_LDAP CERT_STORE_PROV_LDAP_W
2253
2254 #define sz_CERT_STORE_PROV_MEMORY "Memory"
2255 #define sz_CERT_STORE_PROV_FILENAME_W "File"
2256 #define sz_CERT_STORE_PROV_FILENAME sz_CERT_STORE_PROV_FILENAME_W
2257 #define sz_CERT_STORE_PROV_SYSTEM_W "System"
2258 #define sz_CERT_STORE_PROV_SYSTEM sz_CERT_STORE_PROV_SYSTEM_W
2259 #define sz_CERT_STORE_PROV_PKCS7 "PKCS7"
2260 #define sz_CERT_STORE_PROV_SERIALIZED "Serialized"
2261 #define sz_CERT_STORE_PROV_COLLECTION "Collection"
2262 #define sz_CERT_STORE_PROV_SYSTEM_REGISTRY_W "SystemRegistry"
2263 #define sz_CERT_STORE_PROV_SYSTEM_REGISTRY sz_CERT_STORE_PROV_SYSTEM_REGISTRY_W
2264 #define sz_CERT_STORE_PROV_PHYSICAL_W "Physical"
2265 #define sz_CERT_STORE_PROV_PHYSICAL sz_CERT_STORE_PROV_PHYSICAL_W
2266 #define sz_CERT_STORE_PROV_SMART_CARD_W "SmartCard"
2267 #define sz_CERT_STORE_PROV_SMART_CARD sz_CERT_STORE_PROV_SMART_CARD_W
2268 #define sz_CERT_STORE_PROV_LDAP_W "Ldap"
2269 #define sz_CERT_STORE_PROV_LDAP sz_CERT_STORE_PROV_LDAP_W
2270
2271 /* types for CertOpenStore dwEncodingType */
2272 #define CERT_ENCODING_TYPE_MASK 0x0000ffff
2273 #define CMSG_ENCODING_TYPE_MASK 0xffff0000
2274 #define GET_CERT_ENCODING_TYPE(x) ((x) & CERT_ENCODING_TYPE_MASK)
2275 #define GET_CMSG_ENCODING_TYPE(x) ((x) & CMSG_ENCODING_TYPE_MASK)
2276
2277 #define CRYPT_ASN_ENCODING 0x00000001
2278 #define CRYPT_NDR_ENCODING 0x00000002
2279 #define X509_ASN_ENCODING 0x00000001
2280 #define X509_NDR_ENCODING 0x00000002
2281 #define PKCS_7_ASN_ENCODING 0x00010000
2282 #define PKCS_7_NDR_ENCODING 0x00020000
2283
2284 /* system store locations */
2285 #define CERT_SYSTEM_STORE_LOCATION_MASK 0x00ff0000
2286 #define CERT_SYSTEM_STORE_LOCATION_SHIFT 16
2287
2288 /* system store location ids */
2289 /* hkcu */
2290 #define CERT_SYSTEM_STORE_CURRENT_USER_ID 1
2291 /* hklm */
2292 #define CERT_SYSTEM_STORE_LOCAL_MACHINE_ID 2
2293 /* hklm\Software\Microsoft\Cryptography\Services */
2294 #define CERT_SYSTEM_STORE_CURRENT_SERVICE_ID 4
2295 #define CERT_SYSTEM_STORE_SERVICES_ID 5
2296 /* HKEY_USERS */
2297 #define CERT_SYSTEM_STORE_USERS_ID 6
2298 /* hkcu\Software\Policies\Microsoft\SystemCertificates */
2299 #define CERT_SYSTEM_STORE_CURRENT_USER_GROUP_POLICY_ID 7
2300 /* hklm\Software\Policies\Microsoft\SystemCertificates */
2301 #define CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY_ID 8
2302 /* hklm\Software\Microsoft\EnterpriseCertificates */
2303 #define CERT_SYSTEM_STORE_LOCAL_MACHINE_ENTERPRISE_ID 9
2304
2305 /* system store location values */
2306 #define CERT_SYSTEM_STORE_CURRENT_USER \
2307 (CERT_SYSTEM_STORE_CURRENT_USER_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
2308 #define CERT_SYSTEM_STORE_LOCAL_MACHINE \
2309 (CERT_SYSTEM_STORE_LOCAL_MACHINE_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
2310 #define CERT_SYSTEM_STORE_CURRENT_SERVICE \
2311 (CERT_SYSTEM_STORE_CURRENT_SERVICE_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
2312 #define CERT_SYSTEM_STORE_SERVICES \
2313 (CERT_SYSTEM_STORE_SERVICES_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
2314 #define CERT_SYSTEM_STORE_USERS \
2315 (CERT_SYSTEM_STORE_USERS_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
2316 #define CERT_SYSTEM_STORE_CURRENT_USER_GROUP_POLICY \
2317 (CERT_SYSTEM_STORE_CURRENT_USER_GROUP_POLICY_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
2318 #define CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY \
2319 (CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
2320 #define CERT_SYSTEM_STORE_LOCAL_MACHINE_ENTERPRISE \
2321 (CERT_SYSTEM_STORE_LOCAL_MACHINE_ENTERPRISE_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
2322
2323 #if defined(__GNUC__)
2324 #define CERT_LOCAL_MACHINE_SYSTEM_STORE_REGPATH (const WCHAR[])\
2325 {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t',\
2326 '\\','S','y','s','t','e','m','C','e','r','t','i','f','i','c','a','t','e','s',\
2327 0 }
2328 #define CERT_GROUP_POLICY_SYSTEM_STORE_REGPATH (const WCHAR[])\
2329 {'S','o','f','t','w','a','r','e','\\','P','o','l','i','c','i','e','s','\\',\
2330 'M','i','c','r','o','s','o','f','t','\\','S','y','s','t','e','m','C','e','r',\
2331 't','i','f','i','c','a','t','e','s',0 }
2332 #elif defined(_MSC_VER)
2333 #define CERT_LOCAL_MACHINE_SYSTEM_STORE_REGPATH \
2334 L"Software\\Microsoft\\SystemCertificates"
2335 #define CERT_GROUP_POLICY_SYSTEM_STORE_REGPATH \
2336 L"Software\\Policies\\Microsoft\\SystemCertificates"
2337 #else
2338 static const WCHAR CERT_LOCAL_MACHINE_SYSTEM_STORE_REGPATH[] =
2339 {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
2340 'S','y','s','t','e','m','C','e','r','t','i','f','i','c','a','t','e','s',0 };
2341 static const WCHAR CERT_GROUP_POLICY_SYSTEM_STORE_REGPATH[] =
2342 {'S','o','f','t','w','a','r','e','\\','P','o','l','i','c','i','e','s','\\',
2343 'M','i','c','r','o','s','o','f','t','\\','S','y','s','t','e','m','C','e','r',
2344 't','i','f','i','c','a','t','e','s',0 };
2345 #endif
2346
2347 #if defined(__GNUC__)
2348 #define CERT_EFSBLOB_REGPATH (const WCHAR[])\
2349 {'S','o','f','t','w','a','r','e','\\','P','o','l','i','c','i','e','s','\\',\
2350 'M','i','c','r','o','s','o','f','t','\\','S','y','s','t','e','m','C','e','r',\
2351 't','i','f','i','c','a','t','e','s','\\','E','F','S',0 }
2352 #define CERT_EFSBLOB_VALUE_NAME (const WCHAR[]) {'E','F','S','B','l','o','b',0 }
2353 #elif defined(_MSC_VER)
2354 #define CERT_EFSBLOB_REGPATH CERT_GROUP_POLICY_SYSTEM_STORE_REGPATH L"\\EFS"
2355 #define CERT_EFSBLOB_VALUE_NAME L"EFSBlob"
2356 #else
2357 static const WCHAR CERT_EFSBLOB_REGPATH[] =
2358 {'S','o','f','t','w','a','r','e','\\','P','o','l','i','c','i','e','s','\\',
2359 'M','i','c','r','o','s','o','f','t','\\','S','y','s','t','e','m','C','e','r',
2360 't','i','f','i','c','a','t','e','s','\\','E','F','S',0 };
2361 static const CERT_EFSBLOB_VALUE_NAME[] = { 'E','F','S','B','l','o','b',0 };
2362 #endif
2363
2364 #if defined(__GNUC__)
2365 #define CERT_PROT_ROOT_FLAGS_REGPATH (const WCHAR[])\
2366 {'\\','R','o','o','t','\\','P','r','o','t','e','c','t','e','d','R','o','o','t',\
2367 's',0 }
2368 #define CERT_PROT_ROOT_FLAGS_VALUE_NAME (const WCHAR[])\
2369 {'F','l','a','g','s',0 }
2370 #elif defined(_MSC_VER)
2371 #define CERT_PROT_ROOT_FLAGS_REGPATH L"\\Root\\ProtectedRoots"
2372 #define CERT_PROT_ROOT_FLAGS_VALUE_NAME L"Flags"
2373 #else
2374 static const WCHAR CERT_PROT_ROOT_FLAGS_REGPATH[] =
2375 { '\\','R','o','o','t','\\','P','r','o','t','e','c','t','e','d','R','o','o',
2376 't','s',0 };
2377 static const WCHAR CERT_PROT_ROOT_FLAGS_VALUE_NAME[] = {'F','l','a','g','s',0 };
2378 #endif
2379
2380 #define CERT_PROT_ROOT_DISABLE_CURRENT_USER_FLAG 0x01
2381 #define CERT_PROT_ROOT_INHIBIT_ADD_AT_INIT_FLAG 0x02
2382 #define CERT_PROT_ROOT_INHIBIT_PURGE_LM_FLAG 0x04
2383 #define CERT_PROT_ROOT_DISABLE_LM_AUTH_FLAG 0x08
2384 #define CERT_PROT_ROOT_DISABLE_NT_AUTH_REQUIRED_FLAG 0x10
2385 #define CERT_PROT_ROOT_DISABLE_NOT_DEFINED_NAME_CONSTRAINT_FLAG 0x20
2386
2387 #if defined(__GNUC__)
2388 #define CERT_TRUST_PUB_SAFER_GROUP_POLICY_REGPATH (const WCHAR[])\
2389 {'S','o','f','t','w','a','r','e','\\','P','o','l','i','c','i','e','s','\\',\
2390 'M','i','c','r','o','s','o','f','t','\\','S','y','s','t','e','m','C','e','r',\
2391 't','i','f','i','c','a','t','e','s','\\','T','r','u','s','t','e','d',\
2392 'P','u','b','l','i','s','h','e','r','\\','S','a','f','e','r',0 }
2393 #elif defined(_MSC_VER)
2394 #define CERT_TRUST_PUB_SAFER_GROUP_POLICY_REGPATH \
2395 CERT_GROUP_POLICY_SYSTEM_STORE_REGPATH L"\\TrustedPublisher\\Safer"
2396 #else
2397 static const WCHAR CERT_TRUST_PUB_SAFER_GROUP_POLICY_REGPATH[] =
2398 {'S','o','f','t','w','a','r','e','\\','P','o','l','i','c','i','e','s','\\',
2399 'M','i','c','r','o','s','o','f','t','\\','S','y','s','t','e','m','C','e','r',
2400 't','i','f','i','c','a','t','e','s','\\','T','r','u','s','t','e','d',
2401 'P','u','b','l','i','s','h','e','r','\\','S','a','f','e','r',0 };
2402 #endif
2403
2404 #if defined(__GNUC__)
2405 #define CERT_TRUST_PUB_SAFER_LOCAL_MACHINE_REGPATH (const WCHAR[])\
2406 {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',\
2407 'S','y','s','t','e','m','C','e','r','t','i','f','i','c','a','t','e','s','\\',\
2408 'T','r','u','s','t','e','d','P','u','b','l','i','s','h','e','r','\\',\
2409 'S','a','f','e','r',0 }
2410 #define CERT_TRUST_PUB_AUTHENTICODE_FLAGS_VALUE_NAME (const WCHAR[])\
2411 {'A','u','t','h','e','n','t','i','c','o','d','e','F','l','a','g','s',0 };
2412 #elif defined(_MSC_VER)
2413 #define CERT_TRUST_PUB_SAFER_LOCAL_MACHINE_REGPATH \
2414 CERT_LOCAL_MACHINE_SYSTEM_STORE_REGPATH L"\\TrustedPublisher\\Safer"
2415 #define CERT_TRUST_PUB_AUTHENTICODE_FLAGS_VALUE_NAME L"AuthenticodeFlags"
2416 #else
2417 static const WCHAR CERT_TRUST_PUB_SAFER_LOCAL_MACHINE_REGPATH[] =
2418 {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
2419 'S','y','s','t','e','m','C','e','r','t','i','f','i','c','a','t','e','s','\\',
2420 'T','r','u','s','t','e','d','P','u','b','l','i','s','h','e','r','\\',
2421 'S','a','f','e','r',0 };
2422 static const WCHAR CERT_TRUST_PUB_AUTHENTICODE_FLAGS_VALUE_NAME[] =
2423 { 'A','u','t','h','e','n','t','i','c','o','d','e','F','l','a','g','s',0 };
2424 #endif
2425
2426 #define CERT_TRUST_PUB_ALLOW_END_USER_TRUST 0x00000000
2427 #define CERT_TRUST_PUB_ALLOW_MACHINE_ADMIN_TRUST 0x00000001
2428 #define CERT_TRUST_PUB_ALLOW_ENTERPRISE_ADMIN_TRUST 0x00000002
2429 #define CERT_TRUST_PUB_ALLOW_TRUST_MASK 0x00000003
2430 #define CERT_TRUST_PUB_CHECK_PUBLISHER_REV_FLAG 0x00000100
2431 #define CERT_TRUST_PUB_CHECK_TIMESTAMP_REV_FLAG 0x00000200
2432
2433 /* flags for CertOpenStore dwFlags */
2434 #define CERT_STORE_NO_CRYPT_RELEASE_FLAG 0x00000001
2435 #define CERT_STORE_SET_LOCALIZED_NAME_FLAG 0x00000002
2436 #define CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG 0x00000004
2437 #define CERT_STORE_DELETE_FLAG 0x00000010
2438 #define CERT_STORE_UNSAFE_PHYSICAL_FLAG 0x00000020
2439 #define CERT_STORE_SHARE_STORE_FLAG 0x00000040
2440 #define CERT_STORE_SHARE_CONTEXT_FLAG 0x00000080
2441 #define CERT_STORE_MANIFOLD_FLAG 0x00000100
2442 #define CERT_STORE_ENUM_ARCHIVED_FLAG 0x00000200
2443 #define CERT_STORE_UPDATE_KEYID_FLAG 0x00000400
2444 #define CERT_STORE_BACKUP_RESTORE_FLAG 0x00000800
2445 #define CERT_STORE_MAXIMUM_ALLOWED_FLAG 0x00001000
2446 #define CERT_STORE_CREATE_NEW_FLAG 0x00002000
2447 #define CERT_STORE_OPEN_EXISTING_FLAG 0x00004000
2448 #define CERT_STORE_READONLY_FLAG 0x00008000
2449
2450 #define CERT_REGISTRY_STORE_REMOTE_FLAG 0x00010000
2451 #define CERT_REGISTRY_STORE_SERIALIZED_FLAG 0x00020000
2452 #define CERT_REGISTRY_STORE_ROAMING_FLAG 0x00040000
2453 #define CERT_REGISTRY_STORE_MY_IE_DIRTY_FLAG 0x00080000
2454 #define CERT_REGISTRY_STORE_LM_GPT_FLAG 0x01000000
2455 #define CERT_REGISTRY_STORE_CLIENT_GPT_FLAG 0x80000000
2456
2457 #define CERT_FILE_STORE_COMMIT_ENABLE_FLAG 0x00010000
2458
2459 /* CertCloseStore dwFlags */
2460 #define CERT_CLOSE_STORE_FORCE_FLAG 0x00000001
2461 #define CERT_CLOSE_STORE_CHECK_FLAG 0x00000002
2462
2463 /* dwAddDisposition */
2464 #define CERT_STORE_ADD_NEW 1
2465 #define CERT_STORE_ADD_USE_EXISTING 2
2466 #define CERT_STORE_ADD_REPLACE_EXISTING 3
2467 #define CERT_STORE_ADD_ALWAYS 4
2468 #define CERT_STORE_ADD_REPLACE_EXISTING_INHERIT_PROPERTIES 5
2469 #define CERT_STORE_ADD_NEWER 6
2470 #define CERT_STORE_ADD_NEWER_INHERIT_PROPERTIES 7
2471
2472 /* Installable OID function defs */
2473 #define CRYPT_OID_OPEN_STORE_PROV_FUNC "CertDllOpenStoreProv"
2474 #define CRYPT_OID_ENCODE_OBJECT_FUNC "CryptDllEncodeObject"
2475 #define CRYPT_OID_DECODE_OBJECT_FUNC "CryptDllDecodeObject"
2476 #define CRYPT_OID_ENCODE_OBJECT_EX_FUNC "CryptDllEncodeObjectEx"
2477 #define CRYPT_OID_DECODE_OBJECT_EX_FUNC "CryptDllDecodeObjectEx"
2478 #define CRYPT_OID_CREATE_COM_OBJECT_FUNC "CryptDllCreateComObject"
2479 #define CRYPT_OID_VERIFY_REVOCATION_FUNC "CertDllVerifyRevocation"
2480 #define CRYPT_OID_VERIFY_CTL_USAGE_FUNC "CertDllVerifyCTLUsage"
2481 #define CRYPT_OID_FORMAT_OBJECT_FUNC "CryptDllFormatObject"
2482 #define CRYPT_OID_FIND_OID_INFO_FUNC "CryptDllFindOIDInfo"
2483 #define CRYPT_OID_FIND_LOCALIZED_NAME_FUNC "CryptDllFindLocalizedName"
2484 #define CRYPT_OID_EXPORT_PUBLIC_KEY_INFO_FUNC "CryptDllExportPublicKeyInfoEx"
2485 #define CRYPT_OID_IMPORT_PUBLIC_KEY_INFO_FUNC "CryptDllImportPublicKeyInfoEx"
2486 #define CRYPT_OID_EXPORT_PRIVATE_KEY_INFO_FUNC "CryptDllExportPrivateKeyInfoEx"
2487 #define CRYPT_OID_IMPORT_PRIVATE_KEY_INFO_FUNC "CryptDllImportPrivateKeyInfoEx"
2488 #define CRYPT_OID_VERIFY_CERTIFICATE_CHAIN_POLICY_FUNC \
2489 "CertDllVerifyCertificateChainPolicy"
2490 #define URL_OID_GET_OBJECT_URL_FUNC "UrlDllGetObjectUrl"
2491 #define TIME_VALID_OID_GET_OBJECT_FUNC "TimeValidDllGetObject"
2492 #define CMSG_OID_GEN_CONTENT_ENCRYPT_KEY_FUNC "CryptMsgDllGenContentEncryptKey"
2493 #define CMSG_OID_EXPORT_KEY_TRANS_FUNC "CryptMsgDllExportKeyTrans"
2494 #define CMSG_OID_IMPORT_KEY_TRANS_FUNC "CryptMsgDllImportKeyTrans"
2495
2496 #define CRYPT_OID_REGPATH "Software\\Microsoft\\Cryptography\\OID"
2497 #define CRYPT_OID_REG_ENCODING_TYPE_PREFIX "EncodingType "
2498 #if defined(__GNUC__)
2499 # define CRYPT_OID_REG_DLL_VALUE_NAME (const WCHAR []){ 'D','l','l',0 }
2500 # define CRYPT_OID_REG_FUNC_NAME_VALUE_NAME \
2501 (const WCHAR []){ 'F','u','n','c','N','a','m','e',0 }
2502 # define CRYPT_OID_REG_FLAGS_VALUE_NAME \
2503 (const WCHAR []){ 'C','r','y','p','t','F','l','a','g','s',0 }
2504 #elif defined(_MSC_VER)
2505 # define CRYPT_OID_REG_DLL_VALUE_NAME L"Dll"
2506 # define CRYPT_OID_REG_FUNC_NAME_VALUE_NAME L"FuncName"
2507 # define CRYPT_OID_REG_FLAGS_VALUE_NAME L"CryptFlags"
2508 #else
2509 static const WCHAR CRYPT_OID_REG_DLL_VALUE_NAME[] = { 'D','l','l',0 };
2510 static const WCHAR CRYPT_OID_REG_FUNC_NAME_VALUE_NAME[] =
2511 { 'F','u','n','c','N','a','m','e',0 };
2512 static const WCHAR CRYPT_OID_REG_FLAGS_VALUE_NAME[] =
2513 { 'C','r','y','p','t','F','l','a','g','s',0 };
2514 #endif
2515 #define CRYPT_OID_REG_FUNC_NAME_VALUE_NAME_A "FuncName"
2516 #define CRYPT_DEFAULT_OID "DEFAULT"
2517
2518 #define CRYPT_INSTALL_OID_FUNC_BEFORE_FLAG 1
2519
2520 #define CRYPT_GET_INSTALLED_OID_FUNC_FLAG 0x1
2521
2522 #define CRYPT_REGISTER_FIRST_INDEX 0
2523 #define CRYPT_REGISTER_LAST_INDEX 0xffffffff
2524
2525 /* values for CERT_STORE_PROV_INFO's dwStoreProvFlags */
2526 #define CERT_STORE_PROV_EXTERNAL_FLAG 0x1
2527 #define CERT_STORE_PROV_DELETED_FLAG 0x2
2528 #define CERT_STORE_PROV_NO_PERSIST_FLAG 0x4
2529 #define CERT_STORE_PROV_SYSTEM_STORE_FLAG 0x8
2530 #define CERT_STORE_PROV_LM_SYSTEM_STORE_FLAG 0x10
2531
2532 /* function indices */
2533 #define CERT_STORE_PROV_CLOSE_FUNC 0
2534 #define CERT_STORE_PROV_READ_CERT_FUNC 1
2535 #define CERT_STORE_PROV_WRITE_CERT_FUNC 2
2536 #define CERT_STORE_PROV_DELETE_CERT_FUNC 3
2537 #define CERT_STORE_PROV_SET_CERT_PROPERTY_FUNC 4
2538 #define CERT_STORE_PROV_READ_CRL_FUNC 5
2539 #define CERT_STORE_PROV_WRITE_CRL_FUNC 6
2540 #define CERT_STORE_PROV_DELETE_CRL_FUNC 7
2541 #define CERT_STORE_PROV_SET_CRL_PROPERTY_FUNC 8
2542 #define CERT_STORE_PROV_READ_CTL_FUNC 9
2543 #define CERT_STORE_PROV_WRITE_CTL_FUNC 10
2544 #define CERT_STORE_PROV_DELETE_CTL_FUNC 11
2545 #define CERT_STORE_PROV_SET_CTL_PROPERTY_FUNC 12
2546 #define CERT_STORE_PROV_CONTROL_FUNC 13
2547 #define CERT_STORE_PROV_FIND_CERT_FUNC 14
2548 #define CERT_STORE_PROV_FREE_FIND_CERT_FUNC 15
2549 #define CERT_STORE_PROV_GET_CERT_PROPERTY_FUNC 16
2550 #define CERT_STORE_PROV_FIND_CRL_FUNC 17
2551 #define CERT_STORE_PROV_FREE_FIND_CRL_FUNC 18
2552 #define CERT_STORE_PROV_GET_CRL_PROPERTY_FUNC 19
2553 #define CERT_STORE_PROV_FIND_CTL_FUNC 20
2554 #define CERT_STORE_PROV_FREE_FIND_CTL_FUNC 21
2555 #define CERT_STORE_PROV_GET_CTL_PROPERTY_FUNC 22
2556
2557 /* physical store dwFlags, also used by CertAddStoreToCollection as
2558 * dwUpdateFlags
2559 */
2560 #define CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG 0x1
2561 #define CERT_PHYSICAL_STORE_OPEN_DISABLE_FLAG 0x2
2562 #define CERT_PHYSICAL_STORE_REMOVE_OPEN_DISABLE_FLAG 0x4
2563 #define CERT_PHYSICAL_STORE_INSERT_COMPUTER_NAME_ENABLE_FLAG 0x8
2564
2565 /* dwFlag values for CertEnumPhysicalStore callback */
2566 #define CERT_PHYSICAL_STORE_PREDEFINED_ENUM_FLAG 0x1
2567
2568 /* predefined store names */
2569 #if defined(__GNUC__)
2570 # define CERT_PHYSICAL_STORE_DEFAULT_NAME (const WCHAR[])\
2571 {'.','D','e','f','a','u','l','t','0'}
2572 # define CERT_PHYSICAL_STORE_GROUP_POLICY_NAME (const WCHAR[])\
2573 {'.','G','r','o','u','p','P','o','l','i','c','y',0}
2574 # define CERT_PHYSICAL_STORE_LOCAL_MACHINE_NAME (const WCHAR[])\
2575 {'.','L','o','c','a','l','M','a','c','h','i','n','e',0}
2576 # define CERT_PHYSICAL_STORE_DS_USER_CERTIFICATE_NAME (const WCHAR[])\
2577 {'.','U','s','e','r','C','e','r','t','i','f','i','c','a','t','e',0}
2578 # define CERT_PHYSICAL_STORE_LOCAL_MACHINE_GROUP_POLICY_NAME (const WCHAR[])\
2579 {'.','L','o','c','a','l','M','a','c','h','i','n','e','G','r','o','u','p',\
2580 'P','o','l','i','c','y',0}
2581 # define CERT_PHYSICAL_STORE_ENTERPRISE_NAME (const WCHAR[])\
2582 {'.','E','n','t','e','r','p','r','i','s','e',0}
2583 # define CERT_PHYSICAL_STORE_AUTH_ROOT_NAME (const WCHAR[])\
2584 {'.','A','u','t','h','R','o','o','t',0}
2585 #elif defined(_MSC_VER)
2586 # define CERT_PHYSICAL_STORE_DEFAULT_NAME \
2587 L".Default"
2588 # define CERT_PHYSICAL_STORE_GROUP_POLICY_NAME \
2589 L".GroupPolicy"
2590 # define CERT_PHYSICAL_STORE_LOCAL_MACHINE_NAME \
2591 L".LocalMachine"
2592 # define CERT_PHYSICAL_STORE_DS_USER_CERTIFICATE_NAME \
2593 L".UserCertificate"
2594 # define CERT_PHYSICAL_STORE_LOCAL_MACHINE_GROUP_POLICY_NAME \
2595 L".LocalMachineGroupPolicy"
2596 # define CERT_PHYSICAL_STORE_ENTERPRISE_NAME \
2597 L".Enterprise"
2598 # define CERT_PHYSICAL_STORE_AUTH_ROOT_NAME \
2599 L".AuthRoot"
2600 #else
2601 static const WCHAR CERT_PHYSICAL_STORE_DEFAULT_NAME[] =
2602 {'.','D','e','f','a','u','l','t','0'};
2603 static const WCHAR CERT_PHYSICAL_STORE_GROUP_POLICY_NAME[] =
2604 {'.','G','r','o','u','p','P','o','l','i','c','y',0};
2605 static const WCHAR CERT_PHYSICAL_STORE_LOCAL_MACHINE_NAME[] =
2606 {'.','L','o','c','a','l','M','a','c','h','i','n','e',0};
2607 static const WCHAR CERT_PHYSICAL_STORE_DS_USER_CERTIFICATE_NAME[] =
2608 {'.','U','s','e','r','C','e','r','t','i','f','i','c','a','t','e',0};
2609 static const WCHAR CERT_PHYSICAL_STORE_LOCAL_MACHINE_GROUP_POLICY_NAME[] =
2610 {'.','L','o','c','a','l','M','a','c','h','i','n','e','G','r','o','u','p',
2611 'P','o','l','i','c','y',0};
2612 static const WCHAR CERT_PHYSICAL_STORE_ENTERPRISE_NAME[] =
2613 {'.','E','n','t','e','r','p','r','i','s','e',0};
2614 static const WCHAR CERT_PHYSICAL_STORE_AUTH_ROOT_NAME[] =
2615 {'.','A','u','t','h','R','o','o','t',0};
2616 #endif
2617
2618 /* cert system store flags */
2619 #define CERT_SYSTEM_STORE_MASK 0xffff0000
2620 #define CERT_SYSTEM_STORE_RELOCATE_FLAG 0x80000000
2621
2622 /* CertFindChainInStore dwFindType types */
2623 #define CERT_CHAIN_FIND_BY_ISSUER 1
2624
2625 /* CertSaveStore dwSaveAs values */
2626 #define CERT_STORE_SAVE_AS_STORE 1
2627 #define CERT_STORE_SAVE_AS_PKCS7 2
2628 /* CertSaveStore dwSaveTo values */
2629 #define CERT_STORE_SAVE_TO_FILE 1
2630 #define CERT_STORE_SAVE_TO_MEMORY 2
2631 #define CERT_STORE_SAVE_TO_FILENAME_A 3
2632 #define CERT_STORE_SAVE_TO_FILENAME_W 4
2633 #define CERT_STORE_SAVE_TO_FILENAME CERT_STORE_SAVE_TO_FILENAME_W
2634
2635 /* CERT_INFO versions/flags */
2636 #define CERT_V1 0
2637 #define CERT_V2 1
2638 #define CERT_V3 2
2639 #define CERT_INFO_VERSION_FLAG 1
2640 #define CERT_INFO_SERIAL_NUMBER_FLAG 2
2641 #define CERT_INFO_SIGNATURE_ALGORITHM_FLAG 3
2642 #define CERT_INFO_ISSUER_FLAG 4
2643 #define CERT_INFO_NOT_BEFORE_FLAG 5
2644 #define CERT_INFO_NOT_AFTER_FLAG 6
2645 #define CERT_INFO_SUBJECT_FLAG 7
2646 #define CERT_INFO_SUBJECT_PUBLIC_KEY_INFO_FLAG 8
2647 #define CERT_INFO_ISSUER_UNIQUE_ID_FLAG 9
2648 #define CERT_INFO_SUBJECT_UNIQUE_ID_FLAG 10
2649 #define CERT_INFO_EXTENSION_FLAG 11
2650
2651 /* CERT_REQUEST_INFO versions */
2652 #define CERT_REQUEST_V1 0
2653
2654 /* CERT_KEYGEN_REQUEST_INFO versions */
2655 #define CERT_KEYGEN_REQUEST_V1 0
2656
2657 /* CRL versions */
2658 #define CRL_V1 0
2659 #define CRL_V2 1
2660
2661 /* CTL versions */
2662 #define CTL_V1 0
2663
2664 /* Certificate, CRL, CTL property IDs */
2665 #define CERT_KEY_PROV_HANDLE_PROP_ID 1
2666 #define CERT_KEY_PROV_INFO_PROP_ID 2
2667 #define CERT_SHA1_HASH_PROP_ID 3
2668 #define CERT_HASH_PROP_ID CERT_SHA1_HASH_PROP_ID
2669 #define CERT_MD5_HASH_PROP_ID 4
2670 #define CERT_KEY_CONTEXT_PROP_ID 5
2671 #define CERT_KEY_SPEC_PROP_ID 6
2672 #define CERT_IE30_RESERVED_PROP_ID 7
2673 #define CERT_PUBKEY_HASH_RESERVED_PROP_ID 8
2674 #define CERT_ENHKEY_USAGE_PROP_ID 9
2675 #define CERT_CTL_USAGE_PROP_ID CERT_ENHKEY_USAGE_PROP_ID
2676 #define CERT_NEXT_UPDATE_LOCATION_PROP_ID 10
2677 #define CERT_FRIENDLY_NAME_PROP_ID 11
2678 #define CERT_PVK_FILE_PROP_ID 12
2679 #define CERT_DESCRIPTION_PROP_ID 13
2680 #define CERT_ACCESS_STATE_PROP_ID 14
2681 #define CERT_SIGNATURE_HASH_PROP_ID 15
2682 #define CERT_SMART_CARD_DATA_PROP_ID 16
2683 #define CERT_EFS_PROP_ID 17
2684 #define CERT_FORTEZZA_DATA_PROP 18
2685 #define CERT_ARCHIVED_PROP_ID 19
2686 #define CERT_KEY_IDENTIFIER_PROP_ID 20
2687 #define CERT_AUTO_ENROLL_PROP_ID 21
2688 #define CERT_PUBKEY_ALG_PARA_PROP_ID 22
2689 #define CERT_CROSS_CERT_DIST_POINTS_PROP_ID 23
2690 #define CERT_ISSUER_PUBLIC_KEY_MD5_HASH_PROP_ID 24
2691 #define CERT_SUBJECT_PUBLIC_KEY_MD5_HASH_PROP_ID 25
2692 #define CERT_ENROLLMENT_PROP_ID 26
2693 #define CERT_DATE_STAMP_PROP_ID 27
2694 #define CERT_ISSUER_SERIAL_NUMBER_MD5_HASH_PROP_ID 28
2695 #define CERT_SUBJECT_NAME_MD5_HASH_PROP_ID 29
2696 #define CERT_EXTENDED_ERROR_INFO_PROP_ID 30
2697 /* 31 -- unused?
2698 32 -- cert prop id
2699 33 -- CRL prop id
2700 34 -- CTL prop id
2701 35 -- KeyId prop id
2702 36-63 -- reserved
2703 */
2704 #define CERT_RENEWAL_PROP_ID 64
2705 #define CERT_ARCHIVED_KEY_HASH_PROP_ID 65
2706 #define CERT_AUTO_ENROLL_RETRY_PROP_ID 66
2707 #define CERT_AIA_URL_RETRIEVED_PROP_ID 67
2708 #define CERT_AUTHORITY_INFO_ACCESS_PROP_ID 68
2709 #define CERT_BACKED_UP_PROP_ID 69
2710 #define CERT_OCSP_RESPONSE_PROP_ID 70
2711 #define CERT_REQUEST_ORIGINATOR_PROP_ID 71
2712 #define CERT_SOURCE_LOCATION_PROP_ID 72
2713 #define CERT_SOURCE_URL_PROP_ID 73
2714 #define CERT_NEW_KEY_PROP_ID 74
2715 #define CERT_OCSP_CACHE_PREFIX_PROP_ID 75
2716 #define CERT_SMART_CARD_ROOT_INFO_PROP_ID 76
2717 #define CERT_NO_AUTO_EXPIRE_CHECK_PROP_ID 77
2718 #define CERT_NCRYPT_KEY_HANDLE_PROP_ID 78
2719 #define CERT_HCRYPTPROV_OR_NCRYPT_KEY_HANDLE_PROP_ID 79
2720 #define CERT_SUBJECT_INFO_ACCESS_PROP_ID 80
2721 #define CERT_CA_OCSP_AUTHORITY_INFO_ACCESS_PROP_ID 81
2722 #define CERT_CA_DISABLE_CRL_PROP_ID 82
2723 #define CERT_ROOT_PROGRAM_CERT_POLICIES_PROP_ID 83
2724 #define CERT_ROOT_PROGRAM_NAME_CONSTRAINTS_PROP_ID 84
2725
2726 #define CERT_FIRST_RESERVED_PROP_ID 85
2727 #define CERT_LAST_RESERVED_PROP_ID 0x00007fff
2728 #define CERT_FIRST_USER_PROP_ID 0x00008000
2729 #define CERT_LAST_USER_PROP_ID 0x0000ffff
2730
2731 #define IS_CERT_HASH_PROP_ID(x) \
2732 ((x) == CERT_SHA1_HASH_PROP_ID || (x) == CERT_MD5_HASH_PROP_ID || \
2733 (x) == CERT_SIGNATURE_HASH_PROP_ID)
2734
2735 #define IS_PUBKEY_HASH_PROP_ID(x) \
2736 ((x) == CERT_ISSUER_PUBLIC_KEY_MD5_HASH_PROP_ID || \
2737 (x) == CERT_SUBJECT_PUBLIC_KEY_MD5_HASH_PROP_ID)
2738
2739 #define IS_CHAIN_HASH_PROP_ID(x) \
2740 ((x) == CERT_ISSUER_PUBLIC_KEY_MD5_HASH_PROP_ID || \
2741 (x) == CERT_SUBJECT_PUBLIC_KEY_MD5_HASH_PROP_ID || \
2742 (x) == CERT_ISSUER_SERIAL_NUMBER_MD5_HASH_PROP_ID || \
2743 (x) == CERT_SUBJECT_NAME_MD5_HASH_PROP_ID)
2744
2745 /* access state flags */
2746 #define CERT_ACCESS_STATE_WRITE_PERSIST_FLAG 0x1
2747 #define CERT_ACCESS_STATE_SYSTEM_STORE_FLAG 0x2
2748 #define CERT_ACCESS_STATE_LM_SYSTEM_STORE_FLAG 0x4
2749
2750 /* CertSetCertificateContextProperty flags */
2751 #define CERT_SET_PROPERTY_INHIBIT_PERSIST_FLAG 0x40000000
2752 #define CERT_SET_PROPERTY_IGNORE_PERSIST_ERROR_FLAG 0x80000000
2753
2754 /* CERT_RDN attribute dwValueType types */
2755 #define CERT_RDN_TYPE_MASK 0x000000ff
2756 #define CERT_RDN_ANY_TYPE 0
2757 #define CERT_RDN_ENCODED_BLOB 1
2758 #define CERT_RDN_OCTET_STRING 2
2759 #define CERT_RDN_NUMERIC_STRING 3
2760 #define CERT_RDN_PRINTABLE_STRING 4
2761 #define CERT_RDN_TELETEX_STRING 5
2762 #define CERT_RDN_T61_STRING 5
2763 #define CERT_RDN_VIDEOTEX_STRING 6
2764 #define CERT_RDN_IA5_STRING 7
2765 #define CERT_RDN_GRAPHIC_STRING 8
2766 #define CERT_RDN_VISIBLE_STRING 9
2767 #define CERT_RDN_ISO646_STRING 9
2768 #define CERT_RDN_GENERAL_STRING 10
2769 #define CERT_RDN_UNIVERSAL_STRING 11
2770 #define CERT_RDN_INT4_STRING 11
2771 #define CERT_RDN_BMP_STRING 12
2772 #define CERT_RDN_UNICODE_STRING 12
2773 #define CERT_RDN_UTF8_STRING 13
2774
2775 /* CERT_RDN attribute dwValueType flags */
2776 #define CERT_RDN_FLAGS_MASK 0xff000000
2777 #define CERT_RDN_ENABLE_T61_UNICODE_FLAG 0x80000000
2778 #define CERT_RDN_DISABLE_CHECK_TYPE_FLAG 0x4000000
2779 #define CERT_RDN_ENABLE_UTF8_UNICODE_FLAG 0x2000000
2780 #define CERT_RDN_DISABLE_IE4_UTF8_FLAG 0x0100000
2781
2782 #define IS_CERT_RDN_CHAR_STRING(x) \
2783 (((x) & CERT_RDN_TYPE_MASK) >= CERT_RDN_NUMERIC_STRING)
2784
2785 /* CertIsRDNAttrsInCertificateName flags */
2786 #define CERT_UNICODE_IS_RDN_ATTRS_FLAG 0x1
2787 #define CERT_CASE_INSENSITIVE_IS_RDN_ATTRS_FLAG 0x2
2788
2789 /* CRL reason codes */
2790 #define CRL_REASON_UNSPECIFIED 0
2791 #define CRL_REASON_KEY_COMPROMISE 1
2792 #define CRL_REASON_CA_COMPROMISE 2
2793 #define CRL_REASON_AFFILIATION_CHANGED 3
2794 #define CRL_REASON_SUPERSEDED 4
2795 #define CRL_REASON_CESSATION_OF_OPERATION 5
2796 #define CRL_REASON_CERTIFICATE_HOLD 6
2797 #define CRL_REASON_REMOVE_FROM_CRL 8
2798
2799 /* CertControlStore control types */
2800 #define CERT_STORE_CTRL_RESYNC 1
2801 #define CERT_STORE_CTRL_NOTIFY_CHANGE 2
2802 #define CERT_STORE_CTRL_COMMIT 3
2803 #define CERT_STORE_CTRL_AUTO_RESYNC 4
2804 #define CERT_STORE_CTRL_CANCEL_NOTIFY 5
2805
2806 #define CERT_STORE_CTRL_COMMIT_FORCE_FLAG 0x1
2807 #define CERT_STORE_CTRL_COMMIT_CLEAR_FLAG 0x2
2808
2809 /* cert store properties */
2810 #define CERT_STORE_LOCALIZED_NAME_PROP_ID 0x1000
2811
2812 /* CertCreateContext flags */
2813 #define CERT_CREATE_CONTEXT_NOCOPY_FLAG 0x1
2814 #define CERT_CREATE_CONTEXT_SORTED_FLAG 0x2
2815 #define CERT_CREATE_CONTEXT_NO_HCRYPTMSG_FLAG 0x4
2816 #define CERT_CREATE_CONTEXT_NO_ENTRY_FLAG 0x8
2817
2818 #define CERT_COMPARE_MASK 0xffff
2819 #define CERT_COMPARE_SHIFT 16
2820 #define CERT_COMPARE_ANY 0
2821 #define CERT_COMPARE_SHA1_HASH 1
2822 #define CERT_COMPARE_HASH CERT_COMPARE_SHA1_HASH
2823 #define CERT_COMPARE_NAME 2
2824 #define CERT_COMPARE_ATTR 3
2825 #define CERT_COMPARE_MD5_HASH 4
2826 #define CERT_COMPARE_PROPERTY 5
2827 #define CERT_COMPARE_PUBLIC_KEY 6
2828 #define CERT_COMPARE_NAME_STR_A 7
2829 #define CERT_COMPARE_NAME_STR_W 8
2830 #define CERT_COMPARE_KEY_SPEC 9
2831 #define CERT_COMPARE_ENHKEY_USAGE 10
2832 #define CERT_COMPARE_CTL_USAGE CERT_COMPARE_ENHKEY_USAGE
2833 #define CERT_COMPARE_SUBJECT_CERT 11
2834 #define CERT_COMPARE_ISSUER_OF 12
2835 #define CERT_COMPARE_EXISTING 13
2836 #define CERT_COMPARE_SIGNATURE_HASH 14
2837 #define CERT_COMPARE_KEY_IDENTIFIER 15
2838 #define CERT_COMPARE_CERT_ID 16
2839 #define CERT_COMPARE_CROSS_CERT_DIST_POINTS 17
2840 #define CERT_COMPARE_PUBKEY_MD5_HASH 18
2841
2842 /* values of dwFindType for CertFind*InStore */
2843 #define CERT_FIND_ANY \
2844 (CERT_COMPARE_ANY << CERT_COMPARE_SHIFT)
2845 #define CERT_FIND_SHA1_HASH \
2846 (CERT_COMPARE_SHA1_HASH << CERT_COMPARE_SHIFT)
2847 #define CERT_FIND_MD5_HASH \
2848 (CERT_COMPARE_MD5_HASH << CERT_COMPARE_SHIFT)
2849 #define CERT_FIND_SIGNATURE_HASH \
2850 (CERT_COMPARE_SIGNATURE_HASH << CERT_COMPARE_SHIFT)
2851 #define CERT_FIND_KEY_IDENTIFIER \
2852 (CERT_COMPARE_KEY_IDENTIFIER << CERT_COMPARE_SHIFT)
2853 #define CERT_FIND_HASH CERT_FIND_SHA1_HASH
2854 #define CERT_FIND_PROPERTY \
2855 (CERT_COMPARE_PROPERTY << CERT_COMPARE_SHIFT)
2856 #define CERT_FIND_PUBLIC_KEY \
2857 (CERT_COMPARE_PUBLIC_KEY << CERT_COMPARE_SHIFT)
2858 #define CERT_FIND_SUBJECT_NAME \
2859 (CERT_COMPARE_NAME << CERT_COMPARE_SHIFT | CERT_INFO_SUBJECT_FLAG)
2860 #define CERT_FIND_SUBJECT_ATTR \
2861 (CERT_COMPARE_ATTR << CERT_COMPARE_SHIFT | CERT_INFO_SUBJECT_FLAG)
2862 #define CERT_FIND_ISSUER_NAME \
2863 (CERT_COMPARE_NAME << CERT_COMPARE_SHIFT | CERT_INFO_ISSUER_FLAG)
2864 #define CERT_FIND_ISSUER_ATTR \
2865 (CERT_COMPARE_ATTR << CERT_COMPARE_SHIFT | CERT_INFO_ISSUER_FLAG)
2866 #define CERT_FIND_SUBJECT_STR_A \
2867 (CERT_COMPARE_NAME_STR_A << CERT_COMPARE_SHIFT | CERT_INFO_SUBJECT_FLAG)
2868 #define CERT_FIND_SUBJECT_STR_W \
2869 (CERT_COMPARE_NAME_STR_W << CERT_COMPARE_SHIFT | CERT_INFO_SUBJECT_FLAG)
2870 #define CERT_FIND_SUBJECT_STR CERT_FIND_SUBJECT_STR_W
2871 #define CERT_FIND_ISSUER_STR_A \
2872 (CERT_COMPARE_NAME_STR_A << CERT_COMPARE_SHIFT | CERT_INFO_ISSUER_FLAG)
2873 #define CERT_FIND_ISSUER_STR_W \
2874 (CERT_COMPARE_NAME_STR_W << CERT_COMPARE_SHIFT | CERT_INFO_ISSUER_FLAG)
2875 #define CERT_FIND_ISSUER_STR CERT_FIND_ISSUER_STR_W
2876 #define CERT_FIND_KEY_SPEC \
2877 (CERT_COMPARE_KEY_SPEC << CERT_COMPARE_SHIFT)
2878 #define CERT_FIND_ENHKEY_USAGE \
2879 (CERT_COMPARE_ENHKEY_USAGE << CERT_COMPARE_SHIFT)
2880 #define CERT_FIND_CTL_USAGE CERT_FIND_ENHKEY_USAGE
2881 #define CERT_FIND_SUBJECT_CERT \
2882 (CERT_COMPARE_SUBJECT_CERT << CERT_COMPARE_SHIFT)
2883 #define CERT_FIND_ISSUER_OF \
2884 (CERT_COMPARE_ISSUER_OF << CERT_COMPARE_SHIFT)
2885 #define CERT_FIND_EXISTING \
2886 (CERT_COMPARE_EXISTING << CERT_COMPARE_SHIFT)
2887 #define CERT_FIND_CERT_ID \
2888 (CERT_COMPARE_CERT_ID << CERT_COMPARE_SHIFT)
2889 #define CERT_FIND_CROSS_CERT_DIST_POINTS \
2890 (CERT_COMPARE_CROSS_CERT_DIST_POINTS << CERT_COMPARE_SHIFT)
2891 #define CERT_FIND_PUBKEY_MD5_HASH \
2892 (CERT_COMPARE_PUBKEY_MD5_HASH << CERT_COMPARE_SHIFT)
2893
2894 #define CERT_FIND_OPTIONAL_ENHKEY_USAGE_FLAG 0x1
2895 #define CERT_FIND_OPTIONAL_CTL_USAGE_FLAG 0x1
2896 #define CERT_FIND_EXT_ONLY_ENHKEY_USAGE_FLAG 0x2
2897 #define CERT_FIND_EXT_ONLY_CTL_USAGE_FLAG 0x2
2898 #define CERT_FIND_PROP_ONLY_ENHKEY_USAGE_FLAG 0x4
2899 #define CERT_FIND_PROP_ONLY_CTL_USAGE_FLAG 0x4
2900 #define CERT_FIND_NO_ENHKEY_USAGE_FLAG 0x8
2901 #define CERT_FIND_NO_CTL_USAGE_FLAG 0x8
2902 #define CERT_FIND_OR_ENHKEY_USAGE_FLAG 0x10
2903 #define CERT_FIND_OR_CTL_USAGE_FLAG 0x10
2904 #define CERT_FIND_VALID_ENHKEY_USAGE_FLAG 0x20
2905 #define CERT_FIND_VALID_CTL_USAGE_FLAG 0x20
2906
2907 #define CRL_FIND_ANY 0
2908 #define CRL_FIND_ISSUED_BY 1
2909 #define CRL_FIND_EXISTING 2
2910 #define CRL_FIND_ISSUED_FOR 3
2911
2912 #define CRL_FIND_ISSUED_BY_AKI_FLAG 0x1
2913 #define CRL_FIND_ISSUED_BY_SIGNATURE_FLAG 0x2
2914 #define CRL_FIND_ISSUED_BY_DELTA_FLAG 0x4
2915 #define CRL_FIND_ISSUED_BY_BASE_FLAG 0x8
2916
2917 typedef struct _CRL_FIND_ISSUED_FOR_PARA
2918 {
2919 PCCERT_CONTEXT pSubjectCert;
2920 PCCERT_CONTEXT pIssuerCert;
2921 } CRL_FIND_ISSUED_FOR_PARA, *PCRL_FIND_ISSUED_FOR_PARA;
2922
2923 #define CTL_FIND_ANY 0
2924 #define CTL_FIND_SHA1_HASH 1
2925 #define CTL_FIND_MD5_HASH 2
2926 #define CTL_FIND_USAGE 3
2927 #define CTL_FIND_SUBJECT 4
2928 #define CTL_FIND_EXISTING 5
2929
2930 typedef struct _CTL_FIND_USAGE_PARA
2931 {
2932 DWORD cbSize;
2933 CTL_USAGE SubjectUsage;
2934 CRYPT_DATA_BLOB ListIdentifier;
2935 PCERT_INFO pSigner;
2936 } CTL_FIND_USAGE_PARA, *PCTL_FIND_USAGE_PARA;
2937
2938 #define CTL_FIND_NO_LIST_ID_CBDATA 0xffffffff
2939 #define CTL_FIND_NO_SIGNER_PTR ((PCERT_INFO)-1)
2940 #define CTL_FIND_SAME_USAGE_FLAG 0x00000001
2941
2942 typedef struct _CTL_FIND_SUBJECT_PARA
2943 {
2944 DWORD cbSize;
2945 PCTL_FIND_USAGE_PARA pUsagePara;
2946 DWORD dwSubjectType;
2947 void *pvSubject;
2948 } CTL_FIND_SUBJECT_PARA, *PCTL_FIND_SUBJECT_PARA;
2949
2950 /* PFN_CERT_STORE_PROV_WRITE_CERT dwFlags values */
2951 #define CERT_STORE_PROV_WRITE_ADD_FLAG 0x1
2952
2953 /* CertAddSerializedElementToStore context types */
2954 #define CERT_STORE_CERTIFICATE_CONTEXT 1
2955 #define CERT_STORE_CRL_CONTEXT 2
2956 #define CERT_STORE_CTL_CONTEXT 3
2957 #define CERT_STORE_ALL_CONTEXT_FLAG ~0U
2958 #define CERT_STORE_CERTIFICATE_CONTEXT_FLAG \
2959 (1 << CERT_STORE_CERTIFICATE_CONTEXT)
2960 #define CERT_STORE_CRL_CONTEXT_FLAG (1 << CERT_STORE_CRL_CONTEXT)
2961 #define CERT_STORE_CTL_CONTEXT_FLAG (1 << CERT_STORE_CTL_CONTEXT)
2962
2963 /* CryptBinaryToString/CryptStringToBinary flags */
2964 #define CRYPT_STRING_BASE64HEADER 0x00000000
2965 #define CRYPT_STRING_BASE64 0x00000001
2966 #define CRYPT_STRING_BINARY 0x00000002
2967 #define CRYPT_STRING_BASE64REQUESTHEADER 0x00000003
2968 #define CRYPT_STRING_HEX 0x00000004
2969 #define CRYPT_STRING_HEXASCII 0x00000005
2970 #define CRYPT_STRING_BASE64_ANY 0x00000006
2971 #define CRYPT_STRING_ANY 0x00000007
2972 #define CRYPT_STRING_HEX_ANY 0x00000008
2973 #define CRYPT_STRING_BASE64X509CRLHEADER 0x00000009
2974 #define CRYPT_STRING_HEXADDR 0x0000000a
2975 #define CRYPT_STRING_HEXASCIIADDR 0x0000000b
2976 #define CRYPT_STRING_NOCRLF 0x40000000
2977 #define CRYPT_STRING_NOCR 0x80000000
2978
2979 /* OIDs */
2980 #define szOID_RSA "1.2.840.113549"
2981 #define szOID_PKCS "1.2.840.113549.1"
2982 #define szOID_RSA_HASH "1.2.840.113549.2"
2983 #define szOID_RSA_ENCRYPT "1.2.840.113549.3"
2984 #define szOID_PKCS_1 "1.2.840.113549.1.1"
2985 #define szOID_PKCS_2 "1.2.840.113549.1.2"
2986 #define szOID_PKCS_3 "1.2.840.113549.1.3"
2987 #define szOID_PKCS_4 "1.2.840.113549.1.4"
2988 #define szOID_PKCS_5 "1.2.840.113549.1.5"
2989 #define szOID_PKCS_6 "1.2.840.113549.1.6"
2990 #define szOID_PKCS_7 "1.2.840.113549.1.7"
2991 #define szOID_PKCS_8 "1.2.840.113549.1.8"
2992 #define szOID_PKCS_9 "1.2.840.113549.1.9"
2993 #define szOID_PKCS_10 "1.2.840.113549.1.10"
2994 #define szOID_PKCS_11 "1.2.840.113549.1.12"
2995 #define szOID_RSA_RSA "1.2.840.113549.1.1.1"
2996 #define CERT_RSA_PUBLIC_KEY_OBJID szOID_RSA_RSA
2997 #define CERT_DEFAULT_OID_PUBLIC_KEY_SIGN szOID_RSA_RSA
2998 #define CERT_DEFAULT_OID_PUBLIC_KEY_XCHG szOID_RSA_RSA
2999 #define szOID_RSA_MD2RSA "1.2.840.113549.1.1.2"
3000 #define szOID_RSA_MD4RSA "1.2.840.113549.1.1.3"
3001 #define szOID_RSA_MD5RSA "1.2.840.113549.1.1.4"
3002 #define szOID_RSA_SHA1RSA "1.2.840.113549.1.1.5"
3003 #define szOID_RSA_SET0AEP_RSA "1.2.840.113549.1.1.6"
3004 #define szOID_RSA_SHA256RSA "1.2.840.113549.1.1.11"
3005 #define szOID_RSA_SHA384RSA "1.2.840.113549.1.1.12"
3006 #define szOID_RSA_SHA512RSA "1.2.840.113549.1.1.13"
3007 #define szOID_RSA_DH "1.2.840.113549.1.3.1"
3008 #define szOID_RSA_data "1.2.840.113549.1.7.1"
3009 #define szOID_RSA_signedData "1.2.840.113549.1.7.2"
3010 #define szOID_RSA_envelopedData "1.2.840.113549.1.7.3"
3011 #define szOID_RSA_signEnvData "1.2.840.113549.1.7.4"
3012 #define szOID_RSA_digestedData "1.2.840.113549.1.7.5"
3013 #define szOID_RSA_hashedData "1.2.840.113549.1.7.5"
3014 #define szOID_RSA_encryptedData "1.2.840.113549.1.7.6"
3015 #define szOID_RSA_emailAddr "1.2.840.113549.1.9.1"
3016 #define szOID_RSA_unstructName "1.2.840.113549.1.9.2"
3017 #define szOID_RSA_contentType "1.2.840.113549.1.9.3"
3018 #define szOID_RSA_messageDigest "1.2.840.113549.1.9.4"
3019 #define szOID_RSA_signingTime "1.2.840.113549.1.9.5"
3020 #define szOID_RSA_counterSign "1.2.840.113549.1.9.6"
3021 #define szOID_RSA_challengePwd "1.2.840.113549.1.9.7"
3022 #define szOID_RSA_unstructAddr "1.2.840.113549.1.9.9"
3023 #define szOID_RSA_extCertAttrs "1.2.840.113549.1.9.9"
3024 #define szOID_RSA_certExtensions "1.2.840.113549.1.9.14"
3025 #define szOID_RSA_SMIMECapabilities "1.2.840.113549.1.9.15"
3026 #define szOID_RSA_preferSignedData "1.2.840.113549.1.9.15.1"
3027 #define szOID_RSA_SMIMEalg "1.2.840.113549.1.9.16.3"
3028 #define szOID_RSA_SMIMEalgESDH "1.2.840.113549.1.9.16.3.5"
3029 #define szOID_RSA_SMIMEalgCMS3DESwrap "1.2.840.113549.1.9.16.3.6"
3030 #define szOID_RSA_SMIMEalgCMSRC2wrap "1.2.840.113549.1.9.16.3.7"
3031 #define szOID_RSA_MD2 "1.2.840.113549.2.2"
3032 #define szOID_RSA_MD4 "1.2.840.113549.2.4"
3033 #define szOID_RSA_MD5 "1.2.840.113549.2.5"
3034 #define szOID_RSA_RC2CBC "1.2.840.113549.3.2"
3035 #define szOID_RSA_RC4 "1.2.840.113549.3.4"
3036 #define szOID_RSA_DES_EDE3_CBC "1.2.840.113549.3.7"
3037 #define szOID_RSA_RC5_CBCPad "1.2.840.113549.3.9"
3038 #define szOID_ANSI_X942 "1.2.840.10046"
3039 #define szOID_ANSI_X942_DH "1.2.840.10046.2.1"
3040 #define szOID_X957 "1.2.840.10040"
3041 #define szOID_X957_DSA "1.2.840.10040.4.1"
3042 #define szOID_X957_SHA1DSA "1.2.840.10040.4.3"
3043 #define szOID_ECC_PUBLIC_KEY "1.2.840.10045.2.1"
3044 #define szOID_ECC_CURVE_P256 "1.2.840.10045.3.1.7"
3045 #define szOID_ECDSA_SPECIFIED "1.2.840.10045.4.3"
3046 #define szOID_ECDSA_SHA256 "1.2.840.10045.4.3.2"
3047 #define szOID_ECDSA_SHA384 "1.2.840.10045.4.3.3"
3048 #define szOID_ECDSA_SHA512 "1.2.840.10045.4.3.4"
3049 #define szOID_DS "2.5"
3050 #define szOID_DSALG "2.5.8"
3051 #define szOID_DSALG_CRPT "2.5.8.1"
3052 #define szOID_DSALG_HASH "2.5.8.2"
3053 #define szOID_DSALG_SIGN "2.5.8.3"
3054 #define szOID_DSALG_RSA "2.5.8.1.1"
3055 #define szOID_OIW "1.3.14"
3056 #define szOID_OIWSEC "1.3.14.3.2"
3057 #define szOID_OIWSEC_md4RSA "1.3.14.3.2.2"
3058 #define szOID_OIWSEC_md5RSA "1.3.14.3.2.3"
3059 #define szOID_OIWSEC_md4RSA2 "1.3.14.3.2.4"
3060 #define szOID_OIWSEC_desECB "1.3.14.3.2.6"
3061 #define szOID_OIWSEC_desCBC "1.3.14.3.2.7"
3062 #define szOID_OIWSEC_desOFB "1.3.14.3.2.8"
3063 #define szOID_OIWSEC_desCFB "1.3.14.3.2.9"
3064 #define szOID_OIWSEC_desMAC "1.3.14.3.2.10"
3065 #define szOID_OIWSEC_rsaSign "1.3.14.3.2.11"
3066 #define szOID_OIWSEC_dsa "1.3.14.3.2.12"
3067 #define szOID_OIWSEC_shaDSA "1.3.14.3.2.13"
3068 #define szOID_OIWSEC_mdc2RSA "1.3.14.3.2.14"
3069 #define szOID_OIWSEC_shaRSA "1.3.14.3.2.15"
3070 #define szOID_OIWSEC_dhCommMod "1.3.14.3.2.16"
3071 #define szOID_OIWSEC_desEDE "1.3.14.3.2.17"
3072 #define szOID_OIWSEC_sha "1.3.14.3.2.18"
3073 #define szOID_OIWSEC_mdc2 "1.3.14.3.2.19"