Use advapi32.CommandLineFromMsiDescriptor to get msi component paths.
[wine/multimedia.git] / include / wincrypt.h
blob507af287417d5420dbf2b83edb499e91d503a2c5
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 _CERT_PUBLIC_KEY_INFO {
132 CRYPT_ALGORITHM_IDENTIFIER Algorithm;
133 CRYPT_BIT_BLOB PublicKey;
134 } CERT_PUBLIC_KEY_INFO, *PCERT_PUBLIC_KEY_INFO;
136 typedef struct _CERT_EXTENSION {
137 LPSTR pszObjId;
138 BOOL fCritical;
139 CRYPT_OBJID_BLOB Value;
140 } CERT_EXTENSION, *PCERT_EXTENSION;
142 typedef struct _CERT_EXTENSIONS {
143 DWORD cExtension;
144 PCERT_EXTENSION rgExtension;
145 } CERT_EXTENSIONS, *PCERT_EXTENSIONS;
147 typedef struct _CERT_INFO {
148 DWORD dwVersion;
149 CRYPT_INTEGER_BLOB SerialNumber;
150 CRYPT_ALGORITHM_IDENTIFIER SignatureAlgorithm;
151 CERT_NAME_BLOB Issuer;
152 FILETIME NotBefore;
153 FILETIME NotAfter;
154 CERT_NAME_BLOB Subject;
155 CERT_PUBLIC_KEY_INFO SubjectPublicKeyInfo;
156 CRYPT_BIT_BLOB IssuerUniqueId;
157 CRYPT_BIT_BLOB SubjectUniqueId;
158 DWORD cExtension;
159 PCERT_EXTENSION rgExtension;
160 } CERT_INFO, *PCERT_INFO;
162 typedef struct _CERT_RDN_ATTR {
163 LPSTR pszObjId;
164 DWORD dwValueType;
165 CERT_RDN_VALUE_BLOB Value;
166 } CERT_RDN_ATTR, *PCERT_RDN_ATTR;
168 typedef struct _CERT_RDN {
169 DWORD cRDNAttr;
170 PCERT_RDN_ATTR rgRDNAttr;
171 } CERT_RDN, *PCERT_RDN;
173 typedef struct _CERT_NAME_INFO {
174 DWORD cRDN;
175 PCERT_RDN rgRDN;
176 } CERT_NAME_INFO, *PCERT_NAME_INFO;
178 typedef struct _CERT_NAME_VALUE {
179 DWORD dwValueType;
180 CERT_RDN_VALUE_BLOB Value;
181 } CERT_NAME_VALUE, *PCERT_NAME_VALUE;
183 typedef struct _CERT_ENCRYPTED_PRIVATE_KEY_INFO {
184 CRYPT_ALGORITHM_IDENTIFIER EncryptionAlgorithm;
185 CRYPT_DATA_BLOB EncryptedPrivateKey;
186 } CERT_ENCRYPTED_PRIVATE_KEY_INFO, *PCERT_ENCRYPTED_PRIVATE_KEY_INFO;
188 typedef struct _CERT_AUTHORITY_KEY_ID_INFO {
189 CRYPT_DATA_BLOB KeyId;
190 CERT_NAME_BLOB CertIssuer;
191 CRYPT_INTEGER_BLOB CertSerialNumber;
192 } CERT_AUTHORITY_KEY_ID_INFO, *PCERT_AUTHORITY_KEY_ID_INFO;
194 typedef struct _CERT_PRIVATE_KEY_VALIDITY {
195 FILETIME NotBefore;
196 FILETIME NotAfter;
197 } CERT_PRIVATE_KEY_VALIDITY, *PCERT_PRIVATE_KEY_VALIDITY;
199 typedef struct _CERT_KEY_ATTRIBUTES_INFO {
200 CRYPT_DATA_BLOB KeyId;
201 CRYPT_BIT_BLOB IntendedKeyUsage;
202 PCERT_PRIVATE_KEY_VALIDITY pPrivateKeyUsagePeriod;
203 } CERT_KEY_ATTRIBUTES_INFO, *PCERT_KEY_ATTRIBUTES_INFO;
205 /* byte 0 */
206 #define CERT_DIGITAL_SIGNATURE_KEY_USAGE 0x80
207 #define CERT_NON_REPUDIATION_KEY_USAGE 0x40
208 #define CERT_KEY_ENCIPHERMENT_KEY_USAGE 0x20
209 #define CERT_DATA_ENCIPHERMENT_KEY_USAGE 0x10
210 #define CERT_KEY_AGREEMENT_KEY_USAGE 0x80
211 #define CERT_KEY_CERT_SIGN_KEY_USAGE 0x40
212 #define CERT_OFFLINE_CRL_SIGN_KEY_USAGE 0x20
213 #define CERT_CRL_SIGN_KEY_USAGE 0x10
214 #define CERT_ENCIPHER_ONLY_KEY_USAGE 0x01
215 /* byte 1 */
216 #define CERT_DECIPHER_ONLY_KEY_USAGE 0x80
218 typedef struct _CERT_POLICY_ID {
219 DWORD cCertPolicyElementId;
220 LPSTR *rgbszCertPolicyElementId;
221 } CERT_POLICY_ID, *PCERT_POLICY_ID;
223 typedef struct _CERT_KEY_USAGE_RESTRICTION_INFO {
224 DWORD cCertPolicyId;
225 PCERT_POLICY_ID rgCertPolicyId;
226 CRYPT_BIT_BLOB RestrictedKeyUsage;
227 } CERT_KEY_USAGE_RESTRICTION_INFO, *PCERT_KEY_USAGE_RESTRICTION_INFO;
229 typedef struct _CERT_OTHER_NAME {
230 LPSTR pszObjId;
231 CRYPT_OBJID_BLOB Value;
232 } CERT_OTHER_NAME, *PCERT_OTHER_NAME;
234 typedef struct _CERT_ALT_NAME_ENTRY {
235 DWORD dwAltNameChoice;
236 union {
237 PCERT_OTHER_NAME pOtherName;
238 LPWSTR pwszRfc822Name;
239 LPWSTR pwszDNSName;
240 CERT_NAME_BLOB DirectoryName;
241 LPWSTR pwszURL;
242 CRYPT_DATA_BLOB IPAddress;
243 LPSTR pszRegisteredID;
244 } DUMMYUNIONNAME;
245 } CERT_ALT_NAME_ENTRY, *PCERT_ALT_NAME_ENTRY;
247 #define CERT_ALT_NAME_OTHER_NAME 1
248 #define CERT_ALT_NAME_RFC822_NAME 2
249 #define CERT_ALT_NAME_DNS_NAME 3
250 #define CERT_ALT_NAME_X400_ADDRESS 4
251 #define CERT_ALT_NAME_DIRECTORY_NAME 5
252 #define CERT_ALT_NAME_EDI_PARTY_NAME 6
253 #define CERT_ALT_NAME_URL 7
254 #define CERT_ALT_NAME_IP_ADDRESS 8
255 #define CERT_ALT_NAME_REGISTERED_ID 9
257 typedef struct _CERT_ALT_NAME_INFO {
258 DWORD cAltEntry;
259 PCERT_ALT_NAME_ENTRY rgAltEntry;
260 } CERT_ALT_NAME_INFO, *PCERT_ALT_NAME_INFO;
262 #define CERT_ALT_NAME_ENTRY_ERR_INDEX_MASK 0xff
263 #define CERT_ALT_NAME_ENTRY_ERR_INDEX_SHIFT 16
264 #define CERT_ALT_NAME_VALUE_ERR_INDEX_MASK 0x0000ffff
265 #define CERT_ALT_NAME_VALUE_ERR_INDEX_SHIFT 0
266 #define GET_CERT_ALT_NAME_ENTRY_ERR_INDEX(x) \
267 (((x) >> CERT_ALT_NAME_ENTRY_ERR_INDEX_SHIFT) & \
268 CERT_ALT_NAME_ENTRY_ERR_INDEX_MASK)
269 #define GET_CERT_ALT_NAME_VALUE_ERR_INDEX(x) \
270 ((x) & CERT_ALT_NAME_VALUE_ERR_INDEX_MASK)
272 typedef struct _CERT_BASIC_CONSTRAINTS_INFO {
273 CRYPT_BIT_BLOB SubjectType;
274 BOOL fPathLenConstraint;
275 DWORD dwPathLenConstraint;
276 DWORD cSubtreesConstraint;
277 CERT_NAME_BLOB *rgSubtreesConstraint;
278 } CERT_BASIC_CONSTRAINTS_INFO, *PCERT_BASIC_CONSTRAINTS_INFO;
280 #define CERT_CA_SUBJECT_FLAG 0x80
281 #define CERT_END_ENTITY_SUBJECT_FLAG 0x40
283 typedef struct _CERT_BASIC_CONSTRAINTS2_INFO {
284 BOOL fCA;
285 BOOL fPathLenConstraint;
286 DWORD dwPathLenConstraint;
287 } CERT_BASIC_CONSTRAINTS2_INFO, *PCERT_BASIC_CONSTRAINTS2_INFO;
289 typedef struct _CERT_POLICY_QUALIFIER_INFO {
290 LPSTR pszPolicyQualifierId;
291 CRYPT_OBJID_BLOB Qualifier;
292 } CERT_POLICY_QUALIFIER_INFO, *PCERT_POLICY_QUALIFIER_INFO;
294 typedef struct _CERT_POLICY_INFO {
295 LPSTR pszPolicyIdentifier;
296 DWORD cPolicyQualifier;
297 CERT_POLICY_QUALIFIER_INFO *rgPolicyQualifier;
298 } CERT_POLICY_INFO, *PCERT_POLICY_INFO;
300 typedef struct _CERT_POLICIES_INFO {
301 DWORD cPolicyInfo;
302 CERT_POLICY_INFO *rgPolicyInfo;
303 } CERT_POLICIES_INFO, *PCERT_POLICIES_INFO;
305 typedef struct _CERT_POLICY_QUALIFIER_NOTICE_REFERENCE {
306 LPSTR pszOrganization;
307 DWORD cNoticeNumbers;
308 int *rgNoticeNumbers;
309 } CERT_POLICY_QUALIFIER_NOTICE_REFERENCE,
310 *PCERT_POLICY_QUALIFIER_NOTICE_REFERENCE;
312 typedef struct _CERT_POLICY_QUALIFIER_USER_NOTICE {
313 CERT_POLICY_QUALIFIER_NOTICE_REFERENCE *pNoticeReference;
314 LPWSTR pszDisplayText;
315 } CERT_POLICY_QUALIFIER_USER_NOTICE, *PCERT_POLICY_QUALIFIER_USER_NOTICE;
317 typedef struct _CPS_URLS {
318 LPWSTR pszURL;
319 CRYPT_ALGORITHM_IDENTIFIER *pAlgorithm;
320 CRYPT_DATA_BLOB *pDigest;
321 } CPS_URLS, *PCPS_URLS;
323 typedef struct _CERT_POLICY95_QUALIFIER1 {
324 LPWSTR pszPracticesReference;
325 LPSTR pszNoticeIdentifier;
326 LPSTR pszNSINoticeIdentifier;
327 DWORD cCPSURLs;
328 CPS_URLS *rgCPSURLs;
329 } CERT_POLICY95_QUALIFIER1, *PCERT_POLICY95_QUALIFIER1;
331 typedef struct _CERT_POLICY_MAPPING {
332 LPSTR pszIssuerDomainPolicy;
333 LPSTR pszSubjectDomainPolicy;
334 } CERT_POLICY_MAPPING, *PCERT_POLICY_MAPPING;
336 typedef struct _CERT_POLICY_MAPPINGS_INFO {
337 DWORD cPolicyMapping;
338 PCERT_POLICY_MAPPING rgPolicyMapping;
339 } CERT_POLICY_MAPPINGS_INFO, *PCERT_POLICY_MAPPINGS_INFO;
341 typedef struct _CERT_POLICY_CONSTRAINTS_INFO {
342 BOOL fRequireExplicitPolicy;
343 DWORD dwRequireExplicitPolicySkipCerts;
344 BOOL fInhibitPolicyMapping;
345 DWORD dwInhibitPolicyMappingSkipCerts;
346 } CERT_POLICY_CONSTRAINTS_INFO, *PCERT_POLICY_CONSTRAINTS_INFO;
348 typedef struct _CRYPT_CONTENT_INFO_SEQUENCE_OF_ANY {
349 LPSTR pszObjId;
350 DWORD cValue;
351 PCRYPT_DER_BLOB rgValue;
352 } CRYPT_CONTENT_INFO_SEQUENCE_OF_ANY, *PCRYPT_CONTENT_INFO_SEQUENCE_OF_ANY;
354 typedef struct _CRYPT_CONTENT_INFO {
355 LPSTR pszObjId;
356 CRYPT_DER_BLOB Content;
357 } CRYPT_CONTENT_INFO, *PCRYPT_CONTENT_INFO;
359 typedef struct _CRYPT_SEQUENCE_OF_ANY {
360 DWORD cValue;
361 PCRYPT_DER_BLOB rgValue;
362 } CRYPT_SEQUENCE_OF_ANY, *PCRYPT_SEQUENCE_OF_ANY;
364 typedef struct _CERT_AUTHORITY_KEY_ID2_INFO {
365 CRYPT_DATA_BLOB KeyId;
366 CERT_ALT_NAME_INFO AuthorityCertIssuer;
367 CRYPT_INTEGER_BLOB AuthorityCertSerialNumber;
368 } CERT_AUTHORITY_KEY_ID2_INFO, *PCERT_AUTHORITY_KEY_ID2_INFO;
370 typedef struct _CERT_ACCESS_DESCRIPTION {
371 LPSTR pszAccessMethod;
372 CERT_ALT_NAME_ENTRY AccessLocation;
373 } CERT_ACCESS_DESCRIPTION, *PCERT_ACCESS_DESCRIPTION;
375 typedef struct _CERT_AUTHORITY_INFO_ACCESS {
376 DWORD cAccDescr;
377 PCERT_ACCESS_DESCRIPTION rgAccDescr;
378 } CERT_AUTHORITY_INFO_ACCESS, *PCERT_AUTHORITY_INFO_ACCESS;
380 typedef struct _CERT_CONTEXT {
381 DWORD dwCertEncodingType;
382 BYTE *pbCertEncoded;
383 DWORD cbCertEncoded;
384 PCERT_INFO pCertInfo;
385 HCERTSTORE hCertStore;
386 } CERT_CONTEXT, *PCERT_CONTEXT;
387 typedef const CERT_CONTEXT *PCCERT_CONTEXT;
389 typedef struct _CRL_ENTRY {
390 CRYPT_INTEGER_BLOB SerialNumber;
391 FILETIME RevocationDate;
392 DWORD cExtension;
393 PCERT_EXTENSION rgExtension;
394 } CRL_ENTRY, *PCRL_ENTRY;
396 typedef struct _CRL_INFO {
397 DWORD dwVersion;
398 CRYPT_ALGORITHM_IDENTIFIER SignatureAlgorithm;
399 CERT_NAME_BLOB Issuer;
400 FILETIME ThisUpdate;
401 FILETIME NextUpdate;
402 DWORD cCRLEntry;
403 PCRL_ENTRY rgCRLEntry;
404 DWORD cExtension;
405 PCERT_EXTENSION rgExtension;
406 } CRL_INFO, *PCRL_INFO;
408 typedef struct _CRL_DIST_POINT_NAME {
409 DWORD dwDistPointNameChoice;
410 union {
411 CERT_ALT_NAME_INFO FullName;
412 } DUMMYUNIONNAME;
413 } CRL_DIST_POINT_NAME, *PCRL_DIST_POINT_NAME;
415 #define CRL_DIST_POINT_NO_NAME 0
416 #define CRL_DIST_POINT_FULL_NAME 1
417 #define CRL_DIST_POINT_ISSUER_RDN_NAME 2
419 typedef struct _CRL_DIST_POINT {
420 CRL_DIST_POINT_NAME DistPointName;
421 CRYPT_BIT_BLOB ReasonFlags;
422 CERT_ALT_NAME_INFO CRLIssuer;
423 } CRL_DIST_POINT, *PCRL_DIST_POINT;
425 #define CRL_REASON_UNUSED_FLAG 0x80
426 #define CRL_REASON_KEY_COMPROMISE_FLAG 0x40
427 #define CRL_REASON_CA_COMPROMISE_FLAG 0x20
428 #define CRL_REASON_AFFILIATION_CHANGED_FLAG 0x10
429 #define CRL_REASON_SUPERSEDED_FLAG 0x08
430 #define CRL_REASON_CESSATION_OF_OPERATION_FLAG 0x04
431 #define CRL_REASON_CERTIFICATE_HOLD_FLAG 0x02
433 typedef struct _CRL_DIST_POINTS_INFO {
434 DWORD cDistPoint;
435 PCRL_DIST_POINT rgDistPoint;
436 } CRL_DIST_POINTS_INFO, *PCRL_DIST_POINTS_INFO;
438 #define CRL_DIST_POINT_ERR_INDEX_MASK 0x7f
439 #define CRL_DIST_POINT_ERR_INDEX_SHIFT 24
440 #define GET_CRL_DIST_POINT_ERR_INDEX(x) \
441 (((x) >> CRL_DIST_POINT_ERR_INDEX_SHIFT) & CRL_DIST_POINT_ERR_INDEX_MASK)
443 #define CRL_DIST_POINT_ERR_CRL_ISSUER_BIT 0x80000000L
444 #define IS_CRL_DIST_POINT_ERR_CRL_ISSUER(x) \
445 ((x) & CRL_DIST_POINT_ERR_CRL_ISSUER_BIT)
447 typedef struct _CROSS_CERT_DIST_POINTS_INFO {
448 DWORD dwSyncDeltaTime;
449 DWORD cDistPoint;
450 PCERT_ALT_NAME_INFO rgDistPoint;
451 } CROSS_CERT_DIST_POINTS_INFO, *PCROSS_CERT_DIST_POINTS_INFO;
453 #define CROSS_CERT_DIST_POINT_ERR_INDEX_MASK 0xff
454 #define CROSS_CERT_DIST_POINT_ERR_INDEX_SHIFT 24
455 #define GET_CROSS_CERT_DIST_POINT_ERR_INDEX(x) \
456 (((x) >> CROSS_CERT_DIST_POINT_ERR_INDEX_SHIFT) & \
457 CROSS_CERT_DIST_POINT_ERR_INDEX_MASK)
459 typedef struct _CERT_PAIR {
460 CERT_BLOB Forward;
461 CERT_BLOB Reverse;
462 } CERT_PAIR, *PCERT_PAIR;
464 typedef struct _CRL_ISSUING_DIST_POINT {
465 CRL_DIST_POINT_NAME DistPointName;
466 BOOL fOnlyContainsUserCerts;
467 BOOL fOnlyContainsCACerts;
468 CRYPT_BIT_BLOB OnlySomeReasonFlags;
469 BOOL fIndirectCRL;
470 } CRL_ISSUING_DIST_POINT, *PCRL_ISSUING_DIST_POINT;
472 typedef struct _CERT_GENERAL_SUBTREE {
473 CERT_ALT_NAME_ENTRY Base;
474 DWORD dwMinimum;
475 BOOL fMaximum;
476 DWORD dwMaximum;
477 } CERT_GENERAL_SUBTREE, *PCERT_GENERAL_SUBTREE;
479 typedef struct _CERT_NAME_CONSTRAINTS_INFO {
480 DWORD cPermittedSubtree;
481 PCERT_GENERAL_SUBTREE rgPermittedSubtree;
482 DWORD cExcludedSubtree;
483 PCERT_GENERAL_SUBTREE rgExcludedSubtree;
484 } CERT_NAME_CONSTRAINTS_INFO, *PCERT_NAME_CONSTRAINTS_INFO;
486 #define CERT_EXCLUDED_SUBTREE_BIT 0x80000000L
487 #define IS_CERT_EXCLUDED_SUBTREE(x) ((x) & CERT_EXCLUDED_SUBTREE_BIT)
489 typedef struct _CRYPT_ATTRIBUTE {
490 LPSTR pszObjId;
491 DWORD cValue;
492 PCRYPT_DATA_BLOB rgValue;
493 } CRYPT_ATTRIBUTE, *PCRYPT_ATTRIBUTE;
495 typedef struct _CRYPT_ATTRIBUTES {
496 DWORD cAttr;
497 PCRYPT_ATTRIBUTE rgAttr;
498 } CRYPT_ATTRIBUTES, *PCRYPT_ATTRIBUTES;
500 typedef struct _CERT_REQUEST_INFO {
501 DWORD dwVersion;
502 CERT_NAME_BLOB Subject;
503 CERT_PUBLIC_KEY_INFO SubjectPublicKeyInfo;
504 DWORD cAttribute;
505 PCRYPT_ATTRIBUTE rgAttribute;
506 } CERT_REQUEST_INFO, *PCERT_REQUEST_INFO;
508 typedef struct _CERT_KEYGEN_REQUEST_INFO {
509 DWORD dwVersion;
510 CERT_PUBLIC_KEY_INFO SubjectPubliceKeyInfo;
511 LPWSTR pwszChallengeString;
512 } CERT_KEYGEN_REQUEST_INFO, *PCERT_KEYGEN_REQUEST_INFO;
514 typedef struct _CERT_SIGNED_CONTENT_INFO {
515 CRYPT_DER_BLOB ToBeSigned;
516 CRYPT_ALGORITHM_IDENTIFIER SignatureAlgorithm;
517 CRYPT_BIT_BLOB Signature;
518 } CERT_SIGNED_CONTENT_INFO, *PCERT_SIGNED_CONTENT_INFO;
520 typedef struct _CRL_CONTEXT {
521 DWORD dwCertEncodingType;
522 BYTE *pbCrlEncoded;
523 DWORD cbCrlEncoded;
524 PCRL_INFO pCrlInfo;
525 HCERTSTORE hCertStore;
526 } CRL_CONTEXT, *PCRL_CONTEXT;
527 typedef const CRL_CONTEXT *PCCRL_CONTEXT;
529 typedef struct _VTableProvStruc {
530 DWORD Version;
531 FARPROC pFuncVerifyImage;
532 FARPROC pFuncReturnhWnd;
533 DWORD dwProvType;
534 BYTE *pbContextInfo;
535 DWORD cbContextInfo;
536 LPSTR pszProvName;
537 } VTableProvStruc, *PVTableProvStruc;
539 typedef struct _CERT_PRIVATE_KEY_INFO {
540 DWORD Version;
541 CRYPT_ALGORITHM_IDENTIFIER Algorithm;
542 CRYPT_DER_BLOB PrivateKey;
543 PCRYPT_ATTRIBUTES pAttributes;
544 } CERT_PRIVATE_KEY_INFO, *PCERT_PRIVATE_KEY_INFO;
546 typedef struct _CTL_USAGE {
547 DWORD cUsageIdentifier;
548 LPSTR *rgpszUsageIdentifier;
549 } CTL_USAGE, *PCTL_USAGE, CERT_ENHKEY_USAGE, *PCERT_ENHKEY_USAGE;
551 typedef struct _CTL_ENTRY {
552 CRYPT_DATA_BLOB SubjectIdentifier;
553 DWORD cAttribute;
554 PCRYPT_ATTRIBUTE rgAttribute;
555 } CTL_ENTRY, *PCTL_ENTRY;
557 typedef struct _CTL_INFO {
558 DWORD dwVersion;
559 CTL_USAGE SubjectUsage;
560 CRYPT_DATA_BLOB ListIdentifier;
561 CRYPT_INTEGER_BLOB SequenceNumber;
562 FILETIME ThisUpdate;
563 FILETIME NextUpdate;
564 CRYPT_ALGORITHM_IDENTIFIER SubjectAlgorithm;
565 DWORD cCTLEntry;
566 PCTL_ENTRY rgCTLEntry;
567 DWORD cExtension;
568 PCERT_EXTENSION rgExtension;
569 } CTL_INFO, *PCTL_INFO;
571 typedef struct _CTL_CONTEXT {
572 DWORD dwMsgAndCertEncodingType;
573 BYTE *pbCtlEncoded;
574 DWORD cbCtlEncoded;
575 PCTL_INFO pCtlInfo;
576 HCERTSTORE hCertStore;
577 HCRYPTMSG hCryptMsg;
578 BYTE *pbCtlContext;
579 DWORD cbCtlContext;
580 } CTL_CONTEXT, *PCTL_CONTEXT;
581 typedef const CTL_CONTEXT *PCCTL_CONTEXT;
583 typedef struct _CRYPT_TIME_STAMP_REQUEST_INFO {
584 LPSTR pszTimeStampAlgorithm;
585 LPSTR pszContentType;
586 CRYPT_OBJID_BLOB Content;
587 DWORD cAttribute;
588 PCRYPT_ATTRIBUTE rgAttribute;
589 } CRYPT_TIME_STAMP_REQUEST_INFO, *PCRYPT_TIME_STAMP_REQUEST_INFO;
591 typedef struct _CRYPT_ENROLLMENT_NAME_VALUE_PAIR {
592 LPWSTR pwszName;
593 LPWSTR pwszValue;
594 } CRYPT_ENROLLMENT_NAME_VALUE_PAIR, *PCRYPT_ENROLLMENT_NAME_VALUE_PAIR;
596 typedef struct _CMSG_SIGNER_INFO {
597 DWORD dwVersion;
598 CERT_NAME_BLOB Issuer;
599 CRYPT_INTEGER_BLOB SerialNumber;
600 CRYPT_ALGORITHM_IDENTIFIER HashAlgorithm;
601 CRYPT_ALGORITHM_IDENTIFIER HashEncryptionAlgorithm;
602 CRYPT_DATA_BLOB EncryptedHash;
603 CRYPT_ATTRIBUTES AuthAttrs;
604 CRYPT_ATTRIBUTES UnauthAttrs;
605 } CMSG_SIGNER_INFO, *PCMSG_SIGNER_INFO;
607 typedef struct _CERT_REVOCATION_CRL_INFO {
608 DWORD cbSize;
609 PCCRL_CONTEXT pBaseCrlContext;
610 PCCRL_CONTEXT pDeltaCrlContext;
611 PCRL_ENTRY pCrlEntry;
612 BOOL fDeltaCrlEntry;
613 } CERT_REVOCATION_CRL_INFO, *PCERT_REVOCATION_CRL_INFO;
615 typedef struct _CERT_REVOCATION_INFO {
616 DWORD cbSize;
617 DWORD dwRevocationResult;
618 LPCSTR pszRevocationOid;
619 LPVOID pvOidSpecificInfo;
620 BOOL fHasFreshnessTime;
621 DWORD dwFreshnessTime;
622 PCERT_REVOCATION_CRL_INFO pCrlInfo;
623 } CERT_REVOCATION_INFO, *PCERT_REVOCATION_INFO;
625 typedef struct _CERT_TRUST_LIST_INFO {
626 DWORD cbSize;
627 PCTL_ENTRY pCtlEntry;
628 PCCTL_CONTEXT pCtlContext;
629 } CERT_TRUST_LIST_INFO, *PCERT_TRUST_LIST_INFO;
631 typedef struct _CERT_TRUST_STATUS {
632 DWORD dwErrorStatus;
633 DWORD dwInfoStatus;
634 } CERT_TRUST_STATUS, *PCERT_TRUST_STATUS;
636 typedef struct _CERT_CHAIN_ELEMENT {
637 DWORD cbSize;
638 PCCERT_CONTEXT pCertContext;
639 CERT_TRUST_STATUS TrustStatus;
640 PCERT_REVOCATION_INFO pRevocationInfo;
641 PCERT_ENHKEY_USAGE pIssuanceUsage;
642 PCERT_ENHKEY_USAGE pApplicationUsage;
643 LPCWSTR pwszExtendedErrorInfo;
644 } CERT_CHAIN_ELEMENT, *PCERT_CHAIN_ELEMENT;
646 typedef struct _CERT_SIMPLE_CHAIN {
647 DWORD cbSize;
648 CERT_TRUST_STATUS TrustStatus;
649 DWORD cElement;
650 PCERT_CHAIN_ELEMENT *rgpElement;
651 PCERT_TRUST_LIST_INFO pTrustListInfo;
652 BOOL fHasRevocationFreshnessTime;
653 DWORD dwRevocationFreshnessTime;
654 } CERT_SIMPLE_CHAIN, *PCERT_SIMPLE_CHAIN;
656 typedef struct _CERT_CHAIN_CONTEXT CERT_CHAIN_CONTEXT, *PCERT_CHAIN_CONTEXT;
657 typedef const CERT_CHAIN_CONTEXT *PCCERT_CHAIN_CONTEXT;
659 struct _CERT_CHAIN_CONTEXT {
660 DWORD cbSize;
661 CERT_TRUST_STATUS TrustStatus;
662 DWORD cChain;
663 PCERT_SIMPLE_CHAIN *rgpChain;
664 DWORD cLowerQualityChainContext;
665 PCCERT_CHAIN_CONTEXT *rgbLowerQualityChainContext;
666 BOOL fHasRevocationFreshnessTime;
667 DWORD dwRevocationFreshnessTime;
670 typedef struct _CERT_CHAIN_POLICY_PARA {
671 DWORD cbSize;
672 DWORD dwFlags;
673 void *pvExtraPolicyPara;
674 } CERT_CHAIN_POLICY_PARA, *PCERT_CHAIN_POLICY_PARA;
676 typedef struct _CERT_CHAIN_POLICY_STATUS {
677 DWORD cbSize;
678 DWORD dwError;
679 LONG lChainIndex;
680 LONG lElementIndex;
681 void *pvExtraPolicyStatus;
682 } CERT_CHAIN_POLICY_STATUS, *PCERT_CHAIN_POLICY_STATUS;
684 typedef struct _CERT_SYSTEM_STORE_INFO {
685 DWORD cbSize;
686 } CERT_SYSTEM_STORE_INFO, *PCERT_SYSTEM_STORE_INFO;
688 typedef struct _CERT_PHYSICAL_STORE_INFO {
689 DWORD cbSize;
690 LPSTR pszOpenStoreProvider;
691 DWORD dwOpenEncodingType;
692 DWORD dwOpenFlags;
693 CRYPT_DATA_BLOB OpenParameters;
694 DWORD dwFlags;
695 DWORD dwPriority;
696 } CERT_PHYSICAL_STORE_INFO, *PCERT_PHYSICAL_STORE_INFO;
698 typedef struct _CERT_SYSTEM_STORE_RELOCATE_PARA {
699 union {
700 HKEY hKeyBase;
701 VOID *pvBase;
702 } DUMMYUNIONNAME;
703 union {
704 void *pvSystemStore;
705 LPCSTR pszSystemStore;
706 LPCWSTR pwszSystemStore;
707 } DUMMYUNIONNAME2;
708 } CERT_SYSTEM_STORE_RELOCATE_PARA, *PCERT_SYSTEM_STORE_RELOCATE_PARA;
710 typedef BOOL (WINAPI *PFN_CERT_ENUM_SYSTEM_STORE_LOCATION)(
711 LPCWSTR pwszStoreLocation, DWORD dwFlags, void *pvReserved, void *pvArg);
713 typedef BOOL (WINAPI *PFN_CERT_ENUM_SYSTEM_STORE)(const void *pvSystemStore,
714 DWORD dwFlags, PCERT_SYSTEM_STORE_INFO pStoreInfo, void *pvReserved,
715 void *pvArg);
717 typedef BOOL (WINAPI *PFN_CERT_ENUM_PHYSICAL_STORE)(const void *pvSystemStore,
718 DWORD dwFlags, LPCWSTR pwszStoreName, PCERT_PHYSICAL_STORE_INFO pStoreInfo,
719 void *pvReserved, void *pvArg);
721 /* Encode/decode object */
722 typedef LPVOID (WINAPI *PFN_CRYPT_ALLOC)(size_t cbsize);
723 typedef VOID (WINAPI *PFN_CRYPT_FREE)(LPVOID pv);
725 typedef struct _CRYPT_ENCODE_PARA {
726 DWORD cbSize;
727 PFN_CRYPT_ALLOC pfnAlloc;
728 PFN_CRYPT_FREE pfnFree;
729 } CRYPT_ENCODE_PARA, *PCRYPT_ENCODE_PARA;
731 typedef struct _CRYPT_DECODE_PARA {
732 DWORD cbSize;
733 PFN_CRYPT_ALLOC pfnAlloc;
734 PFN_CRYPT_FREE pfnFree;
735 } CRYPT_DECODE_PARA, *PCRYPT_DECODE_PARA;
737 typedef struct _CERT_STORE_PROV_INFO {
738 DWORD cbSize;
739 DWORD cStoreProvFunc;
740 void **rgpvStoreProvFunc;
741 HCERTSTOREPROV hStoreProv;
742 DWORD dwStoreProvFlags;
743 HCRYPTOIDFUNCADDR hStoreProvFuncAddr2;
744 } CERT_STORE_PROV_INFO, *PCERT_STORE_PROV_INFO;
746 typedef BOOL (WINAPI *PFN_CERT_DLL_OPEN_STORE_PROV_FUNC)(
747 LPCSTR lpszStoreProvider, DWORD dwEncodingType, HCRYPTPROV hCryptProv,
748 DWORD dwFlags, const void *pvPara, HCERTSTORE hCertStore,
749 PCERT_STORE_PROV_INFO pStoreProvInfo);
751 typedef void (WINAPI *PFN_CERT_STORE_PROV_CLOSE)(HCERTSTOREPROV hStoreProv,
752 DWORD dwFlags);
754 typedef BOOL (WINAPI *PFN_CERT_STORE_PROV_READ_CERT)(HCERTSTOREPROV hStoreProv,
755 PCCERT_CONTEXT pStoreCertContext, DWORD dwFlags,
756 PCCERT_CONTEXT *ppProvCertContext);
758 typedef BOOL (WINAPI *PFN_CERT_STORE_PROV_WRITE_CERT)(HCERTSTOREPROV hStoreProv,
759 PCCERT_CONTEXT pCertContext, DWORD dwFlags);
761 typedef BOOL (WINAPI *PFN_CERT_STORE_PROV_DELETE_CERT)(
762 HCERTSTOREPROV hStoreProv, PCCERT_CONTEXT pCertContext, DWORD dwFlags);
764 typedef BOOL (WINAPI *PFN_CERT_STORE_PROV_SET_CERT_PROPERTY)(
765 HCERTSTOREPROV hStoreProv, PCCERT_CONTEXT pCertContext, DWORD dwPropId,
766 DWORD dwFlags, const void *pvData);
768 typedef BOOL (WINAPI *PFN_CERT_STORE_PROV_READ_CRL)(HCERTSTOREPROV hStoreProv,
769 PCCRL_CONTEXT pStoreCrlContext, DWORD dwFlags,
770 PCCRL_CONTEXT *ppProvCrlContext);
772 typedef BOOL (WINAPI *PFN_CERT_STORE_PROV_WRITE_CRL)(HCERTSTOREPROV hStoreProv,
773 PCCRL_CONTEXT pCrlContext, DWORD dwFlags);
775 typedef BOOL (WINAPI *PFN_CERT_STORE_PROV_DELETE_CRL)(HCERTSTOREPROV hStoreProv,
776 PCCRL_CONTEXT pCrlContext, DWORD dwFlags);
778 typedef BOOL (WINAPI *PFN_CERT_STORE_PROV_SET_CRL_PROPERTY)(
779 HCERTSTOREPROV hStoreProv, PCCRL_CONTEXT pCrlContext, DWORD dwPropId,
780 DWORD dwFlags, const void *pvData);
782 typedef BOOL (WINAPI *PFN_CERT_STORE_PROV_READ_CTL)(HCERTSTOREPROV hStoreProv,
783 PCCTL_CONTEXT pStoreCtlContext, DWORD dwFlags,
784 PCCTL_CONTEXT *ppProvCtlContext);
786 typedef BOOL (WINAPI *PFN_CERT_STORE_PROV_WRITE_CTL)(HCERTSTOREPROV hStoreProv,
787 PCCTL_CONTEXT pCtlContext, DWORD dwFlags);
789 typedef BOOL (WINAPI *PFN_CERT_STORE_PROV_DELETE_CTL)(
790 HCERTSTOREPROV hStoreProv, PCCTL_CONTEXT pCtlContext, DWORD dwFlags);
792 typedef BOOL (WINAPI *PFN_CERT_STORE_PROV_SET_CTL_PROPERTY)(
793 HCERTSTOREPROV hStoreProv, PCCTL_CONTEXT pCtlContext, DWORD dwPropId,
794 DWORD dwFlags, const void *pvData);
796 typedef BOOL (WINAPI *PFN_CERT_STORE_PROV_CONTROL)(HCERTSTOREPROV hStoreProv,
797 DWORD dwFlags, DWORD dwCtrlType, void const *pvCtrlPara);
799 typedef struct _CERT_STORE_PROV_FIND_INFO {
800 DWORD cbSize;
801 DWORD dwMsgAndCertEncodingType;
802 DWORD dwFindFlags;
803 DWORD dwFindType;
804 const void *pvFindPara;
805 } CERT_STORE_PROV_FIND_INFO, *PCERT_STORE_PROV_FIND_INFO;
806 typedef const CERT_STORE_PROV_FIND_INFO CCERT_STORE_PROV_FIND_INFO,
807 *PCCERT_STORE_PROV_FIND_INFO;
809 typedef BOOL (WINAPI *PFN_CERT_STORE_PROV_FIND_CERT)(HCERTSTOREPROV hStoreProv,
810 PCCERT_STORE_PROV_FIND_INFO pFindInfo, PCCERT_CONTEXT pPrevCertContext,
811 DWORD dwFlags, void **ppvStoreProvFindInfo, PCCERT_CONTEXT *ppProvCertContext);
813 typedef BOOL (WINAPI *PFN_CERT_STORE_PROV_FREE_FIND_CERT)(
814 HCERTSTOREPROV hStoreProv, PCCERT_CONTEXT pCertContext,
815 void *pvStoreProvFindInfo, DWORD dwFlags);
817 typedef BOOL (WINAPI *PFN_CERT_STORE_PROV_GET_CERT_PROPERTY)(
818 HCERTSTOREPROV hStoreProv, PCCERT_CONTEXT pCertContext, DWORD dwPropId,
819 DWORD dwFlags, void *pvData, DWORD *pcbData);
821 typedef BOOL (WINAPI *PFN_CERT_STORE_PROV_FIND_CRL)(HCERTSTOREPROV hStoreProv,
822 PCCERT_STORE_PROV_FIND_INFO pFindInfo, PCCRL_CONTEXT pPrevCrlContext,
823 DWORD dwFlags, void **ppvStoreProvFindInfo, PCCRL_CONTEXT *ppProvCrlContext);
825 typedef BOOL (WINAPI *PFN_CERT_STORE_PROV_FREE_FIND_CRL)(
826 HCERTSTOREPROV hStoreProv, PCCRL_CONTEXT pCrlContext,
827 void *pvStoreProvFindInfo, DWORD dwFlags);
829 typedef BOOL (WINAPI *PFN_CERT_STORE_PROV_GET_CRL_PROPERTY)(
830 HCERTSTOREPROV hStoreProv, PCCRL_CONTEXT pCrlContext, DWORD dwPropId,
831 DWORD dwFlags, void *pvData, DWORD *pcbData);
833 typedef BOOL (WINAPI *PFN_CERT_STORE_PROV_FIND_CTL)(HCERTSTOREPROV hStoreProv,
834 PCCTL_CONTEXT pCtlContext, void *pvStoreProvFindInfo, DWORD dwFlags);
836 typedef BOOL (WINAPI *PFN_CERT_STORE_PROV_GET_CTL_PROPERTY)(
837 HCERTSTOREPROV hStoreProv, PCCTL_CONTEXT pCtlContext, DWORD dwPropId,
838 DWORD dwFlags, void *pvData);
840 typedef struct _CERT_CREATE_CONTEXT_PARA {
841 DWORD cbSize;
842 PFN_CRYPT_FREE pfnFree;
843 void *pvFree;
844 } CERT_CREATE_CONTEXT_PARA, *PCERT_CREATE_CONTEXT_PARA;
846 /* Algorithm IDs */
848 #define GET_ALG_CLASS(x) (x & (7 << 13))
849 #define GET_ALG_TYPE(x) (x & (15 << 9))
850 #define GET_ALG_SID(x) (x & (511))
852 /* Algorithm Classes */
853 #define ALG_CLASS_ANY (0)
854 #define ALG_CLASS_SIGNATURE (1 << 13)
855 #define ALG_CLASS_MSG_ENCRYPT (2 << 13)
856 #define ALG_CLASS_DATA_ENCRYPT (3 << 13)
857 #define ALG_CLASS_HASH (4 << 13)
858 #define ALG_CLASS_KEY_EXCHANGE (5 << 13)
859 /* Algorithm types */
860 #define ALG_TYPE_ANY (0)
861 #define ALG_TYPE_DSS (1 << 9)
862 #define ALG_TYPE_RSA (2 << 9)
863 #define ALG_TYPE_BLOCK (3 << 9)
864 #define ALG_TYPE_STREAM (4 << 9)
865 #define ALG_TYPE_DH (5 << 9)
866 #define ALG_TYPE_SECURECHANNEL (6 << 9)
868 /* SIDs */
869 #define ALG_SID_ANY (0)
870 /* RSA SIDs */
871 #define ALG_SID_RSA_ANY 0
872 #define ALG_SID_RSA_PKCS 1
873 #define ALG_SID_RSA_MSATWORK 2
874 #define ALG_SID_RSA_ENTRUST 3
875 #define ALG_SID_RSA_PGP 4
876 /* DSS SIDs */
877 #define ALG_SID_DSS_ANY 0
878 #define ALG_SID_DSS_PKCS 1
879 #define ALG_SID_DSS_DMS 2
881 /* DES SIDs */
882 #define ALG_SID_DES 1
883 #define ALG_SID_3DES 3
884 #define ALG_SID_DESX 4
885 #define ALG_SID_IDEA 5
886 #define ALG_SID_CAST 6
887 #define ALG_SID_SAFERSK64 7
888 #define ALG_SID_SAFERSK128 8
889 #define ALG_SID_3DES_112 9
890 /* Diffie-Hellmans SIDs */
891 #define ALG_SID_DH_SANDF 1
892 #define ALG_SID_DH_EPHEM 2
893 #define ALG_SID_AGREED_KEY_ANY 3
894 #define ALG_SID_KEA 4
895 /* RC2 SIDs */
896 #define ALG_SID_RC4 1
897 #define ALG_SID_RC2 2
898 #define ALG_SID_SEAL 2
899 /* Hash SIDs */
900 #define ALG_SID_MD2 1
901 #define ALG_SID_MD4 2
902 #define ALG_SID_MD5 3
903 #define ALG_SID_SHA 4
904 #define ALG_SID_SHA1 CALG_SHA
905 #define ALG_SID_MAC 5
906 #define ALG_SID_RIPEMD 6
907 #define ALG_SID_RIPEMD160 7
908 #define ALG_SID_SSL3SHAMD5 8
909 #define ALG_SID_HMAC 9
910 #define ALG_SID_TLS1PRF 10
911 /* SCHANNEL SIDs */
912 #define ALG_SID_SSL3_MASTER 1
913 #define ALG_SID_SCHANNEL_MASTER_HASH 2
914 #define ALG_SID_SCHANNEL_MAC_KEY 3
915 #define ALG_SID_PCT1_MASTER 4
916 #define ALG_SID_SSL2_MASTER 5
917 #define ALG_SID_TLS1_MASTER 6
918 #define ALG_SID_SCHANNEL_ENC_KEY 7
919 #define ALG_SID_EXAMPLE 80
921 /* Algorithm Definitions */
922 #define CALG_MD2 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MD2)
923 #define CALG_MD4 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MD4)
924 #define CALG_MD5 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MD5)
925 #define CALG_SHA (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA)
926 #define CALG_SHA1 CALG_SHA
927 #define CALG_MAC (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MAC)
928 #define CALG_SSL3_SHAMD5 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SSL3SHAMD5)
929 #define CALG_HMAC (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_HMAC)
930 #define CALG_TLS1PRF (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_TLS1PRF)
931 #define CALG_RSA_SIGN (ALG_CLASS_SIGNATURE | ALG_TYPE_RSA | ALG_SID_RSA_ANY)
932 #define CALG_DSS_SIGN (ALG_CLASS_SIGNATURE | ALG_TYPE_DSS | ALG_SID_DSS_ANY)
933 #define CALG_DH_SF (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_DH | ALG_SID_DH_SANDF)
934 #define CALG_DH_EPHEM (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_DH | ALG_SID_DH_EPHEM)
935 #define CALG_RSA_KEYX (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_RSA | ALG_SID_RSA_ANY)
936 #define CALG_DES (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_DES)
937 #define CALG_RC2 (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_RC2)
938 #define CALG_3DES (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_3DES)
939 #define CALG_3DES_112 (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_3DES_112)
940 #define CALG_RC4 (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_STREAM | ALG_SID_RC4)
941 #define CALG_SEAL (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_STREAM | ALG_SID_SEAL)
942 #define CALG_SSL3_MASTER (ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL | ALG_SID_SSL3_MASTER)
943 #define CALG_SCHANNEL_MASTER_HASH (ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL | ALG_SID_SCHANNEL_MASTER_HASH)
944 #define CALG_SCHANNEL_MAC_KEY (ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL | ALG_SID_SCHANNEL_MAC_KEY)
945 #define CALG_SCHANNEL_ENC_KEY (ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL | ALG_SID_SCHANNEL_ENC_KEY)
946 #define CALG_PCT1_MASTER (ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL | ALG_SID_PCT1_MASTER)
947 #define CALG_SSL2_MASTER (ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL | ALG_SID_SSL2_MASTER)
948 #define CALG_TLS1_MASTER (ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL | ALG_SID_TLS1_MASTER)
950 /* Protocol Flags */
951 #define CRYPT_FLAG_PCT1 0x0001
952 #define CRYPT_FLAG_SSL2 0x0002
953 #define CRYPT_FLAG_SSL3 0x0004
954 #define CRYPT_FLAG_TLS1 0x0008
955 #define CRYPT_FLAG_IPSEC 0x0010
956 #define CRYPT_FLAG_SIGNING 0x0020
958 /* Provider names */
959 #define MS_DEF_PROV_A "Microsoft Base Cryptographic Provider v1.0"
960 #if defined(__GNUC__)
961 # define MS_DEF_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
962 'B','a','s','e',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ', \
963 'P','r','o','v','i','d','e','r',' ','v','1','.','0',0 }
964 #elif defined(_MSC_VER)
965 # define MS_DEF_PROV_W L"Microsoft Base Cryptographic Provider v1.0"
966 #else
967 static const WCHAR MS_DEF_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
968 'B','a','s','e',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ',
969 'P','r','o','v','i','d','e','r',' ','v','1','.','0',0 };
970 #endif
971 #define MS_DEF_PROV WINELIB_NAME_AW(MS_DEF_PROV_)
973 #define MS_ENHANCED_PROV_A "Microsoft Enhanced Cryptographic Provider v1.0"
974 #if defined(__GNUC__)
975 # define MS_ENHANCED_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
976 'E','n','h','a','n','c','e','d',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ', \
977 'P','r','o','v','i','d','e','r',' ','v','1','.','0',0 }
978 #elif defined(_MSC_VER)
979 # define MS_ENHANCED_PROV_W L"Microsoft Enhanced Cryptographic Provider v1.0"
980 #else
981 static const WCHAR MS_ENHANCED_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
982 'E','n','h','a','n','c','e','d',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ',
983 'P','r','o','v','i','d','e','r',' ','v','1','.','0',0 };
984 #endif
985 #define MS_ENHANCED_PROV WINELIB_NAME_AW(MS_ENHANCED_PROV_)
987 #define MS_STRONG_PROV_A "Microsoft Strong Cryptographic Provider"
988 #if defined(__GNUC__)
989 # define MS_STRONG_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
990 'S','t','r','o','n','g',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ', \
991 'P','r','o','v','i','d','e','r',0 }
992 #elif defined(_MSC_VER)
993 # define MS_STRONG_PROV_W L"Microsoft Strong Cryptographic Provider"
994 #else
995 static const WCHAR MS_STRONG_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
996 'S','t','r','o','n','g',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ',
997 'P','r','o','v','i','d','e','r',0 };
998 #endif
999 #define MS_STRONG_PROV WINELIB_NAME_AW(MS_STRONG_PROV_)
1001 #define MS_DEF_RSA_SIG_PROV_A "Microsoft RSA Signature Cryptographic Provider"
1002 #if defined(__GNUC__)
1003 # define MS_DEF_RSA_SIG_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
1004 'R','S','A',' ','S','i','g','n','a','t','u','r','e',' ', \
1005 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
1006 #elif defined(_MSC_VER)
1007 # define MS_DEF_RSA_SIG_PROV_W L"Microsoft RSA Signature Cryptographic Provider"
1008 #else
1009 static const WCHAR MS_DEF_RSA_SIG_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
1010 'R','S','A',' ','S','i','g','n','a','t','u','r','e',' ',
1011 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
1012 #endif
1013 #define MS_DEF_RSA_SIG_PROV WINELIB_NAME_AW(MS_DEF_RSA_SIG_PROV_)
1015 #define MS_DEF_RSA_SCHANNEL_PROV_A "Microsoft RSA SChannel Cryptographic Provider"
1016 #if defined(__GNUC__)
1017 # define MS_DEF_RSA_SCHANNEL_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
1018 'R','S','A',' ','S','C','h','a','n','n','e','l',' ', \
1019 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
1020 #elif defined(_MSC_VER)
1021 # define MS_DEF_RSA_SCHANNEL_PROV_W L"Microsoft RSA SChannel Cryptographic Provider"
1022 #else
1023 static const WCHAR MS_DEF_RSA_SCHANNEL_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
1024 'R','S','A',' ','S','C','h','a','n','n','e','l',' ',
1025 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
1026 #endif
1027 #define MS_DEF_RSA_SCHANNEL_PROV WINELIB_NAME_AW(MS_DEF_RSA_SCHANNEL_PROV_)
1029 #define MS_DEF_DSS_PROV_A "Microsoft Base DSS Cryptographic Provider"
1030 #if defined(__GNUC__)
1031 # define MS_DEF_DSS_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
1032 'B','a','s','e',' ','D','S','S',' ', \
1033 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
1034 #elif defined(_MSC_VER)
1035 # define MS_DEF_DSS_PROV_W L"Microsoft Base DSS Cryptographic Provider"
1036 #else
1037 static const WCHAR MS_DEF_DSS_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
1038 'B','a','s','e',' ','D','S','S',' ',
1039 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
1040 #endif
1041 #define MS_DEF_DSS_PROV WINELIB_NAME_AW(MS_DEF_DSS_PROV_)
1043 #define MS_DEF_DSS_DH_PROV_A "Microsoft Base DSS and Diffie-Hellman Cryptographic Provider"
1044 #if defined(__GNUC__)
1045 # define MS_DEF_DSS_DH_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
1046 'B','a','s','e',' ','D','S','S',' ','a','n','d',' ', \
1047 'D','i','f','f','i','e','-','H','e','l','l','m','a','n',' ', \
1048 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
1049 #elif defined(_MSC_VER)
1050 # define MS_DEF_DSS_DH_PROV_W L"Microsoft Base DSS and Diffie-Hellman Cryptographic Provider"
1051 #else
1052 static const WCHAR MS_DEF_DSS_DH_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
1053 'B','a','s','e',' ','D','S','S',' ','a','n','d',' ',
1054 'D','i','f','f','i','e','-','H','e','l','l','m','a','n',' ',
1055 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
1056 #endif
1057 #define MS_DEF_DSS_DH_PROV WINELIB_NAME_AW(MS_DEF_DSS_DH_PROV_)
1059 #define MS_ENH_DSS_DH_PROV_A "Microsoft Enhanced DSS and Diffie-Hellman Cryptographic Provider"
1060 #if defined(__GNUC__)
1061 # define MS_ENH_DSS_DH_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
1062 'E','n','h','a','n','c','e','d',' ','D','S','S',' ','a','n','d',' ', \
1063 'D','i','f','f','i','e','-','H','e','l','l','m','a','n',' ', \
1064 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
1065 #elif defined(_MSC_VER)
1066 # define MS_ENH_DSS_DH_PROV_W L"Microsoft Enhanced DSS and Diffie-Hellman Cryptographic Provider"
1067 #else
1068 static const WCHAR MS_ENH_DSS_DH_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
1069 'E','n','h','a','n','c','e','d',' ','D','S','S',' ','a','n','d',' ',
1070 'D','i','f','f','i','e','-','H','e','l','l','m','a','n',' ',
1071 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
1072 #endif
1073 #define MS_ENH_DSS_DH_PROV WINELIB_NAME_AW(MS_ENH_DSS_DH_PROV_)
1075 #define MS_DEF_DH_SCHANNEL_PROV_A "Microsoft DH SChannel Cryptographic Provider"
1076 #if defined(__GNUC__)
1077 # define MS_DEF_DH_SCHANNEL_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
1078 'D','H',' ','S','C','h','a','n','n','e','l',' ', \
1079 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
1080 #elif defined(_MSC_VER)
1081 # define MS_DEF_DH_SCHANNEL_PROV_W L"Microsoft DH SChannel Cryptographic Provider"
1082 #else
1083 static const WCHAR MS_DEF_DH_SCHANNEL_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
1084 'D','H',' ','S','C','h','a','n','n','e','l',' ',
1085 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
1086 #endif
1087 #define MS_DEF_DH_SCHANNEL_PROV WINELIB_NAME_AW(MS_DEF_DH_SCHANNEL_PROV_)
1089 #define MS_SCARD_PROV_A "Microsoft Base Smart Card Cryptographic Provider"
1090 #if defined(__GNUC__)
1091 # define MS_SCARD_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
1092 'B','a','s','e',' ','S','m','a','r','t',' ','C','a','r','d',' ', \
1093 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
1094 #elif defined(_MSC_VER)
1095 # define MS_SCARD_PROV_W L"Microsoft Base Smart Card Cryptographic Provider"
1096 #else
1097 static const WCHAR MS_SCARD_PROV_W[] = { 'M','i','c','r','o','s','o','f','t',' ',
1098 'B','a','s','e',' ','S','m','a','r','t',' ','C','a','r','d',' ',
1099 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
1100 #endif
1101 #define MS_SCARD_PROV WINELIB_NAME_AW(MS_SCARD_PROV_)
1103 /* Key Specs*/
1104 #define AT_KEYEXCHANGE 1
1105 #define AT_SIGNATURE 2
1107 /* Provider Types */
1108 #define PROV_RSA_FULL 1
1109 #define PROV_RSA_SIG 2
1110 #define PROV_DSS 3
1111 #define PROV_FORTEZZA 4
1112 #define PROV_MS_EXCHANGE 5
1113 #define PROV_SSL 6
1114 #define PROV_RSA_SCHANNEL 12
1115 #define PROV_DSS_DH 13
1116 #define PROV_EC_ECDSA_SIG 14
1117 #define PROV_EC_ECNRA_SIG 15
1118 #define PROV_EC_ECDSA_FULL 16
1119 #define PROV_EC_ECNRA_FULL 17
1120 #define PROV_DH_SCHANNEL 18
1121 #define PROV_SPYRUS_LYNKS 20
1122 #define PROV_RNG 21
1123 #define PROV_INTEL_SEC 22
1124 #define PROV_REPLACE_OWF 23
1125 #define PROV_RSA_AES 24
1127 /* FLAGS Section */
1129 /* Provider Parameters */
1130 #define PP_ENUMALGS 1
1131 #define PP_ENUMCONTAINERS 2
1132 #define PP_IMPTYPE 3
1133 #define PP_NAME 4
1134 #define PP_VERSION 5
1135 #define PP_CONTAINER 6
1137 #define CRYPT_FIRST 1
1138 #define CRYPT_NEXT 2
1140 #define CRYPT_IMPL_HARDWARE 1
1141 #define CRYPT_IMPL_SOFTWARE 2
1142 #define CRYPT_IMPL_MIXED 3
1143 #define CRYPT_IMPL_UNKNOWN 4
1145 /* CryptAcquireContext */
1146 #define CRYPT_VERIFYCONTEXT 0xF0000000
1147 #define CRYPT_NEWKEYSET 0x00000008
1148 #define CRYPT_DELETEKEYSET 0x00000010
1149 #define CRYPT_MACHINE_KEYSET 0x00000020
1150 #define CRYPT_SILENT 0x00000040
1152 /* Crypt{Get|Set}Provider */
1153 #define CRYPT_MACHINE_DEFAULT 0x00000001
1154 #define CRYPT_USER_DEFAULT 0x00000002
1155 #define CRYPT_DELETE_DEFAULT 0x00000004
1157 /* Crypt{Get/Set}ProvParam */
1158 #define PP_CLIENT_HWND 1
1159 #define PP_ENUMALGS 1
1160 #define PP_ENUMCONTAINERS 2
1161 #define PP_IMPTYPE 3
1162 #define PP_NAME 4
1163 #define PP_VERSION 5
1164 #define PP_CONTAINER 6
1165 #define PP_CHANGE_PASSWORD 7
1166 #define PP_KEYSET_SEC_DESCR 8
1167 #define PP_KEY_TYPE_SUBTYPE 10
1168 #define PP_CONTEXT_INFO 11
1169 #define PP_KEYEXCHANGE_KEYSIZE 12
1170 #define PP_SIGNATURE_KEYSIZE 13
1171 #define PP_KEYEXCHANGE_ALG 14
1172 #define PP_SIGNATURE_ALG 15
1173 #define PP_PROVTYPE 16
1174 #define PP_KEYSTORAGE 17
1175 #define PP_SYM_KEYSIZE 19
1176 #define PP_SESSION_KEYSIZE 20
1177 #define PP_UI_PROMPT 21
1178 #define PP_ENUMALGS_EX 22
1179 #define PP_DELETEKEY 24
1180 #define PP_ENUMMANDROOTS 25
1181 #define PP_ENUMELECTROOTS 26
1182 #define PP_KEYSET_TYPE 27
1183 #define PP_ADMIN_PIN 31
1184 #define PP_KEYEXCHANGE_PIN 32
1185 #define PP_SIGNATURE_PIN 33
1186 #define PP_SIG_KEYSIZE_INC 34
1187 #define PP_KEYX_KEYSIZE_INC 35
1188 #define PP_UNIQUE_CONTAINER 36
1189 #define PP_SGC_INFO 37
1190 #define PP_USE_HARDWARE_RNG 38
1191 #define PP_KEYSPEC 39
1192 #define PP_ENUMEX_SIGNING_PROT 40
1194 /* Crypt{Get/Set}KeyParam */
1195 #define KP_IV 1
1196 #define KP_SALT 2
1197 #define KP_PADDING 3
1198 #define KP_MODE 4
1199 #define KP_MODE_BITS 5
1200 #define KP_PERMISSIONS 6
1201 #define KP_ALGID 7
1202 #define KP_BLOCKLEN 8
1203 #define KP_KEYLEN 9
1204 #define KP_SALT_EX 10
1205 #define KP_P 11
1206 #define KP_G 12
1207 #define KP_Q 13
1208 #define KP_X 14
1209 #define KP_Y 15
1210 #define KP_RA 16
1211 #define KP_RB 17
1212 #define KP_INFO 18
1213 #define KP_EFFECTIVE_KEYLEN 19
1214 #define KP_SCHANNEL_ALG 20
1215 #define KP_CLIENT_RANDOM 21
1216 #define KP_SERVER_RANDOM 22
1217 #define KP_RP 23
1218 #define KP_PRECOMP_MD5 24
1219 #define KP_PRECOMP_SHA 25
1220 #define KP_CERTIFICATE 26
1221 #define KP_CLEAR_KEY 27
1222 #define KP_PUB_EX_LEN 28
1223 #define KP_PUB_EX_VAL 29
1224 #define KP_KEYVAL 30
1225 #define KP_ADMIN_PIN 31
1226 #define KP_KEYEXCHANGE_PIN 32
1227 #define KP_SIGNATURE_PIN 33
1228 #define KP_PREHASH 34
1230 /* CryptSignHash/CryptVerifySignature */
1231 #define CRYPT_NOHASHOID 0x00000001
1232 #define CRYPT_TYPE2_FORMAT 0x00000002
1233 #define CRYPT_X931_FORMAT 0x00000004
1235 /* Crypt{Get,Set}HashParam */
1236 #define HP_ALGID 0x0001
1237 #define HP_HASHVAL 0x0002
1238 #define HP_HASHSIZE 0x0004
1239 #define HP_HMAC_INFO 0x0005
1240 #define HP_TLS1PRF_LABEL 0x0006
1241 #define HP_TLS1PRF_SEED 0x0007
1243 /* Crypt{Get,Set}KeyParam */
1244 #define CRYPT_MODE_CBC 1
1245 #define CRYPT_MODE_ECB 2
1246 #define CRYPT_MODE_OFB 3
1247 #define CRYPT_MODE_CFB 4
1249 #define CRYPT_ENCRYPT 0x0001
1250 #define CRYPT_DECRYPT 0x0002
1251 #define CRYPT_EXPORT 0x0004
1252 #define CRYPT_READ 0x0008
1253 #define CRYPT_WRITE 0x0010
1254 #define CRYPT_MAC 0x0020
1256 /* Crypt*Key */
1257 #define CRYPT_EXPORTABLE 0x00000001
1258 #define CRYPT_USER_PROTECTED 0x00000002
1259 #define CRYPT_CREATE_SALT 0x00000004
1260 #define CRYPT_UPDATE_KEY 0x00000008
1261 #define CRYPT_NO_SALT 0x00000010
1262 #define CRYPT_PREGEN 0x00000040
1263 #define CRYPT_SERVER 0x00000400
1264 #define CRYPT_ARCHIVABLE 0x00004000
1266 /* CryptExportKey */
1267 #define CRYPT_SSL2_FALLBACK 0x00000002
1268 #define CRYPT_DESTROYKEY 0x00000004
1269 #define CRYPT_OAEP 0x00000040
1271 /* CryptHashSessionKey */
1272 #define CRYPT_LITTLE_ENDIAN 0x00000001
1274 /* Crypt{Protect,Unprotect}Data PROMPTSTRUCT flags */
1275 #define CRYPTPROTECT_PROMPT_ON_PROTECT 0x0001
1276 #define CRYPTPROTECT_PROMPT_ON_UNPROTECT 0x0002
1277 /* Crypt{Protect,Unprotect}Data flags */
1278 #define CRYPTPROTECT_UI_FORBIDDEN 0x0001
1279 #define CRYPTPROTECT_LOCAL_MACHINE 0x0004
1280 #define CRYPTPROTECT_AUDIT 0x0010
1281 #define CRYPTPROTECT_VERIFY_PROTECTION 0x0040
1283 /* Blob Types */
1284 #define SIMPLEBLOB 0x1
1285 #define PUBLICKEYBLOB 0x6
1286 #define PRIVATEKEYBLOB 0x7
1287 #define PLAINTEXTKEYBLOB 0x8
1288 #define OPAQUEKEYBLOB 0x9
1289 #define PUBLICKEYBLOBEX 0xA
1290 #define SYMMETRICWRAPKEYBLOB 0xB
1292 #define CUR_BLOB_VERSION 2
1294 /* cert store provider types */
1295 #define CERT_STORE_PROV_MSG ((LPCSTR)1)
1296 #define CERT_STORE_PROV_MEMORY ((LPCSTR)2)
1297 #define CERT_STORE_PROV_FILE ((LPCSTR)3)
1298 #define CERT_STORE_PROV_REG ((LPCSTR)4)
1299 #define CERT_STORE_PROV_PKCS7 ((LPCSTR)5)
1300 #define CERT_STORE_PROV_SERIALIZED ((LPCSTR)6)
1301 #define CERT_STORE_PROV_FILENAME_A ((LPCSTR)7)
1302 #define CERT_STORE_PROV_FILENAME_W ((LPCSTR)8)
1303 #define CERT_STORE_PROV_SYSTEM_A ((LPCSTR)9)
1304 #define CERT_STORE_PROV_SYSTEM_W ((LPCSTR)10)
1305 #define CERT_STORE_PROV_SYSTEM CERT_STORE_PROV_SYSTEM_W
1306 #define CERT_STORE_PROV_COLLECTION ((LPCSTR)11)
1307 #define CERT_STORE_PROV_SYSTEM_REGISTRY_A ((LPCSTR)12)
1308 #define CERT_STORE_PROV_SYSTEM_REGISTRY_W ((LPCSTR)13)
1309 #define CERT_STORE_PROV_SYSTEM_REGISTRY CERT_STORE_PROV_SYSTEM_REGISTRY_W
1310 #define CERT_STORE_PROV_PHYSICAL_W ((LPCSTR)14)
1311 #define CERT_STORE_PROV_PHYSICAL CERT_STORE_PROV_PHYSICAL_W
1312 #define CERT_STORE_PROV_SMART_CARD_W ((LPCSTR)15)
1313 #define CERT_STORE_PROV_SMART_CARD CERT_STORE_PROV_SMART_CARD_W
1314 #define CERT_STORE_PROV_LDAP_W ((LPCSTR)16)
1315 #define CERT_STORE_PROV_LDAP CERT_STORE_PROV_LDAP_W
1317 #define sz_CERT_STORE_PROV_MEMORY "Memory"
1318 #define sz_CERT_STORE_PROV_FILENAME_W "File"
1319 #define sz_CERT_STORE_PROV_FILENAME sz_CERT_STORE_PROV_FILENAME_W
1320 #define sz_CERT_STORE_PROV_SYSTEM_W "System"
1321 #define sz_CERT_STORE_PROV_SYSTEM sz_CERT_STORE_PROV_SYSTEM_W
1322 #define sz_CERT_STORE_PROV_PKCS7 "PKCS7"
1323 #define sz_CERT_STORE_PROV_SERIALIZED "Serialized"
1324 #define sz_CERT_STORE_PROV_COLLECTION "Collection"
1325 #define sz_CERT_STORE_PROV_SYSTEM_REGISTRY_W "SystemRegistry"
1326 #define sz_CERT_STORE_PROV_SYSTEM_REGISTRY sz_CERT_STORE_PROV_SYSTEM_REGISTRY_W
1327 #define sz_CERT_STORE_PROV_PHYSICAL_W "Physical"
1328 #define sz_CERT_STORE_PROV_PHYSICAL sz_CERT_STORE_PROV_PHYSICAL_W
1329 #define sz_CERT_STORE_PROV_SMART_CARD_W "SmartCard"
1330 #define sz_CERT_STORE_PROV_SMART_CARD sz_CERT_STORE_PROV_SMART_CARD_W
1331 #define sz_CERT_STORE_PROV_LDAP_W "Ldap"
1332 #define sz_CERT_STORE_PROV_LDAP sz_CERT_STORE_PROV_LDAP_W
1334 /* types for CertOpenStore dwEncodingType */
1335 #define CERT_ENCODING_TYPE_MASK 0x0000ffff
1336 #define CMSG_ENCODING_TYPE_MASK 0xffff0000
1337 #define GET_CERT_ENCODING_TYPE(x) ((x) & CERT_ENCODING_TYPE_MASK)
1338 #define GET_CMSG_ENCODING_TYPE(x) ((x) & CMSG_ENCODING_TYPE_MASK)
1340 #define CRYPT_ASN_ENCODING 0x00000001
1341 #define CRYPT_NDR_ENCODING 0x00000002
1342 #define X509_ASN_ENCODING 0x00000001
1343 #define X509_NDR_ENCODING 0x00000002
1344 #define PKCS_7_ASN_ENCODING 0x00010000
1345 #define PKCS_7_NDR_ENCODING 0x00020000
1347 /* system store locations */
1348 #define CERT_SYSTEM_STORE_LOCATION_MASK 0x00ff0000
1349 #define CERT_SYSTEM_STORE_LOCATION_SHIFT 16
1351 /* system store location ids */
1352 /* hkcu */
1353 #define CERT_SYSTEM_STORE_CURRENT_USER_ID 1
1354 /* hklm */
1355 #define CERT_SYSTEM_STORE_LOCAL_MACHINE_ID 2
1356 /* hklm\Software\Microsoft\Cryptography\Services */
1357 #define CERT_SYSTEM_STORE_CURRENT_SERVICE_ID 4
1358 #define CERT_SYSTEM_STORE_SERVICES_ID 5
1359 /* HKEY_USERS */
1360 #define CERT_SYSTEM_STORE_USERS_ID 6
1361 /* hkcu\Software\Policies\Microsoft\SystemCertificates */
1362 #define CERT_SYSTEM_STORE_CURRENT_USER_GROUP_POLICY_ID 7
1363 /* hklm\Software\Policies\Microsoft\SystemCertificates */
1364 #define CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY_ID 8
1365 /* hklm\Software\Microsoft\EnterpriseCertificates */
1366 #define CERT_SYSTEM_STORE_LOCAL_MACHINE_ENTERPRISE_ID 9
1368 /* system store location values */
1369 #define CERT_SYSTEM_STORE_CURRENT_USER \
1370 (CERT_SYSTEM_STORE_CURRENT_USER_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
1371 #define CERT_SYSTEM_STORE_LOCAL_MACHINE \
1372 (CERT_SYSTEM_STORE_LOCAL_MACHINE_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
1373 #define CERT_SYSTEM_STORE_CURRENT_SERVICE \
1374 (CERT_SYSTEM_STORE_CURRENT_SERVICE_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
1375 #define CERT_SYSTEM_STORE_SERVICES \
1376 (CERT_SYSTEM_STORE_SERVICES_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
1377 #define CERT_SYSTEM_STORE_USERS \
1378 (CERT_SYSTEM_STORE_USERS_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
1379 #define CERT_SYSTEM_STORE_CURRENT_USER_GROUP_POLICY \
1380 (CERT_SYSTEM_STORE_CURRENT_USER_GROUP_POLICY_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
1381 #define CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY \
1382 (CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
1383 #define CERT_SYSTEM_STORE_LOCAL_MACHINE_ENTERPRISE \
1384 (CERT_SYSTEM_STORE_LOCAL_MACHINE_ENTERPRISE_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
1386 #if defined(__GNUC__)
1387 #define CERT_LOCAL_MACHINE_SYSTEM_STORE_REGPATH (const WCHAR[])\
1388 {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t',\
1389 '\\','S','y','s','t','e','m','C','e','r','t','i','f','i','c','a','t','e','s',\
1391 #define CERT_GROUP_POLICY_SYSTEM_STORE_REGPATH (const WCHAR[])\
1392 {'S','o','f','t','w','a','r','e','\\','P','o','l','i','c','i','e','s','\\',\
1393 'M','i','c','r','o','s','o','f','t','\\','S','y','s','t','e','m','C','e','r',\
1394 't','i','f','i','c','a','t','e','s',0 }
1395 #elif defined(_MSC_VER)
1396 #define CERT_LOCAL_MACHINE_SYSTEM_STORE_REGPATH \
1397 L"Software\\Microsoft\\SystemCertificates"
1398 #define CERT_GROUP_POLICY_SYSTEM_STORE_REGPATH \
1399 L"Software\\Policies\\Microsoft\\SystemCertificates"
1400 #else
1401 static const WCHAR CERT_LOCAL_MACHINE_SYSTEM_STORE_REGPATH[] =
1402 {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
1403 'S','y','s','t','e','m','C','e','r','t','i','f','i','c','a','t','e','s',0 };
1404 static const WCHAR CERT_GROUP_POLICY_SYSTEM_STORE_REGPATH[] =
1405 {'S','o','f','t','w','a','r','e','\\','P','o','l','i','c','i','e','s','\\',
1406 'M','i','c','r','o','s','o','f','t','\\','S','y','s','t','e','m','C','e','r',
1407 't','i','f','i','c','a','t','e','s',0 };
1408 #endif
1410 /* flags for CertOpenStore dwFlags */
1411 #define CERT_STORE_NO_CRYPT_RELEASE_FLAG 0x00000001
1412 #define CERT_STORE_SET_LOCALIZED_NAME_FLAG 0x00000002
1413 #define CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG 0x00000004
1414 #define CERT_STORE_DELETE_FLAG 0x00000010
1415 #define CERT_STORE_UNSAFE_PHYSICAL_FLAG 0x00000020
1416 #define CERT_STORE_SHARE_STORE_FLAG 0x00000040
1417 #define CERT_STORE_SHARE_CONTEXT_FLAG 0x00000080
1418 #define CERT_STORE_MANIFOLD_FLAG 0x00000100
1419 #define CERT_STORE_ENUM_ARCHIVED_FLAG 0x00000200
1420 #define CERT_STORE_UPDATE_KEYID_FLAG 0x00000400
1421 #define CERT_STORE_BACKUP_RESTORE_FLAG 0x00000800
1422 #define CERT_STORE_MAXIMUM_ALLOWED_FLAG 0x00001000
1423 #define CERT_STORE_CREATE_NEW_FLAG 0x00002000
1424 #define CERT_STORE_OPEN_EXISTING_FLAG 0x00004000
1425 #define CERT_STORE_READONLY_FLAG 0x00008000
1427 /* dwAddDisposition */
1428 #define CERT_STORE_ADD_NEW 1
1429 #define CERT_STORE_ADD_USE_EXISTING 2
1430 #define CERT_STORE_ADD_REPLACE_EXISTING 3
1431 #define CERT_STORE_ADD_ALWAYS 4
1432 #define CERT_STORE_ADD_REPLACE_EXISTING_INHERIT_PROPERTIES 5
1433 #define CERT_STORE_ADD_NEWER 6
1434 #define CERT_STORE_ADD_NEWER_INHERIT_PROPERTIES 7
1436 /* Installable OID function defs */
1437 #define CRYPT_OID_OPEN_STORE_PROV_FUNC "CertDllOpenStoreProv"
1438 #define CRYPT_OID_ENCODE_OBJECT_FUNC "CryptDllEncodeObject"
1439 #define CRYPT_OID_DECODE_OBJECT_FUNC "CryptDllDecodeObject"
1440 #define CRYPT_OID_ENCODE_OBJECT_EX_FUNC "CryptDllEncodeObjectEx"
1441 #define CRYPT_OID_DECODE_OBJECT_EX_FUNC "CryptDllDecodeObjectEx"
1442 #define CRYPT_OID_CREATE_COM_OBJECT_FUNC "CryptDllCreateComObject"
1443 #define CRYPT_OID_VERIFY_REVOCATION_FUNC "CertDllVerifyRevocation"
1444 #define CRYPT_OID_VERIFY_CTL_USAGE_FUNC "CertDllVerifyCTLUsage"
1445 #define CRYPT_OID_FORMAT_OBJECT_FUNC "CryptDllFormatObject"
1446 #define CRYPT_OID_FIND_OID_INFO_FUNC "CryptDllFindOIDInfo"
1447 #define CRYPT_OID_FIND_LOCALIZED_NAME_FUNC "CryptDllFindLocalizedName"
1448 #define CRYPT_OID_EXPORT_PUBLIC_KEY_INFO_FUNC "CryptDllExportPublicKeyInfoEx"
1449 #define CRYPT_OID_IMPORT_PUBLIC_KEY_INFO_FUNC "CryptDllImportPublicKeyInfoEx"
1450 #define CRYPT_OID_EXPORT_PRIVATE_KEY_INFO_FUNC "CryptDllExportPrivateKeyInfoEx"
1451 #define CRYPT_OID_IMPORT_PRIVATE_KEY_INFO_FUNC "CryptDllImportPrivateKeyInfoEx"
1452 #define CRYPT_OID_VERIFY_CERTIFICATE_CHAIN_POLICY_FUNC \
1453 "CertDllVerifyCertificateChainPolicy"
1454 #define URL_OID_GET_OBJECT_URL_FUNC "UrlDllGetObjectUrl"
1455 #define TIME_VALID_OID_GET_OBJECT_FUNC "TimeValidDllGetObject"
1457 #define CRYPT_OID_REGPATH "Software\\Microsoft\\Cryptography\\OID"
1458 #define CRYPT_OID_REG_ENCODING_TYPE_PREFIX "EncodingType "
1459 #if defined(__GNUC__)
1460 # define CRYPT_OID_REG_DLL_VALUE_NAME (const WCHAR []){ 'D','l','l',0 }
1461 # define CRYPT_OID_REG_FUNC_NAME_VALUE_NAME \
1462 (const WCHAR []){ 'F','u','n','c','N','a','m','e',0 }
1463 # define CRYPT_OID_REG_FLAGS_VALUE_NAME \
1464 (const WCHAR []){ 'C','r','y','p','t','F','l','a','g','s',0 }
1465 #elif defined(_MSC_VER)
1466 # define CRYPT_OID_REG_DLL_VALUE_NAME L"Dll"
1467 # define CRYPT_OID_REG_FUNC_NAME_VALUE_NAME L"FuncName"
1468 # define CRYPT_OID_REG_FLAGS_VALUE_NAME L"CryptFlags"
1469 #else
1470 static const WCHAR CRYPT_OID_REG_DLL_VALUE_NAME[] = { 'D','l','l',0 };
1471 static const WCHAR CRYPT_OID_REG_FUNC_NAME_VALUE_NAME[] =
1472 { 'F','u','n','c','N','a','m','e',0 };
1473 static const WCHAR CRYPT_OID_REG_FLAGS_VALUE_NAME[] =
1474 { 'C','r','y','p','t','F','l','a','g','s',0 };
1475 #endif
1476 #define CRYPT_OID_REG_FUNC_NAME_VALUE_NAME_A "FuncName"
1477 #define CRYPT_DEFAULT_OID "DEFAULT"
1479 #define CRYPT_INSTALL_OID_FUNC_BEFORE_FLAG 1
1481 #define CRYPT_GET_INSTALLED_OID_FUNC_FLAG 0x1
1483 #define CRYPT_REGISTER_FIRST_INDEX 0
1484 #define CRYPT_REGISTER_LAST_INDEX 0xffffffff
1486 /* values for CERT_STORE_PROV_INFO's dwStoreProvFlags */
1487 #define CERT_STORE_PROV_EXTERNAL_FLAG 0x1
1488 #define CERT_STORE_PROV_DELETED_FLAG 0x2
1489 #define CERT_STORE_PROV_NO_PERSIST_FLAG 0x4
1490 #define CERT_STORE_PROV_SYSTEM_STORE_FLAG 0x8
1491 #define CERT_STORE_PROV_LM_SYSTEM_STORE_FLAG 0x10
1493 /* function indices */
1494 #define CERT_STORE_PROV_CLOSE_FUNC 0
1495 #define CERT_STORE_PROV_READ_CERT_FUNC 1
1496 #define CERT_STORE_PROV_WRITE_CERT_FUNC 2
1497 #define CERT_STORE_PROV_DELETE_CERT_FUNC 3
1498 #define CERT_STORE_PROV_SET_CERT_PROPERTY_FUNC 4
1499 #define CERT_STORE_PROV_READ_CRL_FUNC 5
1500 #define CERT_STORE_PROV_WRITE_CRL_FUNC 6
1501 #define CERT_STORE_PROV_DELETE_CRL_FUNC 7
1502 #define CERT_STORE_PROV_SET_CRL_PROPERTY_FUNC 8
1503 #define CERT_STORE_PROV_READ_CTL_FUNC 9
1504 #define CERT_STORE_PROV_WRITE_CTL_FUNC 10
1505 #define CERT_STORE_PROV_DELETE_CTL_FUNC 11
1506 #define CERT_STORE_PROV_SET_CTL_PROPERTY_FUNC 12
1507 #define CERT_STORE_PROV_CONTROL_FUNC 13
1508 #define CERT_STORE_PROV_FIND_CERT_FUNC 14
1509 #define CERT_STORE_PROV_FREE_FIND_CERT_FUNC 15
1510 #define CERT_STORE_PROV_GET_CERT_PROPERTY_FUNC 16
1511 #define CERT_STORE_PROV_FIND_CRL_FUNC 17
1512 #define CERT_STORE_PROV_FREE_FIND_CRL_FUNC 18
1513 #define CERT_STORE_PROV_GET_CRL_PROPERTY_FUNC 19
1514 #define CERT_STORE_PROV_FIND_CTL_FUNC 20
1515 #define CERT_STORE_PROV_FREE_FIND_CTL_FUNC 21
1516 #define CERT_STORE_PROV_GET_CTL_PROPERTY_FUNC 22
1518 /* physical store dwFlags, also used by CertAddStoreToCollection as
1519 * dwUpdateFlags
1521 #define CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG 0x1
1522 #define CERT_PHYSICAL_STORE_OPEN_DISABLE_FLAG 0x2
1523 #define CERT_PHYSICAL_STORE_REMOVE_OPEN_DISABLE_FLAG 0x4
1524 #define CERT_PHYSICAL_STORE_INSERT_COMPUTER_NAME_ENABLE_FLAG 0x8
1526 /* dwFlag values for CertEnumPhysicalStore callback */
1527 #define CERT_PHYSICAL_STORE_PREDEFINED_ENUM_FLAG 0x1
1529 /* predefined store names */
1530 #if defined(__GNUC__)
1531 # define CERT_PHYSICAL_STORE_DEFAULT_NAME (const WCHAR[])\
1532 {'.','D','e','f','a','u','l','t','0'}
1533 # define CERT_PHYSICAL_STORE_GROUP_POLICY_NAME (const WCHAR[])\
1534 {'.','G','r','o','u','p','P','o','l','i','c','y',0}
1535 # define CERT_PHYSICAL_STORE_LOCAL_MACHINE_NAME (const WCHAR[])\
1536 {'.','L','o','c','a','l','M','a','c','h','i','n','e',0}
1537 # define CERT_PHYSICAL_STORE_DS_USER_CERTIFICATE_NAME (const WCHAR[])\
1538 {'.','U','s','e','r','C','e','r','t','i','f','i','c','a','t','e',0}
1539 # define CERT_PHYSICAL_STORE_LOCAL_MACHINE_GROUP_POLICY_NAME (const WCHAR[])\
1540 {'.','L','o','c','a','l','M','a','c','h','i','n','e','G','r','o','u','p',\
1541 'P','o','l','i','c','y',0}
1542 # define CERT_PHYSICAL_STORE_ENTERPRISE_NAME (const WCHAR[])\
1543 {'.','E','n','t','e','r','p','r','i','s','e',0}
1544 # define CERT_PHYSICAL_STORE_AUTH_ROOT_NAME (const WCHAR[])\
1545 {'.','A','u','t','h','R','o','o','t',0}
1546 #elif defined(_MSC_VER)
1547 # define CERT_PHYSICAL_STORE_DEFAULT_NAME \
1548 L".Default"
1549 # define CERT_PHYSICAL_STORE_GROUP_POLICY_NAME \
1550 L".GroupPolicy"
1551 # define CERT_PHYSICAL_STORE_LOCAL_MACHINE_NAME \
1552 L".LocalMachine"
1553 # define CERT_PHYSICAL_STORE_DS_USER_CERTIFICATE_NAME \
1554 L".UserCertificate"
1555 # define CERT_PHYSICAL_STORE_LOCAL_MACHINE_GROUP_POLICY_NAME \
1556 L".LocalMachineGroupPolicy"
1557 # define CERT_PHYSICAL_STORE_ENTERPRISE_NAME \
1558 L".Enterprise"
1559 # define CERT_PHYSICAL_STORE_AUTH_ROOT_NAME \
1560 L".AuthRoot"
1561 #else
1562 static const WCHAR CERT_PHYSICAL_STORE_DEFAULT_NAME[] =
1563 {'.','D','e','f','a','u','l','t','0'};
1564 static const WCHAR CERT_PHYSICAL_STORE_GROUP_POLICY_NAME[] =
1565 {'.','G','r','o','u','p','P','o','l','i','c','y',0};
1566 static const WCHAR CERT_PHYSICAL_STORE_LOCAL_MACHINE_NAME[] =
1567 {'.','L','o','c','a','l','M','a','c','h','i','n','e',0};
1568 static const WCHAR CERT_PHYSICAL_STORE_DS_USER_CERTIFICATE_NAME[] =
1569 {'.','U','s','e','r','C','e','r','t','i','f','i','c','a','t','e',0};
1570 static const WCHAR CERT_PHYSICAL_STORE_LOCAL_MACHINE_GROUP_POLICY_NAME[] =
1571 {'.','L','o','c','a','l','M','a','c','h','i','n','e','G','r','o','u','p',
1572 'P','o','l','i','c','y',0};
1573 static const WCHAR CERT_PHYSICAL_STORE_ENTERPRISE_NAME[] =
1574 {'.','E','n','t','e','r','p','r','i','s','e',0};
1575 static const WCHAR CERT_PHYSICAL_STORE_AUTH_ROOT_NAME[] =
1576 {'.','A','u','t','h','R','o','o','t',0};
1577 #endif
1579 /* cert system store flags */
1580 #define CERT_SYSTEM_STORE_MASK 0xffff0000
1581 #define CERT_SYSTEM_STORE_RELOCATE_FLAG 0x80000000
1583 /* CertFindChainInStore dwFindType types */
1584 #define CERT_CHAIN_FIND_BY_ISSUER 1
1586 /* CERT_INFO versions/flags */
1587 #define CERT_V1 0
1588 #define CERT_V2 1
1589 #define CERT_V3 2
1590 #define CERT_INFO_VERSION_FLAG 1
1591 #define CERT_INFO_SERIAL_NUMBER_FLAG 2
1592 #define CERT_INFO_SIGNATURE_ALGORITHM_FLAG 3
1593 #define CERT_INFO_ISSUER_FLAG 4
1594 #define CERT_INFO_NOT_BEFORE_FLAG 5
1595 #define CERT_INFO_NOT_AFTER_FLAG 6
1596 #define CERT_INFO_SUBJECT_FLAG 7
1597 #define CERT_INFO_SUBJECT_PUBLIC_KEY_INFO_FLAG 8
1598 #define CERT_INFO_ISSUER_UNIQUE_ID_FLAG 9
1599 #define CERT_INFO_SUBJECT_UNIQUE_ID_FLAG 10
1600 #define CERT_INFO_EXTENSION_FLAG 11
1602 /* CERT_REQUEST_INFO versions */
1603 #define CERT_REQUEST_V1 0
1605 /* CERT_KEYGEN_REQUEST_INFO versions */
1606 #define CERT_KEYGEN_REQUEST_V1 0
1608 /* CRL versions */
1609 #define CRL_V1 0
1610 #define CRL_V2 1
1612 /* CTL versions */
1613 #define CTL_V1 0
1615 /* Certificate, CRL, CTL property IDs */
1616 #define CERT_KEY_PROV_HANDLE_PROP_ID 1
1617 #define CERT_KEY_PROV_INFO_PROP_ID 2
1618 #define CERT_SHA1_HASH_PROP_ID 3
1619 #define CERT_HASH_PROP_ID CERT_SHA1_HASH_PROP_ID
1620 #define CERT_MD5_HASH_PROP_ID 4
1621 #define CERT_KEY_CONTEXT_PROP_ID 5
1622 #define CERT_KEY_SPEC_PROP_ID 6
1623 #define CERT_IE30_RESERVED_PROP_ID 7
1624 #define CERT_PUBKEY_HASH_RESERVED_PROP_ID 8
1625 #define CERT_ENHKEY_USAGE_PROP_ID 9
1626 #define CERT_CTL_USAGE_PROP_ID CERT_ENHKEY_USAGE_PROP_ID
1627 #define CERT_NEXT_UPDATE_LOCATION_PROP_ID 10
1628 #define CERT_FRIENDLY_NAME_PROP_ID 11
1629 #define CERT_PVK_FILE_PROP_ID 12
1630 #define CERT_DESCRIPTION_PROP_ID 13
1631 #define CERT_ACCESS_STATE_PROP_ID 14
1632 #define CERT_SIGNATURE_HASH_PROP_ID 15
1633 #define CERT_SMART_CARD_DATA_PROP_ID 16
1634 #define CERT_EFS_PROP_ID 17
1635 #define CERT_FORTEZZA_DATA_PROP 18
1636 #define CERT_ARCHIVED_PROP_ID 19
1637 #define CERT_KEY_IDENTIFIER_PROP_ID 20
1638 #define CERT_AUTO_ENROLL_PROP_ID 21
1639 #define CERT_PUBKEY_ALG_PARA_PROP_ID 22
1640 #define CERT_CROSS_CERT_DIST_POINTS_PROP_ID 23
1641 #define CERT_ISSUER_PUBLIC_KEY_MD5_HASH_PROP_ID 24
1642 #define CERT_SUBJECT_PUBLIC_KEY_MD5_HASH_PROP_ID 25
1643 #define CERT_ENROLLMENT_PROP_ID 26
1644 #define CERT_DATE_STAMP_PROP_ID 27
1645 #define CERT_ISSUER_SERIAL_NUMBER_MD5_HASH_PROP_ID 28
1646 #define CERT_SUBJECT_NAME_MD5_HASH_PROP_ID 29
1647 #define CERT_EXTENDED_ERROR_INFO_PROP_ID 30
1648 /* 31 -- unused?
1649 32 -- cert prop id
1650 33 -- CRL prop id
1651 34 -- CTL prop id
1652 35 -- KeyId prop id
1653 36-63 -- reserved
1655 #define CERT_RENEWAL_PROP_ID 64
1656 #define CERT_ARCHIVED_KEY_HASH_PROP_ID 65
1657 #define CERT_AUTO_ENROLL_RETRY_PROP_ID 66
1658 #define CERT_AIA_URL_RETRIEVED_PROP_ID 67
1659 #define CERT_FIRST_RESERVED_PROP_ID 68
1660 #define CERT_LAST_RESERVED_PROP_ID 0x00007fff
1661 #define CERT_FIRST_USER_PROP_ID 0x00008000
1662 #define CERT_LAST_USER_PROP_ID 0x0000ffff
1664 #define IS_CERT_HASH_PROP_ID(x) \
1665 ((x) == CERT_SHA1_HASH_PROP_ID || (x) == CERT_MD5_HASH_PROP_ID || \
1666 (x) == CERT_SIGNATURE_HASH_PROP_ID)
1668 #define IS_PUBKEY_HASH_PROP_ID(x) \
1669 ((x) == CERT_ISSUER_PUBLIC_KEY_MD5_HASH_PROP_ID || \
1670 (x) == CERT_SUBJECT_PUBLIC_KEY_MD5_HASH_PROP_ID)
1672 #define IS_CHAIN_HASH_PROP_ID(x) \
1673 ((x) == CERT_ISSUER_PUBLIC_KEY_MD5_HASH_PROP_ID || \
1674 (x) == CERT_SUBJECT_PUBLIC_KEY_MD5_HASH_PROP_ID || \
1675 (x) == CERT_ISSUER_SERIAL_NUMBER_MD5_HASH_PROP_ID || \
1676 (x) == CERT_SUBJECT_NAME_MD5_HASH_PROP_ID)
1678 /* access state flags */
1679 #define CERT_ACCESS_STATE_WRITE_PERSIST_FLAG 0x1
1680 #define CERT_ACCESS_STATE_SYSTEM_STORE_FLAG 0x2
1681 #define CERT_ACCESS_STATE_LM_SYSTEM_STORE_FLAG 0x4
1683 /* CERT_RDN attribute dwValueType types */
1684 #define CERT_RDN_TYPE_MASK 0x000000ff
1685 #define CERT_RDN_ANY_TYPE 0
1686 #define CERT_RDN_ENCODED_BLOB 1
1687 #define CERT_RDN_OCTET_STRING 2
1688 #define CERT_RDN_NUMERIC_STRING 3
1689 #define CERT_RDN_PRINTABLE_STRING 4
1690 #define CERT_RDN_TELETEX_STRING 5
1691 #define CERT_RDN_T61_STRING 5
1692 #define CERT_RDN_VIDEOTEX_STRING 6
1693 #define CERT_RDN_IA5_STRING 7
1694 #define CERT_RDN_GRAPHIC_STRING 8
1695 #define CERT_RDN_VISIBLE_STRING 9
1696 #define CERT_RDN_ISO646_STRING 9
1697 #define CERT_RDN_GENERAL_STRING 10
1698 #define CERT_RDN_UNIVERSAL_STRING 11
1699 #define CERT_RDN_INT4_STRING 11
1700 #define CERT_RDN_BMP_STRING 12
1701 #define CERT_RDN_UNICODE_STRING 12
1702 #define CERT_RDN_UTF8_STRING 13
1704 /* CERT_RDN attribute dwValueType flags */
1705 #define CERT_RDN_FLAGS_MASK 0xff000000
1706 #define CERT_RDN_ENABLE_T61_UNICODE_FLAG 0x80000000
1707 #define CERT_RDN_DISABLE_CHECK_TYPE_FLAG 0x4000000
1708 #define CERT_RDN_ENABLE_UTF8_UNICODE_FLAG 0x2000000
1709 #define CERT_RDN_DISABLE_IE4_UTF8_FLAG 0x0100000
1711 #define IS_CERT_RDN_CHAR_STRING(x) \
1712 (((x) & CERT_RDN_TYPE_MASK) >= CERT_RDN_NUMERIC_STRING)
1714 /* CRL reason codes */
1715 #define CRL_REASON_UNSPECIFIED 0
1716 #define CRL_REASON_KEY_COMPROMISE 1
1717 #define CRL_REASON_CA_COMPROMISE 2
1718 #define CRL_REASON_AFFILIATION_CHANGED 3
1719 #define CRL_REASON_SUPERSEDED 4
1720 #define CRL_REASON_CESSATION_OF_OPERATION 5
1721 #define CRL_REASON_CERTIFICATE_HOLD 6
1722 #define CRL_REASON_REMOVE_FROM_CRL 8
1724 /* CertControlStore control types */
1725 #define CERT_STORE_CTRL_RESYNC 1
1726 #define CERT_STORE_CTRL_NOTIFY_CHANGE 2
1727 #define CERT_STORE_CTRL_COMMIT 3
1728 #define CERT_STORE_CTRL_AUTO_RESYNC 4
1729 #define CERT_STORE_CTRL_CANCEL_NOTIFY 5
1731 #define CERT_STORE_CTRL_COMMIT_FORCE_FLAG 0x1
1732 #define CERT_STORE_CTRL_COMMIT_CLEAR_FLAG 0x2
1734 /* cert store properties */
1735 #define CERT_STORE_LOCALIZED_NAME_PROP_ID 0x1000
1737 /* CertCreateContext flags */
1738 #define CERT_CREATE_CONTEXT_NOCOPY_FLAG 0x1
1739 #define CERT_CREATE_CONTEXT_SORTED_FLAG 0x2
1740 #define CERT_CREATE_CONTEXT_NO_HCRYPTMSG_FLAG 0x4
1741 #define CERT_CREATE_CONTEXT_NO_ENTRY_FLAG 0x8
1743 #define CERT_COMPARE_MASK 0xffff
1744 #define CERT_COMPARE_SHIFT 16
1745 #define CERT_COMPARE_ANY 0
1746 #define CERT_COMPARE_SHA1_HASH 1
1747 #define CERT_COMPARE_HASH CERT_COMPARE_SHA1_HASH
1748 #define CERT_COMPARE_NAME 2
1749 #define CERT_COMPARE_ATTR 3
1750 #define CERT_COMPARE_MD5_HASH 4
1751 #define CERT_COMPARE_PROPERTY 5
1752 #define CERT_COMPARE_PUBLIC_KEY 6
1753 #define CERT_COMPARE_NAME_STR_A 7
1754 #define CERT_COMPARE_NAME_STR_W 8
1755 #define CERT_COMPARE_KEY_SPEC 9
1756 #define CERT_COMPARE_ENHKEY_USAGE 10
1757 #define CERT_COMPARE_CTL_USAGE CERT_COMPARE_ENHKEY_USAGE
1758 #define CERT_COMPARE_SUBJECT_CERT 11
1759 #define CERT_COMPARE_ISSUER_OF 12
1760 #define CERT_COMPARE_EXISTING 13
1761 #define CERT_COMPARE_SIGNATURE_HASH 14
1762 #define CERT_COMPARE_KEY_IDENTIFIER 15
1763 #define CERT_COMPARE_CERT_ID 16
1764 #define CERT_COMPARE_CROSS_CERT_DIST_POINTS 17
1765 #define CERT_COMPARE_PUBKEY_MD5_HASH 18
1767 /* values of dwFindType for CertFind*InStore */
1768 #define CERT_FIND_ANY \
1769 (CERT_COMPARE_ANY << CERT_COMPARE_SHIFT)
1770 #define CERT_FIND_SHA1_HASH \
1771 (CERT_COMPARE_SHA1_HASH << CERT_COMPARE_SHIFT)
1772 #define CERT_FIND_MD5_HASH \
1773 (CERT_COMPARE_MD5_HASH << CERT_COMPARE_SHIFT)
1774 #define CERT_FIND_SIGNATURE_HASH \
1775 (CERT_COMPARE_SIGNATURE_HASH << CERT_COMPARE_SHIFT)
1776 #define CERT_FIND_KEY_IDENTIFIER \
1777 (CERT_COMPARE_KEY_IDENTIFIER << CERT_COMPARE_SHIFT)
1778 #define CERT_FIND_HASH CERT_FIND_SHA1_HASH
1779 #define CERT_FIND_PROPERTY \
1780 (CERT_COMPARE_PROPERTY << CERT_COMPARE_SHIFT)
1781 #define CERT_FIND_PUBLIC_KEY \
1782 (CERT_COMPARE_PUBLIC_KEY << CERT_COMPARE_SHIFT)
1783 #define CERT_FIND_SUBJECT_NAME \
1784 (CERT_COMPARE_NAME << CERT_COMPARE_SHIFT | CERT_INFO_SUBJECT_FLAG)
1785 #define CERT_FIND_SUBJECT_ATTR \
1786 (CERT_COMPARE_ATTR << CERT_COMPARE_SHIFT | CERT_INFO_SUBJECT_FLAG)
1787 #define CERT_FIND_ISSUER_NAME \
1788 (CERT_COMPARE_NAME << CERT_COMPARE_SHIFT | CERT_INFO_ISSUER_FLAG)
1789 #define CERT_FIND_ISSUER_ATTR \
1790 (CERT_COMPARE_ATTR << CERT_COMPARE_SHIFT | CERT_INFO_ISSUER_FLAG)
1791 #define CERT_FIND_SUBJECT_STR_A \
1792 (CERT_COMPARE_NAME_STR_A << CERT_COMPARE_SHIFT | CERT_INFO_SUBJECT_FLAG)
1793 #define CERT_FIND_SUBJECT_STR_W \
1794 (CERT_COMPARE_NAME_STR_W << CERT_COMPARE_SHIFT | CERT_INFO_SUBJECT_FLAG)
1795 #define CERT_FIND_SUBJECT_STR CERT_FIND_SUBJECT_STR_W
1796 #define CERT_FIND_ISSUER_STR_A \
1797 (CERT_COMPARE_NAME_STR_A << CERT_COMPARE_SHIFT | CERT_INFO_ISSUER_FLAG)
1798 #define CERT_FIND_ISSUER_STR_W \
1799 (CERT_COMPARE_NAME_STR_W << CERT_COMPARE_SHIFT | CERT_INFO_ISSUER_FLAG)
1800 #define CERT_FIND_ISSUER_STR CERT_FIND_ISSUER_STR_W
1801 #define CERT_FIND_KEY_SPEC \
1802 (CERT_COMPARE_KEY_SPEC << CERT_COMPARE_SHIFT)
1803 #define CERT_FIND_ENHKEY_USAGE \
1804 (CERT_COMPARE_ENHKEY_USAGE << CERT_COMPARE_SHIFT)
1805 #define CERT_FIND_CTL_USAGE CERT_FIND_ENHKEY_USAGE
1806 #define CERT_FIND_SUBJECT_CERT \
1807 (CERT_COMPARE_SUBJECT_CERT << CERT_COMPARE_SHIFT)
1808 #define CERT_FIND_ISSUER_OF \
1809 (CERT_COMPARE_ISSUER_OF << CERT_COMPARE_SHIFT)
1810 #define CERT_FIND_EXISTING \
1811 (CERT_COMPARE_EXISTING << CERT_COMPARE_SHIFT)
1812 #define CERT_FIND_CERT_ID \
1813 (CERT_COMPARE_CERT_ID << CERT_COMPARE_SHIFT)
1814 #define CERT_FIND_CROSS_CERT_DIST_POINTS \
1815 (CERT_COMPARE_CROSS_CERT_DIST_POINTS << CERT_COMPARE_SHIFT)
1816 #define CERT_FIND_PUBKEY_MD5_HASH \
1817 (CERT_COMPARE_PUBKEY_MD5_HASH << CERT_COMPARE_SHIFT)
1819 /* PFN_CERT_STORE_PROV_WRITE_CERT dwFlags values */
1820 #define CERT_STORE_PROV_WRITE_ADD_FLAG 0x1
1822 /* CertAddSerializedElementToStore context types */
1823 #define CERT_STORE_CERTIFICATE_CONTEXT 1
1824 #define CERT_STORE_CRL_CONTEXT 2
1825 #define CERT_STORE_CTL_CONTEXT 3
1826 #define CERT_STORE_ALL_CONTEXT_FLAG ~0U
1827 #define CERT_STORE_CERTIFICATE_CONTEXT_FLAG \
1828 (1 << CERT_STORE_CERTIFICATE_CONTEXT)
1829 #define CERT_STORE_CRL_CONTEXT_FLAG (1 << CERT_STORE_CRL_CONTEXT)
1830 #define CERT_STORE_CTL_CONTEXT_FLAG (1 << CERT_STORE_CTL_CONTEXT)
1832 /* OIDs */
1833 #define szOID_RSA "1.2.840.113549"
1834 #define szOID_PKCS "1.2.840.113549.1"
1835 #define szOID_RSA_HASH "1.2.840.113549.2"
1836 #define szOID_RSA_ENCRYPT "1.2.840.113549.3"
1837 #define szOID_PKCS_1 "1.2.840.113549.1.1"
1838 #define szOID_PKCS_2 "1.2.840.113549.1.2"
1839 #define szOID_PKCS_3 "1.2.840.113549.1.3"
1840 #define szOID_PKCS_4 "1.2.840.113549.1.4"
1841 #define szOID_PKCS_5 "1.2.840.113549.1.5"
1842 #define szOID_PKCS_6 "1.2.840.113549.1.6"
1843 #define szOID_PKCS_7 "1.2.840.113549.1.7"
1844 #define szOID_PKCS_8 "1.2.840.113549.1.8"
1845 #define szOID_PKCS_9 "1.2.840.113549.1.9"
1846 #define szOID_PKCS_10 "1.2.840.113549.1.10"
1847 #define szOID_PKCS_11 "1.2.840.113549.1.12"
1848 #define szOID_RSA_RSA "1.2.840.113549.1.1.1"
1849 #define CERT_RSA_PUBLIC_KEY_OBJID szOID_RSA_RSA
1850 #define CERT_DEFAULT_OID_PUBLIC_KEY_SIGN szOID_RSA_RSA
1851 #define CERT_DEFAULT_OID_PUBLIC_KEY_XCHG szOID_RSA_RSA
1852 #define szOID_RSA_MD2RSA "1.2.840.113549.1.1.2"
1853 #define szOID_RSA_MD4RSA "1.2.840.113549.1.1.3"
1854 #define szOID_RSA_MD5RSA "1.2.840.113549.1.1.4"
1855 #define szOID_RSA_SHA1RSA "1.2.840.113549.1.1.5"
1856 #define szOID_RSA_SET0AEP_RSA "1.2.840.113549.1.1.6"
1857 #define szOID_RSA_DH "1.2.840.113549.1.3.1"
1858 #define szOID_RSA_data "1.2.840.113549.1.7.1"
1859 #define szOID_RSA_signedData "1.2.840.113549.1.7.2"
1860 #define szOID_RSA_envelopedData "1.2.840.113549.1.7.3"
1861 #define szOID_RSA_signEnvData "1.2.840.113549.1.7.4"
1862 #define szOID_RSA_digestedData "1.2.840.113549.1.7.5"
1863 #define szOID_RSA_hashedData "1.2.840.113549.1.7.5"
1864 #define szOID_RSA_encryptedData "1.2.840.113549.1.7.6"
1865 #define szOID_RSA_emailAddr "1.2.840.113549.1.9.1"
1866 #define szOID_RSA_unstructName "1.2.840.113549.1.9.2"
1867 #define szOID_RSA_contentType "1.2.840.113549.1.9.3"
1868 #define szOID_RSA_messageDigest "1.2.840.113549.1.9.4"
1869 #define szOID_RSA_signingTime "1.2.840.113549.1.9.5"
1870 #define szOID_RSA_counterSign "1.2.840.113549.1.9.6"
1871 #define szOID_RSA_challengePwd "1.2.840.113549.1.9.7"
1872 #define szOID_RSA_unstructAddr "1.2.840.113549.1.9.9"
1873 #define szOID_RSA_extCertAttrs "1.2.840.113549.1.9.9"
1874 #define szOID_RSA_certExtensions "1.2.840.113549.1.9.14"
1875 #define szOID_RSA_SMIMECapabilities "1.2.840.113549.1.9.15"
1876 #define szOID_RSA_preferSignedData "1.2.840.113549.1.9.15.1"
1877 #define szOID_RSA_SMIMEalg "1.2.840.113549.1.9.16.3"
1878 #define szOID_RSA_SMIMEalgESDH "1.2.840.113549.1.9.16.3.5"
1879 #define szOID_RSA_SMIMEalgCMS3DESwrap "1.2.840.113549.1.9.16.3.6"
1880 #define szOID_RSA_SMIMEalgCMSRC2wrap "1.2.840.113549.1.9.16.3.7"
1881 #define szOID_RSA_MD2 "1.2.840.113549.2.2"
1882 #define szOID_RSA_MD4 "1.2.840.113549.2.4"
1883 #define szOID_RSA_MD5 "1.2.840.113549.2.5"
1884 #define szOID_RSA_RC2CBC "1.2.840.113549.3.2"
1885 #define szOID_RSA_RC4 "1.2.840.113549.3.4"
1886 #define szOID_RSA_DES_EDE3_CBC "1.2.840.113549.3.7"
1887 #define szOID_RSA_RC5_CBCPad "1.2.840.113549.3.9"
1888 #define szOID_ANSI_X942 "1.2.840.10046"
1889 #define szOID_ANSI_X942_DH "1.2.840.10046.2.1"
1890 #define szOID_X957 "1.2.840.10040"
1891 #define szOID_X957_DSA "1.2.840.10040.4.1"
1892 #define szOID_X957_SHA1DSA "1.2.840.10040.4.3"
1893 #define szOID_DS "2.5"
1894 #define szOID_DSALG "2.5.8"
1895 #define szOID_DSALG_CRPT "2.5.8.1"
1896 #define szOID_DSALG_HASH "2.5.8.2"
1897 #define szOID_DSALG_SIGN "2.5.8.3"
1898 #define szOID_DSALG_RSA "2.5.8.1.1"
1899 #define szOID_OIW "1.3.14"
1900 #define szOID_OIWSEC "1.3.14.3.2"
1901 #define szOID_OIWSEC_md4RSA "1.3.14.3.2.2"
1902 #define szOID_OIWSEC_md5RSA "1.3.14.3.2.3"
1903 #define szOID_OIWSEC_md4RSA2 "1.3.14.3.2.4"
1904 #define szOID_OIWSEC_desECB "1.3.14.3.2.6"
1905 #define szOID_OIWSEC_desCBC "1.3.14.3.2.7"
1906 #define szOID_OIWSEC_desOFB "1.3.14.3.2.8"
1907 #define szOID_OIWSEC_desCFB "1.3.14.3.2.9"
1908 #define szOID_OIWSEC_desMAC "1.3.14.3.2.10"
1909 #define szOID_OIWSEC_rsaSign "1.3.14.3.2.11"
1910 #define szOID_OIWSEC_dsa "1.3.14.3.2.12"
1911 #define szOID_OIWSEC_shaDSA "1.3.14.3.2.13"
1912 #define szOID_OIWSEC_mdc2RSA "1.3.14.3.2.14"
1913 #define szOID_OIWSEC_shaRSA "1.3.14.3.2.15"
1914 #define szOID_OIWSEC_dhCommMod "1.3.14.3.2.16"
1915 #define szOID_OIWSEC_desEDE "1.3.14.3.2.17"
1916 #define szOID_OIWSEC_sha "1.3.14.3.2.18"
1917 #define szOID_OIWSEC_mdc2 "1.3.14.3.2.19"
1918 #define szOID_OIWSEC_dsaComm "1.3.14.3.2.20"
1919 #define szOID_OIWSEC_dsaCommSHA "1.3.14.3.2.21"
1920 #define szOID_OIWSEC_rsaXchg "1.3.14.3.2.22"
1921 #define szOID_OIWSEC_keyHashSeal "1.3.14.3.2.23"
1922 #define szOID_OIWSEC_md2RSASign "1.3.14.3.2.24"
1923 #define szOID_OIWSEC_md5RSASign "1.3.14.3.2.25"
1924 #define szOID_OIWSEC_sha1 "1.3.14.3.2.26"
1925 #define szOID_OIWSEC_dsaSHA1 "1.3.14.3.2.27"
1926 #define szOID_OIWSEC_dsaCommSHA1 "1.3.14.3.2.28"
1927 #define szOID_OIWSEC_sha1RSASign "1.3.14.3.2.29"
1928 #define szOID_OIWDIR "1.3.14.7.2"
1929 #define szOID_OIWDIR_CRPT "1.3.14.7.2.1"
1930 #define szOID_OIWDIR_HASH "1.3.14.7.2.2"
1931 #define szOID_OIWDIR_SIGN "1.3.14.7.2.3"
1932 #define szOID_OIWDIR_md2 "1.3.14.7.2.2.1"
1933 #define szOID_OIWDIR_md2RSA "1.3.14.7.2.3.1"
1934 #define szOID_INFOSEC "2.16.840.1.101.2.1"
1935 #define szOID_INFOSEC_sdnsSignature "2.16.840.1.101.2.1.1.1"
1936 #define szOID_INFOSEC_mosaicSignature "2.16.840.1.101.2.1.1.2"
1937 #define szOID_INFOSEC_sdnsConfidentiality "2.16.840.1.101.2.1.1.3"
1938 #define szOID_INFOSEC_mosaicConfidentiality "2.16.840.1.101.2.1.1.4"
1939 #define szOID_INFOSEC_sdnsIntegrity "2.16.840.1.101.2.1.1.5"
1940 #define szOID_INFOSEC_mosaicIntegrity "2.16.840.1.101.2.1.1.6"
1941 #define szOID_INFOSEC_sdnsTokenProtection "2.16.840.1.101.2.1.1.7"
1942 #define szOID_INFOSEC_mosaicTokenProtection "2.16.840.1.101.2.1.1.8"
1943 #define szOID_INFOSEC_sdnsKeyManagement "2.16.840.1.101.2.1.1.9"
1944 #define szOID_INFOSEC_mosaicKeyManagement "2.16.840.1.101.2.1.1.10"
1945 #define szOID_INFOSEC_sdnsKMandSig "2.16.840.1.101.2.1.1.11"
1946 #define szOID_INFOSEC_mosaicKMandSig "2.16.840.1.101.2.1.1.12"
1947 #define szOID_INFOSEC_SuiteASignature "2.16.840.1.101.2.1.1.13"
1948 #define szOID_INFOSEC_SuiteAConfidentiality "2.16.840.1.101.2.1.1.14"
1949 #define szOID_INFOSEC_SuiteAIntegrity "2.16.840.1.101.2.1.1.15"
1950 #define szOID_INFOSEC_SuiteATokenProtection "2.16.840.1.101.2.1.1.16"
1951 #define szOID_INFOSEC_SuiteAKeyManagement "2.16.840.1.101.2.1.1.17"
1952 #define szOID_INFOSEC_SuiteAKMandSig "2.16.840.1.101.2.1.1.18"
1953 #define szOID_INFOSEC_mosaicUpdatedSig "2.16.840.1.101.2.1.1.19"
1954 #define szOID_INFOSEC_mosaicKMandUpdSig "2.16.840.1.101.2.1.1.20"
1955 #define szOID_INFOSEC_mosaicUpdateInteg "2.16.840.1.101.2.1.1.21"
1956 #define szOID_COMMON_NAME "2.5.4.3"
1957 #define szOID_SUR_NAME "2.5.4.4"
1958 #define szOID_DEVICE_SERIAL_NUMBER "2.5.4.5"
1959 #define szOID_COUNTRY_NAME "2.5.4.6"
1960 #define szOID_LOCALITY_NAME "2.5.4.7"
1961 #define szOID_STATE_OR_PROVINCE_NAME "2.5.4.8"
1962 #define szOID_STREET_ADDRESS "2.5.4.9"
1963 #define szOID_ORGANIZATION_NAME "2.5.4.10"
1964 #define szOID_ORGANIZATIONAL_UNIT_NAME "2.5.4.11"
1965 #define szOID_TITLE "2.5.4.12"
1966 #define szOID_DESCRIPTION "2.5.4.13"
1967 #define szOID_SEARCH_GUIDE "2.5.4.14"
1968 #define szOID_BUSINESS_CATEGORY "2.5.4.15"
1969 #define szOID_POSTAL_ADDRESS "2.5.4.16"
1970 #define szOID_POSTAL_CODE "2.5.4.17"
1971 #define szOID_POST_OFFICE_BOX "2.5.4.18"
1972 #define szOID_PHYSICAL_DELIVERY_OFFICE_NAME "2.5.4.19"
1973 #define szOID_TELEPHONE_NUMBER "2.5.4.20"
1974 #define szOID_TELEX_NUMBER "2.5.4.21"
1975 #define szOID_TELETEXT_TERMINAL_IDENTIFIER "2.5.4.22"
1976 #define szOID_FACSIMILE_TELEPHONE_NUMBER "2.5.4.23"
1977 #define szOID_X21_ADDRESS "2.5.4.24"
1978 #define szOID_INTERNATIONAL_ISDN_NUMBER "2.5.4.25"
1979 #define szOID_REGISTERED_ADDRESS "2.5.4.26"
1980 #define szOID_DESTINATION_INDICATOR "2.5.4.27"
1981 #define szOID_PREFERRED_DELIVERY_METHOD "2.5.4.28"
1982 #define szOID_PRESENTATION_ADDRESS "2.5.4.29"
1983 #define szOID_SUPPORTED_APPLICATION_CONTEXT "2.5.4.30"
1984 #define szOID_MEMBER "2.5.4.31"
1985 #define szOID_OWNER "2.5.4.32"
1986 #define szOID_ROLE_OCCUPANT "2.5.4.33"
1987 #define szOID_SEE_ALSO "2.5.4.34"
1988 #define szOID_USER_PASSWORD "2.5.4.35"
1989 #define szOID_USER_CERTIFICATE "2.5.4.36"
1990 #define szOID_CA_CERTIFICATE "2.5.4.37"
1991 #define szOID_AUTHORITY_REVOCATION_LIST "2.5.4.38"
1992 #define szOID_CERTIFICATE_REVOCATION_LIST "2.5.4.39"
1993 #define szOID_CROSS_CERTIFICATE_PAIR "2.5.4.40"
1994 #define szOID_GIVEN_NAME "2.5.4.42"
1995 #define szOID_INITIALS "2.5.4.43"
1996 #define szOID_DN_QUALIFIER "2.5.4.46"
1997 #define szOID_AUTHORITY_KEY_IDENTIFIER "2.5.29.1"
1998 #define szOID_KEY_ATTRIBUTES "2.5.29.2"
1999 #define szOID_CERT_POLICIES_95 "2.5.29.3"
2000 #define szOID_KEY_USAGE_RESTRICTION "2.5.29.4"
2001 #define szOID_LEGACY_POLICY_MAPPINGS "2.5.29.5"
2002 #define szOID_SUBJECT_ALT_NAME "2.5.29.7"
2003 #define szOID_ISSUER_ALT_NAME "2.5.29.8"
2004 #define szOID_SUBJECT_DIR_ATTRS "2.5.29.9"
2005 #define szOID_BASIC_CONSTRAINTS "2.5.29.10"
2006 #define szOID_SUBJECT_KEY_IDENTIFIER "2.5.29.14"
2007 #define szOID_KEY_USAGE "2.5.29.15"
2008 #define szOID_PRIVATEKEY_USAGE_PERIOD "2.5.29.16"
2009 #define szOID_SUBJECT_ALT_NAME2 "2.5.29.17"
2010 #define szOID_ISSUER_ALT_NAME2 "2.5.29.18"
2011 #define szOID_BASIC_CONSTRAINTS2 "2.5.29.19"
2012 #define szOID_CRL_NUMBER "2.5.29.20"
2013 #define szOID_CRL_REASON_CODE "2.5.29.21"
2014 #define szOID_REASON_CODE_HOLD "2.5.29.23"
2015 #define szOID_DELTA_CRL_INDICATOR "2.5.29.27"
2016 #define szOID_ISSUING_DIST_POINT "2.5.29.28"
2017 #define szOID_NAME_CONSTRAINTS "2.5.29.30"
2018 #define szOID_CRL_DIST_POINTS "2.5.29.31"
2019 #define szOID_CERT_POLICIES "2.5.29.32"
2020 #define szOID_ANY_CERT_POLICY "2.5.29.32.0"
2021 #define szOID_POLICY_MAPPINGS "2.5.29.33"
2022 #define szOID_AUTHORITY_KEY_IDENTIFIER2 "2.5.29.35"
2023 #define szOID_POLICY_CONSTRAINTS "2.5.29.36"
2024 #define szOID_ENHANCED_KEY_USAGE "2.5.29.37"
2025 #define szOID_FRESHEST_CRL "2.5.29.46"
2026 #define szOID_DOMAIN_COMPONENT "0.9.2342.19200300.100.1.25"
2027 #define szOID_PKCS_12_FRIENDLY_NAME_ATTR "1.2.840.113549.1.9.20"
2028 #define szOID_PKCS_12_LOCAL_KEY_ID "1.2.840.113549.1.9.21"
2029 #define szOID_CERT_EXTENSIONS "1.3.6.1.4.1.311.2.1.14"
2030 #define szOID_NEXT_UPDATE_LOCATION "1.3.6.1.4.1.311.10.2"
2031 #define szOID_REMOVE_CERTIFICATE "1.3.6.1.4.1.311.10.8.1"
2032 #define szOID_CROSS_CERT_DIST_POINTS "1.3.6.1.4.1.311.10.9.1"
2033 #define szOID_CTL "1.3.6.1.4.1.311.10.10.1"
2034 #define szOID_SORTED_CTL "1.3.6.1.4.1.311.10.10.1.1"
2035 #define szOID_ANY_APPLICATION_POLICY "1.3.6.1.4.1.311.10.12.1"
2036 #define szOID_RENEWAL_CERTIFICATE "1.3.6.1.4.1.311.13.1"
2037 #define szOID_ENROLLMENT_NAME_VALUE_PAIR "1.3.6.1.4.1.311.13.2.1"
2038 #define szOID_ENROLLMENT_CSP_PROVIDER "1.3.6.1.4.1.311.13.2.2"
2039 #define szOID_OS_VERSION "1.3.6.1.4.1.311.13.2.3"
2040 #define szOID_PKCS_12_KEY_PROVIDER_NAME_ATTR "1.3.6.1.4.1.311.17.1"
2041 #define szOID_LOCAL_MACHINE_KEYSET "1.3.6.1.4.1.311.17.2"
2042 #define szOID_AUTO_ENROLL_CTL_USAGE "1.3.6.1.4.1.311.20.1"
2043 #define szOID_ENROLL_CERTTYPE_EXTENSION "1.3.6.1.4.1.311.20.2"
2044 #define szOID_ENROLLMENT_AGENT "1.3.6.1.4.1.311.20.2.1"
2045 #define szOID_CERT_MANIFOLD "1.3.6.1.4.1.311.20.3"
2046 #define szOID_CERTSRV_PREVIOUS_CERT_HASH "1.3.6.1.4.1.311.21.2"
2047 #define szOID_CRL_VIRTUAL_BASE "1.3.6.1.4.1.311.21.3"
2048 #define szOID_CRL_NEXT_PUBLISH "1.3.6.1.4.1.311.21.4"
2049 #define szOID_KP_CA_EXCHANGE "1.3.6.1.4.1.311.21.5"
2050 #define szOID_KP_KEY_RECOVERY_AGENT "1.3.6.1.4.1.311.21.6"
2051 #define szOID_CERTIFICATE_TEMPLATE "1.3.6.1.4.1.311.21.7"
2052 #define szOID_ENTERPRISE_OID_ROOT "1.3.6.1.4.1.311.21.8"
2053 #define szOID_RDN_DUMMY_SIGNER "1.3.6.1.4.1.311.21.9"
2054 #define szOID_APPLICATION_CERT_POLICIES "1.3.6.1.4.1.311.21.10"
2055 #define szOID_APPLICATION_POLICY_MAPPINGS "1.3.6.1.4.1.311.21.11"
2056 #define szOID_APPLICATION_POLICY_CONSTRAINTS "1.3.6.1.4.1.311.21.12"
2057 #define szOID_ARCHIVED_KEY_ATTR "1.3.6.1.4.1.311.21.13"
2058 #define szOID_CRL_SELF_CDP "1.3.6.1.4.1.311.21.14"
2059 #define szOID_REQUIRE_CERT_CHAIN_POLICY "1.3.6.1.4.1.311.21.15"
2060 #define szOID_ARCHIVED_KEY_CERT_HASH "1.3.6.1.4.1.311.21.16"
2061 #define szOID_ISSUED_CERT_HASH "1.3.6.1.4.1.311.21.17"
2062 #define szOID_DS_EMAIL_REPLICATION "1.3.6.1.4.1.311.21.19"
2063 #define szOID_REQUEST_CLIENT_INFO "1.3.6.1.4.1.311.21.20"
2064 #define szOID_ENCRYPTED_KEY_HASH "1.3.6.1.4.1.311.21.21"
2065 #define szOID_CERTSRV_CROSSCA_VERSION "1.3.6.1.4.1.311.21.22"
2066 #define szOID_KEYID_RDN "1.3.6.1.4.1.311.10.7.1"
2067 #define szOID_PKIX "1.3.6.1.5.5.7"
2068 #define szOID_PKIX_PE "1.3.6.1.5.5.7.1"
2069 #define szOID_AUTHORITY_INFO_ACCESS "1.3.6.1.5.5.7.1.1"
2070 #define szOID_PKIX_POLICY_QUALIFIER_CPS "1.3.6.1.5.5.7.2.1"
2071 #define szOID_PKIX_POLICY_QUALIFIER_USERNOTICE "1.3.6.1.5.5.7.2.2"
2072 #define szOID_PKIX_KP "1.3.6.1.5.5.7.3"
2073 #define szOID_PKIX_KP_SERVER_AUTH "1.3.6.1.5.5.7.3.1"
2074 #define szOID_PKIX_KP_CLIENT_AUTH "1.3.6.1.5.5.7.3.2"
2075 #define szOID_PKIX_KP_CODE_SIGNING "1.3.6.1.5.5.7.3.3"
2076 #define szOID_PKIX_KP_EMAIL_PROTECTION "1.3.6.1.5.5.7.3.4"
2077 #define szOID_PKIX_KP_IPSEC_END_SYSTEM "1.3.6.1.5.5.7.3.5"
2078 #define szOID_PKIX_KP_IPSEC_TUNNEL "1.3.6.1.5.5.7.3.6"
2079 #define szOID_PKIX_KP_IPSEC_USER "1.3.6.1.5.5.7.3.7"
2080 #define szOID_PKIX_KP_TIMESTAMP_SIGNING "1.3.6.1.5.5.7.3.8"
2081 #define szOID_IPSEC_KP_IKE_INTERMEDIATE "1.3.6.1.5.5.8.2.2"
2083 #ifndef szOID_SERIALIZED
2084 #define szOID_SERIALIZED "1.3.6.1.4.1.311.10.3.3.1"
2085 #endif
2087 #ifndef szOID_NT_PRINCIPAL_NAME
2088 #define szOID_NT_PRINCIPAL_NAME "1.3.6.1.4.1.311.20.2.3"
2089 #endif
2091 #ifndef szOID_CERTSRV_CA_VERSION
2092 #define szOID_CERTSRV_CA_VERSION "1.3.6.1.4.1.311.21.1"
2093 #endif
2095 #ifndef szOID_PRODUCT_UPDATE
2096 #define szOID_PRODUCT_UPDATE "1.3.6.1.4.1.311.31.1"
2097 #endif
2099 #define CRYPT_ENCODE_DECODE_NONE 0
2100 #define X509_CERT ((LPCSTR)1)
2101 #define X509_CERT_TO_BE_SIGNED ((LPCSTR)2)
2102 #define X509_CERT_CRL_TO_BE_SIGNED ((LPCSTR)3)
2103 #define X509_CERT_REQUEST_TO_BE_SIGNED ((LPCSTR)4)
2104 #define X509_EXTENSIONS ((LPCSTR)5)
2105 #define X509_NAME_VALUE ((LPCSTR)6)
2106 #define X509_ANY_STRING X509_NAME_VALUE
2107 #define X509_NAME ((LPCSTR)7)
2108 #define X509_PUBLIC_KEY_INFO ((LPCSTR)8)
2109 #define X509_AUTHORITY_KEY_ID ((LPCSTR)9)
2110 #define X509_KEY_ATTRIBUTES ((LPCSTR)10)
2111 #define X509_KEY_USAGE_RESTRICTION ((LPCSTR)11)
2112 #define X509_ALTERNATE_NAME ((LPCSTR)12)
2113 #define X509_BASIC_CONSTRAINTS ((LPCSTR)13)
2114 #define X509_KEY_USAGE ((LPCSTR)14)
2115 #define X509_BASIC_CONSTRAINTS2 ((LPCSTR)15)
2116 #define X509_CERT_POLICIES ((LPCSTR)16)
2117 #define PKCS_UTC_TIME ((LPCSTR)17)
2118 #define PKCS_TIME_REQUEST ((LPCSTR)18)
2119 #define RSA_CSP_PUBLICKEYBLOB ((LPCSTR)19)
2120 #define X509_UNICODE_NAME ((LPCSTR)20)
2121 #define X509_KEYGEN_REQUEST_TO_BE_SIGNED ((LPCSTR)21)
2122 #define PKCS_ATTRIBUTE ((LPCSTR)22)
2123 #define PKCS_CONTENT_INFO_SEQUENCE_OF_ANY ((LPCSTR)23)
2124 #define X509_UNICODE_NAME_VALUE ((LPCSTR)24)
2125 #define X509_UNICODE_ANY_STRING X509_UNICODE_NAME_VALUE
2126 #define X509_OCTET_STRING ((LPCSTR)25)
2127 #define X509_BITS ((LPCSTR)26)
2128 #define X509_INTEGER ((LPCSTR)27)
2129 #define X509_MULTI_BYTE_INTEGER ((LPCSTR)28)
2130 #define X509_ENUMERATED ((LPCSTR)29)
2131 #define X509_CRL_REASON_CODE X509_ENUMERATED
2132 #define X509_CHOICE_OF_TIME ((LPCSTR)30)
2133 #define X509_AUTHORITY_KEY_ID2 ((LPCSTR)31)
2134 #define X509_AUTHORITY_INFO_ACCESS ((LPCSTR)32)
2135 #define PKCS_CONTENT_INFO ((LPCSTR)33)
2136 #define X509_SEQUENCE_OF_ANY ((LPCSTR)34)
2137 #define X509_CRL_DIST_POINTS ((LPCSTR)35)
2138 #define X509_ENHANCED_KEY_USAGE ((LPCSTR)36)
2139 #define PKCS_CTL ((LPCSTR)37)
2140 #define X509_MULTI_BYTE_UINT ((LPCSTR)38)
2141 #define X509_DSS_PUBLICKEY X509_MULTI_BYTE_UINT
2142 #define X509_DSS_PARAMETERS ((LPCSTR)39)
2143 #define X509_DSS_SIGNATURE ((LPCSTR)40)
2144 #define PKCS_RC2_CBC_PARAMETERS ((LPCSTR)41)
2145 #define PKCS_SMIME_CAPABILITIES ((LPCSTR)42)
2146 #define PKCS_RSA_PRIVATE_KEY ((LPCSTR)43)
2147 #define PKCS_PRIVATE_KEY_INFO ((LPCSTR)44)
2148 #define PKCS_ENCRYPTED_PRIVATE_KEY_INFO ((LPCSTR)45)
2149 #define X509_PKIX_POLICY_QUALIFIER_USERNOTICE ((LPCSTR)46)
2150 #define X509_DH_PUBLICKEY X509_MULTI_BYTE_UINT
2151 #define X509_DH_PARAMETERS ((LPCSTR)47)
2152 #define PKCS_ATTRIBUTES ((LPCSTR)48)
2153 #define PKCS_SORTED_CTL ((LPCSTR)49)
2154 #define X942_DH_PARAMETERS ((LPCSTR)50)
2155 #define X509_BITS_WITHOUT_TRAILING_ZEROES ((LPCSTR)51)
2156 #define X942_OTHER_INFO ((LPCSTR)52)
2157 #define X509_CERT_PAIR ((LPCSTR)53)
2158 #define X509_ISSUING_DIST_POINT ((LPCSTR)54)
2159 #define X509_NAME_CONSTRAINTS ((LPCSTR)55)
2160 #define X509_POLICY_MAPPINGS ((LPCSTR)56)
2161 #define X509_POLICY_CONSTRAINTS ((LPCSTR)57)
2162 #define X509_CROSS_CERT_DIST_POINTS ((LPCSTR)58)
2163 #define CMC_DATA ((LPCSTR)59)
2164 #define CMC_RESPONSE ((LPCSTR)60)
2165 #define CMC_STATUS ((LPCSTR)61)
2166 #define CMC_ADD_EXTENSIONS ((LPCSTR)62)
2167 #define CMC_ADD_ATTRIBUTES ((LPCSTR)63)
2168 #define X509_CERTIFICATE_TEMPLATE ((LPCSTR)64)
2169 #define PKCS7_SIGNER_INFO ((LPCSTR)500)
2170 #define CMS_SIGNER_INFO ((LPCSTR)501)
2172 /* encode/decode flags */
2173 #define CRYPT_ENCODE_NO_SIGNATURE_BYTE_REVERSAL_FLAG 0x00008
2174 #define CRYPT_ENCODE_ALLOC_FLAG 0x08000
2175 #define CRYPT_SORTED_CTL_ENCODE_HASHED_SUBJECT_IDENTIFIER_FLAG 0x10000
2176 #define CRYPT_UNICODE_NAME_ENCODE_ENABLE_T61_UNICODE_FLAG \
2177 CERT_RDN_ENABLE_T61_UNICODE_FLAG
2178 #define CRYPT_UNICODE_NAME_ENCODE_ENABLE_UTF8_UNICODE_FLAG \
2179 CERT_RDN_ENABLE_UTF8_UNICODE_FLAG
2180 #define CRYPT_UNICODE_NAME_ENCODE_DISABLE_CHECK_TYPE_FLAG \
2181 CERT_RDN_DISABLE_CHECK_TYPE_FLAG
2183 #define CRYPT_DECODE_NOCOPY_FLAG 0x00001
2184 #define CRYPT_DECODE_TO_BE_SIGNED_FLAG 0x00002
2185 #define CRYPT_DECODE_SHARE_OID_STRING_FLAG 0x00004
2186 #define CRYPT_DECODE_NO_SIGNATURE_BYTE_REVERSAL_FLAG 0x00008
2187 #define CRYPT_DECODE_ALLOC_FLAG 0x08000
2188 #define CRYPT_UNICODE_NAME_DECODE_DISABLE_IE4_UTF8_FLAG \
2189 CERT_RDN_DISABLE_IE4_UTF8_FLAG
2191 /* subject types for CryptVerifyCertificateSignatureEx */
2192 #define CRYPT_VERIFY_CERT_SIGN_SUBJECT_BLOB 1
2193 #define CRYPT_VERIFY_CERT_SIGN_SUBJECT_CERT 2
2194 #define CRYPT_VERIFY_CERT_SIGN_SUBJECT_CRL 3
2196 /* issuer types for CryptVerifyCertificateSignatureEx */
2197 #define CRYPT_VERIFY_CERT_SIGN_ISSUER_PUBKEY 1
2198 #define CRYPT_VERIFY_CERT_SIGN_ISSUER_CERT 2
2199 #define CRYPT_VERIFY_CERT_SIGN_ISSUER_CHAIN 3
2200 #define CRYPT_VERIFY_CERT_SIGN_ISSUER_NULL 4
2202 /* function declarations */
2203 /* advapi32.dll */
2204 BOOL WINAPI CryptAcquireContextA(HCRYPTPROV *phProv, LPCSTR pszContainer,
2205 LPCSTR pszProvider, DWORD dwProvType,
2206 DWORD dwFlags);
2207 BOOL WINAPI CryptAcquireContextW (HCRYPTPROV *phProv, LPCWSTR pszContainer,
2208 LPCWSTR pszProvider, DWORD dwProvType, DWORD dwFlags);
2209 #define CryptAcquireContext WINELIB_NAME_AW(CryptAcquireContext)
2210 BOOL WINAPI CryptGenRandom (HCRYPTPROV hProv, DWORD dwLen, BYTE *pbBuffer);
2211 BOOL WINAPI CryptContextAddRef (HCRYPTPROV hProv, DWORD *pdwReserved, DWORD dwFlags);
2212 BOOL WINAPI CryptCreateHash (HCRYPTPROV hProv, ALG_ID Algid, HCRYPTKEY hKey,
2213 DWORD dwFlags, HCRYPTHASH *phHash);
2214 BOOL WINAPI CryptDecrypt (HCRYPTKEY hKey, HCRYPTHASH hHash, BOOL Final,
2215 DWORD dwFlags, BYTE *pbData, DWORD *pdwDataLen);
2216 BOOL WINAPI CryptDeriveKey (HCRYPTPROV hProv, ALG_ID Algid, HCRYPTHASH hBaseData,
2217 DWORD dwFlags, HCRYPTKEY *phKey);
2218 BOOL WINAPI CryptDestroyHash (HCRYPTHASH hHash);
2219 BOOL WINAPI CryptDestroyKey (HCRYPTKEY hKey);
2220 BOOL WINAPI CryptDuplicateKey (HCRYPTKEY hKey, DWORD *pdwReserved, DWORD dwFlags, HCRYPTKEY *phKey);
2221 BOOL WINAPI CryptDuplicateHash (HCRYPTHASH hHash, DWORD *pdwReserved,
2222 DWORD dwFlags, HCRYPTHASH *phHash);
2223 BOOL WINAPI CryptEncrypt (HCRYPTKEY hKey, HCRYPTHASH hHash, BOOL Final,
2224 DWORD dwFlags, BYTE *pbData, DWORD *pdwDataLen, DWORD dwBufLen);
2225 BOOL WINAPI CryptEnumProvidersA (DWORD dwIndex, DWORD *pdwReserved,
2226 DWORD dwFlags, DWORD *pdwProvType, LPSTR pszProvName, DWORD *pcbProvName);
2227 BOOL WINAPI CryptEnumProvidersW (DWORD dwIndex, DWORD *pdwReserved,
2228 DWORD dwFlags, DWORD *pdwProvType, LPWSTR pszProvName, DWORD *pcbProvName);
2229 #define CryptEnumProviders WINELIB_NAME_AW(CryptEnumProviders)
2230 BOOL WINAPI CryptEnumProviderTypesA (DWORD dwIndex, DWORD *pdwReserved,
2231 DWORD dwFlags, DWORD *pdwProvType, LPSTR pszTypeName, DWORD *pcbTypeName);
2232 BOOL WINAPI CryptEnumProviderTypesW (DWORD dwIndex, DWORD *pdwReserved,
2233 DWORD dwFlags, DWORD *pdwProvType, LPWSTR pszTypeName, DWORD *pcbTypeName);
2234 #define CryptEnumProviderTypes WINELIB_NAME_AW(CryptEnumProviderTypes)
2235 BOOL WINAPI CryptExportKey (HCRYPTKEY hKey, HCRYPTKEY hExpKey, DWORD dwBlobType,
2236 DWORD dwFlags, BYTE *pbData, DWORD *pdwDataLen);
2237 BOOL WINAPI CryptGenKey (HCRYPTPROV hProv, ALG_ID Algid, DWORD dwFlags, HCRYPTKEY *phKey);
2238 BOOL WINAPI CryptGetKeyParam (HCRYPTKEY hKey, DWORD dwParam, BYTE *pbData,
2239 DWORD *pdwDataLen, DWORD dwFlags);
2240 BOOL WINAPI CryptGetHashParam (HCRYPTHASH hHash, DWORD dwParam, BYTE *pbData,
2241 DWORD *pdwDataLen, DWORD dwFlags);
2242 BOOL WINAPI CryptGetProvParam (HCRYPTPROV hProv, DWORD dwParam, BYTE *pbData,
2243 DWORD *pdwDataLen, DWORD dwFlags);
2244 BOOL WINAPI CryptGetDefaultProviderA (DWORD dwProvType, DWORD *pdwReserved,
2245 DWORD dwFlags, LPSTR pszProvName, DWORD *pcbProvName);
2246 BOOL WINAPI CryptGetDefaultProviderW (DWORD dwProvType, DWORD *pdwReserved,
2247 DWORD dwFlags, LPWSTR pszProvName, DWORD *pcbProvName);
2248 #define CryptGetDefaultProvider WINELIB_NAME_AW(CryptGetDefaultProvider)
2249 BOOL WINAPI CryptGetUserKey (HCRYPTPROV hProv, DWORD dwKeySpec, HCRYPTKEY *phUserKey);
2250 BOOL WINAPI CryptHashData (HCRYPTHASH hHash, const BYTE *pbData, DWORD dwDataLen, DWORD dwFlags);
2251 BOOL WINAPI CryptHashSessionKey (HCRYPTHASH hHash, HCRYPTKEY hKey, DWORD dwFlags);
2252 BOOL WINAPI CryptImportKey (HCRYPTPROV hProv, BYTE *pbData, DWORD dwDataLen,
2253 HCRYPTKEY hPubKey, DWORD dwFlags, HCRYPTKEY *phKey);
2254 BOOL WINAPI CryptReleaseContext (HCRYPTPROV hProv, DWORD dwFlags);
2255 BOOL WINAPI CryptSetHashParam (HCRYPTHASH hHash, DWORD dwParam, BYTE *pbData, DWORD dwFlags);
2256 BOOL WINAPI CryptSetKeyParam (HCRYPTKEY hKey, DWORD dwParam, BYTE *pbData, DWORD dwFlags);
2257 BOOL WINAPI CryptSetProviderA (LPCSTR pszProvName, DWORD dwProvType);
2258 BOOL WINAPI CryptSetProviderW (LPCWSTR pszProvName, DWORD dwProvType);
2259 #define CryptSetProvider WINELIB_NAME_AW(CryptSetProvider)
2260 BOOL WINAPI CryptSetProviderExA (LPCSTR pszProvName, DWORD dwProvType, DWORD *pdwReserved, DWORD dwFlags);
2261 BOOL WINAPI CryptSetProviderExW (LPCWSTR pszProvName, DWORD dwProvType, DWORD *pdwReserved, DWORD dwFlags);
2262 #define CryptSetProviderEx WINELIB_NAME_AW(CryptSetProviderEx)
2263 BOOL WINAPI CryptSetProvParam (HCRYPTPROV hProv, DWORD dwParam, BYTE *pbData, DWORD dwFlags);
2264 BOOL WINAPI CryptSignHashA (HCRYPTHASH hHash, DWORD dwKeySpec, LPCSTR sDescription,
2265 DWORD dwFlags, BYTE *pbSignature, DWORD *pdwSigLen);
2266 BOOL WINAPI CryptSignHashW (HCRYPTHASH hHash, DWORD dwKeySpec, LPCWSTR sDescription,
2267 DWORD dwFlags, BYTE *pbSignature, DWORD *pdwSigLen);
2268 #define CryptSignHash WINELIB_NAME_AW(CryptSignHash)
2269 BOOL WINAPI CryptVerifySignatureA (HCRYPTHASH hHash, BYTE *pbSignature, DWORD dwSigLen,
2270 HCRYPTKEY hPubKey, LPCSTR sDescription, DWORD dwFlags);
2271 BOOL WINAPI CryptVerifySignatureW (HCRYPTHASH hHash, BYTE *pbSignature, DWORD dwSigLen,
2272 HCRYPTKEY hPubKey, LPCWSTR sDescription, DWORD dwFlags);
2273 #define CryptVerifySignature WINELIB_NAME_AW(CryptVerifySignature)
2275 /* crypt32.dll functions */
2276 LPVOID WINAPI CryptMemAlloc(ULONG cbSize);
2277 LPVOID WINAPI CryptMemRealloc(LPVOID pv, ULONG cbSize);
2278 VOID WINAPI CryptMemFree(LPVOID pv);
2280 BOOL WINAPI CryptRegisterOIDFunction(DWORD,LPCSTR,LPCSTR,LPCWSTR,LPCSTR);
2281 BOOL WINAPI CryptGetOIDFunctionValue(DWORD dwEncodingType, LPCSTR pszFuncName,
2282 LPCSTR pszOID, LPCWSTR szValueName, DWORD *pdwValueType,
2283 BYTE *pbValueData, DWORD *pcbValueData);
2284 BOOL WINAPI CryptSetOIDFunctionValue(DWORD dwEncodingType, LPCSTR pszFuncName,
2285 LPCSTR pszOID, LPCWSTR pwszValueName, DWORD dwValueType,
2286 const BYTE *pbValueData, DWORD cbValueData);
2287 BOOL WINAPI CryptUnregisterOIDFunction(DWORD,LPCSTR,LPCSTR);
2289 LPCSTR WINAPI CertAlgIdToOID(DWORD dwAlgId);
2290 DWORD WINAPI CertOIDToAlgId(LPCSTR pszObjId);
2292 /* cert store functions */
2293 HCERTSTORE WINAPI CertOpenStore(LPCSTR lpszStoreProvider, DWORD dwEncodingType,
2294 HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara);
2296 HCERTSTORE WINAPI CertOpenSystemStoreA(HCRYPTPROV hProv,
2297 LPCSTR szSubSystemProtocol);
2298 HCERTSTORE WINAPI CertOpenSystemStoreW(HCRYPTPROV hProv,
2299 LPCWSTR szSubSystemProtocol);
2300 #define CertOpenSystemStore WINELIB_NAME_AW(CertOpenSystemStore)
2302 PCCERT_CONTEXT WINAPI CertEnumCertificatesInStore(HCERTSTORE hCertStore,
2303 PCCERT_CONTEXT pPrev);
2305 PCCRL_CONTEXT WINAPI CertEnumCRLsInStore(HCERTSTORE hCertStore,
2306 PCCRL_CONTEXT pPrev);
2308 PCCTL_CONTEXT WINAPI CertEnumCTLsInStore(HCERTSTORE hCertStore,
2309 PCCTL_CONTEXT pPrev);
2311 BOOL WINAPI CertEnumSystemStoreLocation(DWORD dwFlags, void *pvArg,
2312 PFN_CERT_ENUM_SYSTEM_STORE_LOCATION pfnEnum);
2314 BOOL WINAPI CertEnumSystemStore(DWORD dwFlags, void *pvSystemStoreLocationPara,
2315 void *pvArg, PFN_CERT_ENUM_SYSTEM_STORE pfnEnum);
2317 BOOL WINAPI CertEnumPhysicalStore(const void *pvSystemStore, DWORD dwFlags,
2318 void *pvArg, PFN_CERT_ENUM_PHYSICAL_STORE pfnEnum);
2320 BOOL WINAPI CertSaveStore(HCERTSTORE hCertStore, DWORD dwMsgAndCertEncodingType,
2321 DWORD dwSaveAs, DWORD dwSaveTo, void* pvSaveToPara, DWORD dwFlags);
2323 BOOL WINAPI CertAddStoreToCollection(HCERTSTORE hCollectionStore,
2324 HCERTSTORE hSiblingStore, DWORD dwUpdateFlags, DWORD dwPriority);
2326 void WINAPI CertRemoveStoreFromCollection(HCERTSTORE hCollectionStore,
2327 HCERTSTORE hSiblingStore);
2329 PCCERT_CHAIN_CONTEXT WINAPI CertFindChainInStore(HCERTSTORE hCertStore,
2330 DWORD dwCertEncodingType, DWORD dwFindFlags, DWORD dwFindType,
2331 const void *pvFindPara, PCCERT_CHAIN_CONTEXT pPrevChainContext);
2333 BOOL WINAPI CertVerifyCertificateChainPolicy(LPCSTR szPolicyOID,
2334 PCCERT_CHAIN_CONTEXT pChainContext, PCERT_CHAIN_POLICY_PARA pPolicyPara,
2335 PCERT_CHAIN_POLICY_STATUS pPolicyStatus);
2337 DWORD WINAPI CertEnumCertificateContextProperties(PCCERT_CONTEXT pCertContext,
2338 DWORD dwPropId);
2340 BOOL WINAPI CertGetCertificateContextProperty(PCCERT_CONTEXT pCertContext,
2341 DWORD dwPropId, void *pvData, DWORD *pcbData);
2343 BOOL WINAPI CertSetCertificateContextProperty(PCCERT_CONTEXT pCertContext,
2344 DWORD dwPropId, DWORD dwFlags, const void *pvData);
2346 DWORD WINAPI CertEnumCRLContextProperties(PCCRL_CONTEXT pCRLContext,
2347 DWORD dwPropId);
2349 BOOL WINAPI CertGetCRLContextProperty(PCCRL_CONTEXT pCRLContext,
2350 DWORD dwPropId, void *pvData, DWORD *pcbData);
2352 BOOL WINAPI CertSetCRLContextProperty(PCCRL_CONTEXT pCRLContext,
2353 DWORD dwPropId, DWORD dwFlags, const void *pvData);
2355 DWORD WINAPI CertEnumCTLContextProperties(PCCTL_CONTEXT pCTLContext,
2356 DWORD dwPropId);
2358 BOOL WINAPI CertGetCTLContextProperty(PCCTL_CONTEXT pCTLContext,
2359 DWORD dwPropId, void *pvData, DWORD *pcbData);
2361 BOOL WINAPI CertSetCTLContextProperty(PCCTL_CONTEXT pCTLContext,
2362 DWORD dwPropId, DWORD dwFlags, const void *pvData);
2364 BOOL WINAPI CertGetStoreProperty(HCERTSTORE hCertStore, DWORD dwPropId,
2365 void *pvData, DWORD *pcbData);
2367 BOOL WINAPI CertSetStoreProperty(HCERTSTORE hCertStore, DWORD dwPropId,
2368 DWORD dwFlags, const void *pvData);
2370 BOOL WINAPI CertControlStore(HCERTSTORE hCertStore, DWORD dwFlags,
2371 DWORD dwCtrlType, void const *pvCtrlPara);
2373 BOOL WINAPI CertCloseStore( HCERTSTORE hCertStore, DWORD dwFlags );
2375 BOOL WINAPI CertFreeCertificateContext( PCCERT_CONTEXT pCertContext );
2377 BOOL WINAPI CertFreeCRLContext( PCCRL_CONTEXT pCrlContext );
2379 BOOL WINAPI CertFreeCTLContext( PCCTL_CONTEXT pCtlContext );
2381 BOOL WINAPI CertAddCertificateContextToStore(HCERTSTORE hCertStore,
2382 PCCERT_CONTEXT pCertContext, DWORD dwAddDisposition,
2383 PCCERT_CONTEXT *ppStoreContext);
2385 BOOL WINAPI CertAddCRLContextToStore( HCERTSTORE hCertStore,
2386 PCCRL_CONTEXT pCrlContext, DWORD dwAddDisposition,
2387 PCCRL_CONTEXT *ppStoreContext );
2389 BOOL WINAPI CertAddCTLContextToStore( HCERTSTORE hCertStore,
2390 PCCTL_CONTEXT pCtlContext, DWORD dwAddDisposition,
2391 PCCTL_CONTEXT *ppStoreContext );
2393 BOOL WINAPI CertAddCertificateLinkToStore(HCERTSTORE hCertStore,
2394 PCCERT_CONTEXT pCertContext, DWORD dwAddDisposition,
2395 PCCERT_CONTEXT *ppStoreContext);
2397 BOOL WINAPI CertAddCRLLinkToStore(HCERTSTORE hCertStore,
2398 PCCRL_CONTEXT pCrlContext, DWORD dwAddDisposition,
2399 PCCRL_CONTEXT *ppStoreContext);
2401 BOOL WINAPI CertAddCTLLinkToStore(HCERTSTORE hCertStore,
2402 PCCTL_CONTEXT pCtlContext, DWORD dwAddDisposition,
2403 PCCTL_CONTEXT *ppStoreContext);
2405 BOOL WINAPI CertAddEncodedCertificateToStore(HCERTSTORE hCertStore,
2406 DWORD dwCertEncodingType, const BYTE *pbCertEncoded, DWORD cbCertEncoded,
2407 DWORD dwAddDisposition, PCCERT_CONTEXT *ppCertContext);
2409 BOOL WINAPI CertAddEncodedCRLToStore(HCERTSTORE hCertStore,
2410 DWORD dwCertEncodingType, const BYTE *pbCrlEncoded, DWORD cbCrlEncoded,
2411 DWORD dwAddDisposition, PCCRL_CONTEXT *ppCrlContext);
2413 BOOL WINAPI CertAddEncodedCTLToStore(HCERTSTORE hCertStore,
2414 DWORD dwMsgAndCertEncodingType, const BYTE *pbCtlEncoded, DWORD cbCtlEncoded,
2415 DWORD dwAddDisposition, PCCTL_CONTEXT *ppCtlContext);
2417 BOOL WINAPI CertAddSerializedElementToStore(HCERTSTORE hCertStore,
2418 const BYTE *pbElement, DWORD cbElement, DWORD dwAddDisposition, DWORD dwFlags,
2419 DWORD dwContextTypeFlags, DWORD *pdwContentType, const void **ppvContext);
2421 const void *CertCreateContext(DWORD dwContextType, DWORD dwEncodingType,
2422 const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags,
2423 PCERT_CREATE_CONTEXT_PARA pCreatePara);
2425 PCCERT_CONTEXT WINAPI CertCreateCertificateContext(DWORD dwCertEncodingType,
2426 const BYTE *pbCertEncoded, DWORD cbCertEncoded);
2428 PCCRL_CONTEXT WINAPI CertCreateCRLContext( DWORD dwCertEncodingType,
2429 const BYTE* pbCrlEncoded, DWORD cbCrlEncoded);
2431 PCCTL_CONTEXT WINAPI CertCreateCTLContext(DWORD dwMsgAndCertEncodingType,
2432 const BYTE *pbCtlEncoded, DWORD cbCtlEncoded);
2434 BOOL WINAPI CertDeleteCertificateFromStore(PCCERT_CONTEXT pCertContext);
2436 BOOL WINAPI CertDeleteCRLFromStore(PCCRL_CONTEXT pCrlContext);
2438 BOOL WINAPI CertDeleteCTLFromStore(PCCTL_CONTEXT pCtlContext);
2440 PCCERT_CONTEXT WINAPI CertDuplicateCertificateContext(
2441 PCCERT_CONTEXT pCertContext);
2443 PCCRL_CONTEXT WINAPI CertDuplicateCRLContext(PCCRL_CONTEXT pCrlContext);
2445 PCCTL_CONTEXT WINAPI CertDuplicateCTLContext(PCCTL_CONTEXT pCtlContext);
2447 PCCERT_CONTEXT WINAPI CertFindCertificateInStore( HCERTSTORE hCertStore,
2448 DWORD dwCertEncodingType, DWORD dwFindFlags, DWORD dwFindType,
2449 const void *pvFindPara, PCCERT_CONTEXT pPrevCertContext );
2451 PCCRL_CONTEXT WINAPI CertFindCRLInStore(HCERTSTORE hCertStore,
2452 DWORD dwCertEncodingType, DWORD dwFindFlags, DWORD dwFindType,
2453 const void *pvFindPara, PCCRL_CONTEXT pPrevCrlContext);
2455 PCCTL_CONTEXT WINAPI CertFindCTLInStore(HCERTSTORE hCertStore,
2456 DWORD dwCertEncodingType, DWORD dwFindFlags, DWORD dwFindType,
2457 const void *pvFindPara, PCCTL_CONTEXT pPrevCtlContext);
2459 BOOL WINAPI CertSerializeCertificateStoreElement(PCCERT_CONTEXT pCertContext,
2460 DWORD dwFlags, BYTE *pbElement, DWORD *pcbElement);
2462 BOOL WINAPI CertSerializeCRLStoreElement(PCCRL_CONTEXT pCrlContext,
2463 DWORD dwFlags, BYTE *pbElement, DWORD *pcbElement);
2465 BOOL WINAPI CertSerializeCTLStoreElement(PCCTL_CONTEXT pCtlContext,
2466 DWORD dwFlags, BYTE *pbElement, DWORD *pcbElement);
2468 BOOL WINAPI CryptEncodeObject(DWORD dwCertEncodingType, LPCSTR lpszStructType,
2469 const void *pvStructInfo, BYTE *pbEncoded, DWORD *pcbEncoded);
2470 BOOL WINAPI CryptEncodeObjectEx(DWORD dwCertEncodingType, LPCSTR lpszStructType,
2471 const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara,
2472 void *pvEncoded, DWORD *pcbEncoded);
2474 BOOL WINAPI CryptDecodeObject(DWORD dwCertEncodingType, LPCSTR lpszStructType,
2475 const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo,
2476 DWORD *pcbStructInfo);
2477 BOOL WINAPI CryptDecodeObjectEx(DWORD dwCertEncodingType, LPCSTR lpszStructType,
2478 const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags,
2479 PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo);
2481 BOOL WINAPI CryptHashCertificate(HCRYPTPROV hCryptProv, ALG_ID Algid,
2482 DWORD dwFlags, const BYTE *pbEncoded, DWORD cbEncoded, BYTE *pbComputedHash,
2483 DWORD *pcbComputedHash);
2485 BOOL WINAPI CryptHashToBeSigned(HCRYPTPROV hCryptProv, DWORD dwCertEncodingType,
2486 const BYTE *pbEncoded, DWORD cbEncoded, BYTE *pbComputedHash,
2487 DWORD *pcbComputedHash);
2489 BOOL WINAPI CryptSignCertificate(HCRYPTPROV hCryptProv, DWORD dwKeySpec,
2490 DWORD dwCertEncodingType, const BYTE *pbEncodedToBeSigned,
2491 DWORD cbEncodedToBeSigned, PCRYPT_ALGORITHM_IDENTIFIER pSignatureAlgorithm,
2492 const void *pvHashAuxInfo, BYTE *pbSignature, DWORD *pcbSignature);
2494 BOOL WINAPI CryptSignAndEncodeCertificate(HCRYPTPROV hCryptProv,
2495 DWORD dwKeySpec, DWORD dwCertEncodingType, LPCSTR lpszStructType,
2496 const void *pvStructInfo, PCRYPT_ALGORITHM_IDENTIFIER pSignatureAlgorithm,
2497 const void *pvHashAuxInfo, PBYTE pbEncoded, DWORD *pcbEncoded);
2499 BOOL WINAPI CryptVerifyCertificateSignature(HCRYPTPROV hCryptProv,
2500 DWORD dwCertEncodingType, const BYTE *pbEncoded, DWORD cbEncoded,
2501 PCERT_PUBLIC_KEY_INFO pPublicKey);
2503 BOOL WINAPI CryptVerifyCertificateSignatureEx(HCRYPTPROV hCryptProv,
2504 DWORD dwCertEncodingType, DWORD dwSubjectType, void *pvSubject,
2505 DWORD dwIssuerType, void *pvIssuer, DWORD dwFlags, void *pvReserved);
2507 PCRYPT_ATTRIBUTE WINAPI CertFindAttribute(LPCSTR pszObjId, DWORD cAttr,
2508 CRYPT_ATTRIBUTE rgAttr[]);
2509 PCERT_EXTENSION WINAPI CertFindExtension(LPCSTR pszObjId, DWORD cExtensions,
2510 CERT_EXTENSION rgExtensions[]);
2511 PCERT_RDN_ATTR WINAPI CertFindRDNAttr(LPCSTR pszObjId, PCERT_NAME_INFO pName);
2513 LONG WINAPI CertVerifyTimeValidity(LPFILETIME pTimeToVerify,
2514 PCERT_INFO pCertInfo);
2516 BOOL WINAPI CryptExportPublicKeyInfo(HCRYPTPROV hCryptProv, DWORD dwKeySpec,
2517 DWORD dwCertEncodingType, PCERT_PUBLIC_KEY_INFO pInfo, DWORD *pcbInfo);
2518 BOOL WINAPI CryptExportPublicKeyInfoEx(HCRYPTPROV hCryptProv, DWORD dwKeySpec,
2519 DWORD dwCertEncodingType, LPSTR pszPublicKeyObjId, DWORD dwFlags,
2520 void *pvAuxInfo, PCERT_PUBLIC_KEY_INFO pInfo, DWORD *pcbInfo);
2521 BOOL WINAPI CryptImportPublicKeyInfo(HCRYPTPROV hCryptProv,
2522 DWORD dwCertEncodingType, PCERT_PUBLIC_KEY_INFO pInfo, HCRYPTKEY *phKey);
2523 BOOL WINAPI CryptImportPublicKeyInfoEx(HCRYPTPROV hCryptProv,
2524 DWORD dwCertEncodingType, PCERT_PUBLIC_KEY_INFO pInfo, ALG_ID aiKeyAlg,
2525 DWORD dwFlags, void *pvAuxInfo, HCRYPTKEY *phKey);
2527 BOOL WINAPI CryptProtectData( DATA_BLOB* pDataIn, LPCWSTR szDataDescr,
2528 DATA_BLOB* pOptionalEntropy, PVOID pvReserved,
2529 CRYPTPROTECT_PROMPTSTRUCT* pPromptStruct, DWORD dwFlags, DATA_BLOB* pDataOut );
2531 BOOL WINAPI CryptUnprotectData( DATA_BLOB* pDataIn, LPWSTR* ppszDataDescr,
2532 DATA_BLOB* pOptionalEntropy, PVOID pvReserved,
2533 CRYPTPROTECT_PROMPTSTRUCT* pPromptStruct, DWORD dwFlags, DATA_BLOB* pDataOut );
2535 #ifdef __cplusplus
2537 #endif
2539 #endif