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