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