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