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