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
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
;
40 typedef struct _PROV_ENUMALGS
{
47 typedef struct _PROV_ENUMALGS_EX
{
59 #define SCHANNEL_MAC_KEY 0
60 #define SCHANNEL_ENC_KEY 1
62 typedef struct _SCHANNEL_ALG
{
68 } SCHANNEL_ALG
, *PSCHANNEL_ALG
;
70 typedef struct _HMAC_INFO
{
76 } HMAC_INFO
, *PHMAC_INFO
;
78 typedef struct _CRYPTOAPI_BLOB
{
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
,
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
{
100 } CRYPTPROTECT_PROMPTSTRUCT
, *PCRYPTPROTECT_PROMPTSTRUCT
;
102 typedef struct _CRYPT_ALGORITHM_IDENTIFIER
{
104 CRYPT_OBJID_BLOB Parameters
;
105 } CRYPT_ALGORITHM_IDENTIFIER
, *PCRYPT_ALGORITHM_IDENTIFIER
;
107 typedef struct _CRYPT_ATTRIBUTE_TYPE_VALUE
{
109 CRYPT_OBJID_BLOB Value
;
110 } CRYPT_ATTRIBUTE_TYPE_VALUE
, *PCRYPT_ATTRIBUTE_TYPE_VALUE
;
112 typedef struct _PUBLICKEYSTRUC
{
117 } BLOBHEADER
, PUBLICKEYSTRUC
;
119 typedef struct _RSAPUBKEY
{
125 typedef struct _CRYPT_BIT_BLOB
{
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
{
139 CRYPT_OBJID_BLOB Value
;
140 } CERT_EXTENSION
, *PCERT_EXTENSION
;
142 typedef struct _CERT_EXTENSIONS
{
144 PCERT_EXTENSION rgExtension
;
145 } CERT_EXTENSIONS
, *PCERT_EXTENSIONS
;
147 typedef struct _CERT_INFO
{
149 CRYPT_INTEGER_BLOB SerialNumber
;
150 CRYPT_ALGORITHM_IDENTIFIER SignatureAlgorithm
;
151 CERT_NAME_BLOB Issuer
;
154 CERT_NAME_BLOB Subject
;
155 CERT_PUBLIC_KEY_INFO SubjectPublicKeyInfo
;
156 CRYPT_BIT_BLOB IssuerUniqueId
;
157 CRYPT_BIT_BLOB SubjectUniqueId
;
159 PCERT_EXTENSION rgExtension
;
160 } CERT_INFO
, *PCERT_INFO
;
162 typedef struct _CERT_RDN_ATTR
{
165 CERT_RDN_VALUE_BLOB Value
;
166 } CERT_RDN_ATTR
, *PCERT_RDN_ATTR
;
168 typedef struct _CERT_RDN
{
170 PCERT_RDN_ATTR rgRDNAttr
;
171 } CERT_RDN
, *PCERT_RDN
;
173 typedef struct _CERT_NAME_INFO
{
176 } CERT_NAME_INFO
, *PCERT_NAME_INFO
;
178 typedef struct _CERT_NAME_VALUE
{
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
{
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
;
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
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
{
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
{
231 CRYPT_OBJID_BLOB Value
;
232 } CERT_OTHER_NAME
, *PCERT_OTHER_NAME
;
234 typedef struct _CERT_ALT_NAME_ENTRY
{
235 DWORD dwAltNameChoice
;
237 PCERT_OTHER_NAME pOtherName
;
238 LPWSTR pwszRfc822Name
;
240 CERT_NAME_BLOB DirectoryName
;
242 CRYPT_DATA_BLOB IPAddress
;
243 LPSTR pszRegisteredID
;
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
{
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
{
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
{
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
{
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
;
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
{
351 PCRYPT_DER_BLOB rgValue
;
352 } CRYPT_CONTENT_INFO_SEQUENCE_OF_ANY
, *PCRYPT_CONTENT_INFO_SEQUENCE_OF_ANY
;
354 typedef struct _CRYPT_CONTENT_INFO
{
356 CRYPT_DER_BLOB Content
;
357 } CRYPT_CONTENT_INFO
, *PCRYPT_CONTENT_INFO
;
359 typedef struct _CRYPT_SEQUENCE_OF_ANY
{
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
{
377 PCERT_ACCESS_DESCRIPTION rgAccDescr
;
378 } CERT_AUTHORITY_INFO_ACCESS
, *PCERT_AUTHORITY_INFO_ACCESS
;
380 typedef struct _CERT_CONTEXT
{
381 DWORD dwCertEncodingType
;
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
;
393 PCERT_EXTENSION rgExtension
;
394 } CRL_ENTRY
, *PCRL_ENTRY
;
396 typedef struct _CRL_INFO
{
398 CRYPT_ALGORITHM_IDENTIFIER SignatureAlgorithm
;
399 CERT_NAME_BLOB Issuer
;
403 PCRL_ENTRY rgCRLEntry
;
405 PCERT_EXTENSION rgExtension
;
406 } CRL_INFO
, *PCRL_INFO
;
408 typedef struct _CRL_DIST_POINT_NAME
{
409 DWORD dwDistPointNameChoice
;
411 CERT_ALT_NAME_INFO FullName
;
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
{
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
;
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
{
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
;
470 } CRL_ISSUING_DIST_POINT
, *PCRL_ISSUING_DIST_POINT
;
472 typedef struct _CERT_GENERAL_SUBTREE
{
473 CERT_ALT_NAME_ENTRY Base
;
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
{
492 PCRYPT_DATA_BLOB rgValue
;
493 } CRYPT_ATTRIBUTE
, *PCRYPT_ATTRIBUTE
;
495 typedef struct _CRYPT_ATTRIBUTES
{
497 PCRYPT_ATTRIBUTE rgAttr
;
498 } CRYPT_ATTRIBUTES
, *PCRYPT_ATTRIBUTES
;
500 typedef struct _CERT_REQUEST_INFO
{
502 CERT_NAME_BLOB Subject
;
503 CERT_PUBLIC_KEY_INFO SubjectPublicKeyInfo
;
505 PCRYPT_ATTRIBUTE rgAttribute
;
506 } CERT_REQUEST_INFO
, *PCERT_REQUEST_INFO
;
508 typedef struct _CERT_KEYGEN_REQUEST_INFO
{
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
;
525 HCERTSTORE hCertStore
;
526 } CRL_CONTEXT
, *PCRL_CONTEXT
;
527 typedef const CRL_CONTEXT
*PCCRL_CONTEXT
;
529 typedef struct _VTableProvStruc
{
531 FARPROC pFuncVerifyImage
;
532 FARPROC pFuncReturnhWnd
;
537 } VTableProvStruc
, *PVTableProvStruc
;
539 typedef struct _CERT_PRIVATE_KEY_INFO
{
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
;
554 PCRYPT_ATTRIBUTE rgAttribute
;
555 } CTL_ENTRY
, *PCTL_ENTRY
;
557 typedef struct _CTL_INFO
{
559 CTL_USAGE SubjectUsage
;
560 CRYPT_DATA_BLOB ListIdentifier
;
561 CRYPT_INTEGER_BLOB SequenceNumber
;
564 CRYPT_ALGORITHM_IDENTIFIER SubjectAlgorithm
;
566 PCTL_ENTRY rgCTLEntry
;
568 PCERT_EXTENSION rgExtension
;
569 } CTL_INFO
, *PCTL_INFO
;
571 typedef struct _CTL_CONTEXT
{
572 DWORD dwMsgAndCertEncodingType
;
576 HCERTSTORE hCertStore
;
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
;
588 PCRYPT_ATTRIBUTE rgAttribute
;
589 } CRYPT_TIME_STAMP_REQUEST_INFO
, *PCRYPT_TIME_STAMP_REQUEST_INFO
;
591 typedef struct _CRYPT_ENROLLMENT_NAME_VALUE_PAIR
{
594 } CRYPT_ENROLLMENT_NAME_VALUE_PAIR
, *PCRYPT_ENROLLMENT_NAME_VALUE_PAIR
;
596 typedef struct _CMSG_SIGNER_INFO
{
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
{
609 PCCRL_CONTEXT pBaseCrlContext
;
610 PCCRL_CONTEXT pDeltaCrlContext
;
611 PCRL_ENTRY pCrlEntry
;
613 } CERT_REVOCATION_CRL_INFO
, *PCERT_REVOCATION_CRL_INFO
;
615 typedef struct _CERT_REVOCATION_INFO
{
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
{
627 PCTL_ENTRY pCtlEntry
;
628 PCCTL_CONTEXT pCtlContext
;
629 } CERT_TRUST_LIST_INFO
, *PCERT_TRUST_LIST_INFO
;
631 typedef struct _CERT_TRUST_STATUS
{
634 } CERT_TRUST_STATUS
, *PCERT_TRUST_STATUS
;
636 typedef struct _CERT_CHAIN_ELEMENT
{
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
{
648 CERT_TRUST_STATUS TrustStatus
;
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
{
661 CERT_TRUST_STATUS TrustStatus
;
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
{
673 void *pvExtraPolicyPara
;
674 } CERT_CHAIN_POLICY_PARA
, *PCERT_CHAIN_POLICY_PARA
;
676 typedef struct _CERT_CHAIN_POLICY_STATUS
{
681 void *pvExtraPolicyStatus
;
682 } CERT_CHAIN_POLICY_STATUS
, *PCERT_CHAIN_POLICY_STATUS
;
684 typedef struct _CERT_SYSTEM_STORE_INFO
{
686 } CERT_SYSTEM_STORE_INFO
, *PCERT_SYSTEM_STORE_INFO
;
688 typedef struct _CERT_PHYSICAL_STORE_INFO
{
690 LPSTR pszOpenStoreProvider
;
691 DWORD dwOpenEncodingType
;
693 CRYPT_DATA_BLOB OpenParameters
;
696 } CERT_PHYSICAL_STORE_INFO
, *PCERT_PHYSICAL_STORE_INFO
;
698 typedef struct _CERT_SYSTEM_STORE_RELOCATE_PARA
{
705 LPCSTR pszSystemStore
;
706 LPCWSTR pwszSystemStore
;
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
,
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
{
727 PFN_CRYPT_ALLOC pfnAlloc
;
728 PFN_CRYPT_FREE pfnFree
;
729 } CRYPT_ENCODE_PARA
, *PCRYPT_ENCODE_PARA
;
731 typedef struct _CRYPT_DECODE_PARA
{
733 PFN_CRYPT_ALLOC pfnAlloc
;
734 PFN_CRYPT_FREE pfnFree
;
735 } CRYPT_DECODE_PARA
, *PCRYPT_DECODE_PARA
;
737 typedef struct _CERT_STORE_PROV_INFO
{
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
,
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
{
801 DWORD dwMsgAndCertEncodingType
;
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
{
842 PFN_CRYPT_FREE pfnFree
;
844 } CERT_CREATE_CONTEXT_PARA
, *PCERT_CREATE_CONTEXT_PARA
;
846 typedef struct _CRYPT_OID_FUNC_ENTRY
{
849 } CRYPT_OID_FUNC_ENTRY
, *PCRYPT_OID_FUNC_ENTRY
;
851 typedef BOOL (WINAPI
*PFN_CRYPT_ENUM_OID_FUNC
)(DWORD dwEncodingType
,
852 LPCSTR pszFuncName
, LPCSTR pszOID
, DWORD cValue
, const DWORD rgdwValueType
[],
853 LPCWSTR
const rgpwszValueName
[], const BYTE
* const rgpbValueData
[],
854 const DWORD rgcbValueData
[], void *pvArg
);
856 #define CRYPT_MATCH_ANY_ENCODING_TYPE 0xffffffff
858 typedef struct _CRYPT_OID_INFO
{
868 CRYPT_DATA_BLOB ExtraInfo
;
869 } CRYPT_OID_INFO
, *PCRYPT_OID_INFO
;
870 typedef const CRYPT_OID_INFO CCRYPT_OID_INFO
, *PCCRYPT_OID_INFO
;
872 typedef BOOL (WINAPI
*PFN_CRYPT_ENUM_OID_INFO
)(PCCRYPT_OID_INFO pInfo
,
876 #define CRYPT_HASH_ALG_OID_GROUP_ID 1
877 #define CRYPT_ENCRYPT_ALG_OID_GROUP_ID 2
878 #define CRYPT_PUBKEY_ALG_OID_GROUP_ID 3
879 #define CRYPT_SIGN_ALG_OID_GROUP_ID 4
880 #define CRYPT_RDN_ATTR_OID_GROUP_ID 5
881 #define CRYPT_EXT_OR_ATTR_OID_GROUP_ID 6
882 #define CRYPT_ENHKEY_USAGE_OID_GROUP_ID 7
883 #define CRYPT_POLICY_OID_GROUP_ID 8
884 #define CRYPT_TEMPLATE_OID_GROUP_ID 9
885 #define CRYPT_LAST_OID_GROUP_ID 9
887 #define CRYPT_FIRST_ALG_OID_GROUP_ID CRYPT_HASH_ALG_OID_GROUP_ID
888 #define CRYPT_LAST_ALG_OID_GROUP_ID CRYPT_SIGN_ALG_OID_GROUP_ID
890 #define CRYPT_OID_INHIBIT_SIGNATURE_FORMAT_FLAG 0x1
891 #define CRYPT_OID_USE_PUBKEY_PARA_FOR_PKCS7_FLAG 0x2
892 #define CRYPT_OID_NO_NULL_ALGORITHM_PARA_FLAG 0x4
894 #define CRYPT_OID_INFO_OID_KEY 1
895 #define CRYPT_OID_INFO_NAME_KEY 2
896 #define CRYPT_OID_INFO_ALGID_KEY 3
897 #define CRYPT_OID_INFO_SIGN_KEY 4
901 #define GET_ALG_CLASS(x) (x & (7 << 13))
902 #define GET_ALG_TYPE(x) (x & (15 << 9))
903 #define GET_ALG_SID(x) (x & (511))
905 /* Algorithm Classes */
906 #define ALG_CLASS_ANY (0)
907 #define ALG_CLASS_SIGNATURE (1 << 13)
908 #define ALG_CLASS_MSG_ENCRYPT (2 << 13)
909 #define ALG_CLASS_DATA_ENCRYPT (3 << 13)
910 #define ALG_CLASS_HASH (4 << 13)
911 #define ALG_CLASS_KEY_EXCHANGE (5 << 13)
912 /* Algorithm types */
913 #define ALG_TYPE_ANY (0)
914 #define ALG_TYPE_DSS (1 << 9)
915 #define ALG_TYPE_RSA (2 << 9)
916 #define ALG_TYPE_BLOCK (3 << 9)
917 #define ALG_TYPE_STREAM (4 << 9)
918 #define ALG_TYPE_DH (5 << 9)
919 #define ALG_TYPE_SECURECHANNEL (6 << 9)
922 #define ALG_SID_ANY (0)
924 #define ALG_SID_RSA_ANY 0
925 #define ALG_SID_RSA_PKCS 1
926 #define ALG_SID_RSA_MSATWORK 2
927 #define ALG_SID_RSA_ENTRUST 3
928 #define ALG_SID_RSA_PGP 4
930 #define ALG_SID_DSS_ANY 0
931 #define ALG_SID_DSS_PKCS 1
932 #define ALG_SID_DSS_DMS 2
935 #define ALG_SID_DES 1
936 #define ALG_SID_3DES 3
937 #define ALG_SID_DESX 4
938 #define ALG_SID_IDEA 5
939 #define ALG_SID_CAST 6
940 #define ALG_SID_SAFERSK64 7
941 #define ALG_SID_SAFERSK128 8
942 #define ALG_SID_3DES_112 9
943 /* Diffie-Hellmans SIDs */
944 #define ALG_SID_DH_SANDF 1
945 #define ALG_SID_DH_EPHEM 2
946 #define ALG_SID_AGREED_KEY_ANY 3
947 #define ALG_SID_KEA 4
949 #define ALG_SID_RC4 1
950 #define ALG_SID_RC2 2
951 #define ALG_SID_SEAL 2
953 #define ALG_SID_MD2 1
954 #define ALG_SID_MD4 2
955 #define ALG_SID_MD5 3
956 #define ALG_SID_SHA 4
957 #define ALG_SID_SHA1 CALG_SHA
958 #define ALG_SID_MAC 5
959 #define ALG_SID_RIPEMD 6
960 #define ALG_SID_RIPEMD160 7
961 #define ALG_SID_SSL3SHAMD5 8
962 #define ALG_SID_HMAC 9
963 #define ALG_SID_TLS1PRF 10
965 #define ALG_SID_SSL3_MASTER 1
966 #define ALG_SID_SCHANNEL_MASTER_HASH 2
967 #define ALG_SID_SCHANNEL_MAC_KEY 3
968 #define ALG_SID_PCT1_MASTER 4
969 #define ALG_SID_SSL2_MASTER 5
970 #define ALG_SID_TLS1_MASTER 6
971 #define ALG_SID_SCHANNEL_ENC_KEY 7
972 #define ALG_SID_EXAMPLE 80
974 /* Algorithm Definitions */
975 #define CALG_MD2 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MD2)
976 #define CALG_MD4 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MD4)
977 #define CALG_MD5 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MD5)
978 #define CALG_SHA (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA)
979 #define CALG_SHA1 CALG_SHA
980 #define CALG_MAC (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MAC)
981 #define CALG_SSL3_SHAMD5 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SSL3SHAMD5)
982 #define CALG_HMAC (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_HMAC)
983 #define CALG_TLS1PRF (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_TLS1PRF)
984 #define CALG_RSA_SIGN (ALG_CLASS_SIGNATURE | ALG_TYPE_RSA | ALG_SID_RSA_ANY)
985 #define CALG_DSS_SIGN (ALG_CLASS_SIGNATURE | ALG_TYPE_DSS | ALG_SID_DSS_ANY)
986 #define CALG_DH_SF (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_DH | ALG_SID_DH_SANDF)
987 #define CALG_DH_EPHEM (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_DH | ALG_SID_DH_EPHEM)
988 #define CALG_RSA_KEYX (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_RSA | ALG_SID_RSA_ANY)
989 #define CALG_DES (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_DES)
990 #define CALG_RC2 (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_RC2)
991 #define CALG_3DES (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_3DES)
992 #define CALG_3DES_112 (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_3DES_112)
993 #define CALG_RC4 (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_STREAM | ALG_SID_RC4)
994 #define CALG_SEAL (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_STREAM | ALG_SID_SEAL)
995 #define CALG_SSL3_MASTER (ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL | ALG_SID_SSL3_MASTER)
996 #define CALG_SCHANNEL_MASTER_HASH (ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL | ALG_SID_SCHANNEL_MASTER_HASH)
997 #define CALG_SCHANNEL_MAC_KEY (ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL | ALG_SID_SCHANNEL_MAC_KEY)
998 #define CALG_SCHANNEL_ENC_KEY (ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL | ALG_SID_SCHANNEL_ENC_KEY)
999 #define CALG_PCT1_MASTER (ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL | ALG_SID_PCT1_MASTER)
1000 #define CALG_SSL2_MASTER (ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL | ALG_SID_SSL2_MASTER)
1001 #define CALG_TLS1_MASTER (ALG_CLASS_MSG_ENCRYPT | ALG_TYPE_SECURECHANNEL | ALG_SID_TLS1_MASTER)
1003 /* Protocol Flags */
1004 #define CRYPT_FLAG_PCT1 0x0001
1005 #define CRYPT_FLAG_SSL2 0x0002
1006 #define CRYPT_FLAG_SSL3 0x0004
1007 #define CRYPT_FLAG_TLS1 0x0008
1008 #define CRYPT_FLAG_IPSEC 0x0010
1009 #define CRYPT_FLAG_SIGNING 0x0020
1011 /* Provider names */
1012 #define MS_DEF_PROV_A "Microsoft Base Cryptographic Provider v1.0"
1013 #if defined(__GNUC__)
1014 # define MS_DEF_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
1015 'B','a','s','e',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ', \
1016 'P','r','o','v','i','d','e','r',' ','v','1','.','0',0 }
1017 #elif defined(_MSC_VER)
1018 # define MS_DEF_PROV_W L"Microsoft Base Cryptographic Provider v1.0"
1020 static const WCHAR MS_DEF_PROV_W
[] = { 'M','i','c','r','o','s','o','f','t',' ',
1021 'B','a','s','e',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ',
1022 'P','r','o','v','i','d','e','r',' ','v','1','.','0',0 };
1024 #define MS_DEF_PROV WINELIB_NAME_AW(MS_DEF_PROV_)
1026 #define MS_ENHANCED_PROV_A "Microsoft Enhanced Cryptographic Provider v1.0"
1027 #if defined(__GNUC__)
1028 # define MS_ENHANCED_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
1029 'E','n','h','a','n','c','e','d',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ', \
1030 'P','r','o','v','i','d','e','r',' ','v','1','.','0',0 }
1031 #elif defined(_MSC_VER)
1032 # define MS_ENHANCED_PROV_W L"Microsoft Enhanced Cryptographic Provider v1.0"
1034 static const WCHAR MS_ENHANCED_PROV_W
[] = { 'M','i','c','r','o','s','o','f','t',' ',
1035 'E','n','h','a','n','c','e','d',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ',
1036 'P','r','o','v','i','d','e','r',' ','v','1','.','0',0 };
1038 #define MS_ENHANCED_PROV WINELIB_NAME_AW(MS_ENHANCED_PROV_)
1040 #define MS_STRONG_PROV_A "Microsoft Strong Cryptographic Provider"
1041 #if defined(__GNUC__)
1042 # define MS_STRONG_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
1043 'S','t','r','o','n','g',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ', \
1044 'P','r','o','v','i','d','e','r',0 }
1045 #elif defined(_MSC_VER)
1046 # define MS_STRONG_PROV_W L"Microsoft Strong Cryptographic Provider"
1048 static const WCHAR MS_STRONG_PROV_W
[] = { 'M','i','c','r','o','s','o','f','t',' ',
1049 'S','t','r','o','n','g',' ','C','r','y','p','t','o','g','r','a','p','h','i','c',' ',
1050 'P','r','o','v','i','d','e','r',0 };
1052 #define MS_STRONG_PROV WINELIB_NAME_AW(MS_STRONG_PROV_)
1054 #define MS_DEF_RSA_SIG_PROV_A "Microsoft RSA Signature Cryptographic Provider"
1055 #if defined(__GNUC__)
1056 # define MS_DEF_RSA_SIG_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
1057 'R','S','A',' ','S','i','g','n','a','t','u','r','e',' ', \
1058 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
1059 #elif defined(_MSC_VER)
1060 # define MS_DEF_RSA_SIG_PROV_W L"Microsoft RSA Signature Cryptographic Provider"
1062 static const WCHAR MS_DEF_RSA_SIG_PROV_W
[] = { 'M','i','c','r','o','s','o','f','t',' ',
1063 'R','S','A',' ','S','i','g','n','a','t','u','r','e',' ',
1064 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
1066 #define MS_DEF_RSA_SIG_PROV WINELIB_NAME_AW(MS_DEF_RSA_SIG_PROV_)
1068 #define MS_DEF_RSA_SCHANNEL_PROV_A "Microsoft RSA SChannel Cryptographic Provider"
1069 #if defined(__GNUC__)
1070 # define MS_DEF_RSA_SCHANNEL_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
1071 'R','S','A',' ','S','C','h','a','n','n','e','l',' ', \
1072 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
1073 #elif defined(_MSC_VER)
1074 # define MS_DEF_RSA_SCHANNEL_PROV_W L"Microsoft RSA SChannel Cryptographic Provider"
1076 static const WCHAR MS_DEF_RSA_SCHANNEL_PROV_W
[] = { 'M','i','c','r','o','s','o','f','t',' ',
1077 'R','S','A',' ','S','C','h','a','n','n','e','l',' ',
1078 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
1080 #define MS_DEF_RSA_SCHANNEL_PROV WINELIB_NAME_AW(MS_DEF_RSA_SCHANNEL_PROV_)
1082 #define MS_DEF_DSS_PROV_A "Microsoft Base DSS Cryptographic Provider"
1083 #if defined(__GNUC__)
1084 # define MS_DEF_DSS_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
1085 'B','a','s','e',' ','D','S','S',' ', \
1086 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
1087 #elif defined(_MSC_VER)
1088 # define MS_DEF_DSS_PROV_W L"Microsoft Base DSS Cryptographic Provider"
1090 static const WCHAR MS_DEF_DSS_PROV_W
[] = { 'M','i','c','r','o','s','o','f','t',' ',
1091 'B','a','s','e',' ','D','S','S',' ',
1092 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
1094 #define MS_DEF_DSS_PROV WINELIB_NAME_AW(MS_DEF_DSS_PROV_)
1096 #define MS_DEF_DSS_DH_PROV_A "Microsoft Base DSS and Diffie-Hellman Cryptographic Provider"
1097 #if defined(__GNUC__)
1098 # define MS_DEF_DSS_DH_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
1099 'B','a','s','e',' ','D','S','S',' ','a','n','d',' ', \
1100 'D','i','f','f','i','e','-','H','e','l','l','m','a','n',' ', \
1101 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
1102 #elif defined(_MSC_VER)
1103 # define MS_DEF_DSS_DH_PROV_W L"Microsoft Base DSS and Diffie-Hellman Cryptographic Provider"
1105 static const WCHAR MS_DEF_DSS_DH_PROV_W
[] = { 'M','i','c','r','o','s','o','f','t',' ',
1106 'B','a','s','e',' ','D','S','S',' ','a','n','d',' ',
1107 'D','i','f','f','i','e','-','H','e','l','l','m','a','n',' ',
1108 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
1110 #define MS_DEF_DSS_DH_PROV WINELIB_NAME_AW(MS_DEF_DSS_DH_PROV_)
1112 #define MS_ENH_DSS_DH_PROV_A "Microsoft Enhanced DSS and Diffie-Hellman Cryptographic Provider"
1113 #if defined(__GNUC__)
1114 # define MS_ENH_DSS_DH_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
1115 'E','n','h','a','n','c','e','d',' ','D','S','S',' ','a','n','d',' ', \
1116 'D','i','f','f','i','e','-','H','e','l','l','m','a','n',' ', \
1117 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
1118 #elif defined(_MSC_VER)
1119 # define MS_ENH_DSS_DH_PROV_W L"Microsoft Enhanced DSS and Diffie-Hellman Cryptographic Provider"
1121 static const WCHAR MS_ENH_DSS_DH_PROV_W
[] = { 'M','i','c','r','o','s','o','f','t',' ',
1122 'E','n','h','a','n','c','e','d',' ','D','S','S',' ','a','n','d',' ',
1123 'D','i','f','f','i','e','-','H','e','l','l','m','a','n',' ',
1124 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
1126 #define MS_ENH_DSS_DH_PROV WINELIB_NAME_AW(MS_ENH_DSS_DH_PROV_)
1128 #define MS_DEF_DH_SCHANNEL_PROV_A "Microsoft DH SChannel Cryptographic Provider"
1129 #if defined(__GNUC__)
1130 # define MS_DEF_DH_SCHANNEL_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
1131 'D','H',' ','S','C','h','a','n','n','e','l',' ', \
1132 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
1133 #elif defined(_MSC_VER)
1134 # define MS_DEF_DH_SCHANNEL_PROV_W L"Microsoft DH SChannel Cryptographic Provider"
1136 static const WCHAR MS_DEF_DH_SCHANNEL_PROV_W
[] = { 'M','i','c','r','o','s','o','f','t',' ',
1137 'D','H',' ','S','C','h','a','n','n','e','l',' ',
1138 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
1140 #define MS_DEF_DH_SCHANNEL_PROV WINELIB_NAME_AW(MS_DEF_DH_SCHANNEL_PROV_)
1142 #define MS_SCARD_PROV_A "Microsoft Base Smart Card Cryptographic Provider"
1143 #if defined(__GNUC__)
1144 # define MS_SCARD_PROV_W (const WCHAR []){ 'M','i','c','r','o','s','o','f','t',' ', \
1145 'B','a','s','e',' ','S','m','a','r','t',' ','C','a','r','d',' ', \
1146 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 }
1147 #elif defined(_MSC_VER)
1148 # define MS_SCARD_PROV_W L"Microsoft Base Smart Card Cryptographic Provider"
1150 static const WCHAR MS_SCARD_PROV_W
[] = { 'M','i','c','r','o','s','o','f','t',' ',
1151 'B','a','s','e',' ','S','m','a','r','t',' ','C','a','r','d',' ',
1152 'C','r','y','p','t','o','g','r','a','p','h','i','c',' ','P','r','o','v','i','d','e','r',0 };
1154 #define MS_SCARD_PROV WINELIB_NAME_AW(MS_SCARD_PROV_)
1157 #define AT_KEYEXCHANGE 1
1158 #define AT_SIGNATURE 2
1160 /* Provider Types */
1161 #define PROV_RSA_FULL 1
1162 #define PROV_RSA_SIG 2
1164 #define PROV_FORTEZZA 4
1165 #define PROV_MS_EXCHANGE 5
1167 #define PROV_RSA_SCHANNEL 12
1168 #define PROV_DSS_DH 13
1169 #define PROV_EC_ECDSA_SIG 14
1170 #define PROV_EC_ECNRA_SIG 15
1171 #define PROV_EC_ECDSA_FULL 16
1172 #define PROV_EC_ECNRA_FULL 17
1173 #define PROV_DH_SCHANNEL 18
1174 #define PROV_SPYRUS_LYNKS 20
1176 #define PROV_INTEL_SEC 22
1177 #define PROV_REPLACE_OWF 23
1178 #define PROV_RSA_AES 24
1182 /* Provider Parameters */
1183 #define PP_ENUMALGS 1
1184 #define PP_ENUMCONTAINERS 2
1185 #define PP_IMPTYPE 3
1187 #define PP_VERSION 5
1188 #define PP_CONTAINER 6
1190 #define CRYPT_FIRST 1
1191 #define CRYPT_NEXT 2
1193 #define CRYPT_IMPL_HARDWARE 1
1194 #define CRYPT_IMPL_SOFTWARE 2
1195 #define CRYPT_IMPL_MIXED 3
1196 #define CRYPT_IMPL_UNKNOWN 4
1198 /* CryptAcquireContext */
1199 #define CRYPT_VERIFYCONTEXT 0xF0000000
1200 #define CRYPT_NEWKEYSET 0x00000008
1201 #define CRYPT_DELETEKEYSET 0x00000010
1202 #define CRYPT_MACHINE_KEYSET 0x00000020
1203 #define CRYPT_SILENT 0x00000040
1205 /* Crypt{Get|Set}Provider */
1206 #define CRYPT_MACHINE_DEFAULT 0x00000001
1207 #define CRYPT_USER_DEFAULT 0x00000002
1208 #define CRYPT_DELETE_DEFAULT 0x00000004
1210 /* Crypt{Get/Set}ProvParam */
1211 #define PP_CLIENT_HWND 1
1212 #define PP_ENUMALGS 1
1213 #define PP_ENUMCONTAINERS 2
1214 #define PP_IMPTYPE 3
1216 #define PP_VERSION 5
1217 #define PP_CONTAINER 6
1218 #define PP_CHANGE_PASSWORD 7
1219 #define PP_KEYSET_SEC_DESCR 8
1220 #define PP_KEY_TYPE_SUBTYPE 10
1221 #define PP_CONTEXT_INFO 11
1222 #define PP_KEYEXCHANGE_KEYSIZE 12
1223 #define PP_SIGNATURE_KEYSIZE 13
1224 #define PP_KEYEXCHANGE_ALG 14
1225 #define PP_SIGNATURE_ALG 15
1226 #define PP_PROVTYPE 16
1227 #define PP_KEYSTORAGE 17
1228 #define PP_SYM_KEYSIZE 19
1229 #define PP_SESSION_KEYSIZE 20
1230 #define PP_UI_PROMPT 21
1231 #define PP_ENUMALGS_EX 22
1232 #define PP_DELETEKEY 24
1233 #define PP_ENUMMANDROOTS 25
1234 #define PP_ENUMELECTROOTS 26
1235 #define PP_KEYSET_TYPE 27
1236 #define PP_ADMIN_PIN 31
1237 #define PP_KEYEXCHANGE_PIN 32
1238 #define PP_SIGNATURE_PIN 33
1239 #define PP_SIG_KEYSIZE_INC 34
1240 #define PP_KEYX_KEYSIZE_INC 35
1241 #define PP_UNIQUE_CONTAINER 36
1242 #define PP_SGC_INFO 37
1243 #define PP_USE_HARDWARE_RNG 38
1244 #define PP_KEYSPEC 39
1245 #define PP_ENUMEX_SIGNING_PROT 40
1247 /* Crypt{Get/Set}KeyParam */
1250 #define KP_PADDING 3
1252 #define KP_MODE_BITS 5
1253 #define KP_PERMISSIONS 6
1255 #define KP_BLOCKLEN 8
1257 #define KP_SALT_EX 10
1266 #define KP_EFFECTIVE_KEYLEN 19
1267 #define KP_SCHANNEL_ALG 20
1268 #define KP_CLIENT_RANDOM 21
1269 #define KP_SERVER_RANDOM 22
1271 #define KP_PRECOMP_MD5 24
1272 #define KP_PRECOMP_SHA 25
1273 #define KP_CERTIFICATE 26
1274 #define KP_CLEAR_KEY 27
1275 #define KP_PUB_EX_LEN 28
1276 #define KP_PUB_EX_VAL 29
1277 #define KP_KEYVAL 30
1278 #define KP_ADMIN_PIN 31
1279 #define KP_KEYEXCHANGE_PIN 32
1280 #define KP_SIGNATURE_PIN 33
1281 #define KP_PREHASH 34
1283 /* CryptSignHash/CryptVerifySignature */
1284 #define CRYPT_NOHASHOID 0x00000001
1285 #define CRYPT_TYPE2_FORMAT 0x00000002
1286 #define CRYPT_X931_FORMAT 0x00000004
1288 /* Crypt{Get,Set}HashParam */
1289 #define HP_ALGID 0x0001
1290 #define HP_HASHVAL 0x0002
1291 #define HP_HASHSIZE 0x0004
1292 #define HP_HMAC_INFO 0x0005
1293 #define HP_TLS1PRF_LABEL 0x0006
1294 #define HP_TLS1PRF_SEED 0x0007
1296 /* Crypt{Get,Set}KeyParam */
1297 #define CRYPT_MODE_CBC 1
1298 #define CRYPT_MODE_ECB 2
1299 #define CRYPT_MODE_OFB 3
1300 #define CRYPT_MODE_CFB 4
1302 #define CRYPT_ENCRYPT 0x0001
1303 #define CRYPT_DECRYPT 0x0002
1304 #define CRYPT_EXPORT 0x0004
1305 #define CRYPT_READ 0x0008
1306 #define CRYPT_WRITE 0x0010
1307 #define CRYPT_MAC 0x0020
1310 #define CRYPT_EXPORTABLE 0x00000001
1311 #define CRYPT_USER_PROTECTED 0x00000002
1312 #define CRYPT_CREATE_SALT 0x00000004
1313 #define CRYPT_UPDATE_KEY 0x00000008
1314 #define CRYPT_NO_SALT 0x00000010
1315 #define CRYPT_PREGEN 0x00000040
1316 #define CRYPT_SERVER 0x00000400
1317 #define CRYPT_ARCHIVABLE 0x00004000
1319 /* CryptExportKey */
1320 #define CRYPT_SSL2_FALLBACK 0x00000002
1321 #define CRYPT_DESTROYKEY 0x00000004
1322 #define CRYPT_OAEP 0x00000040
1324 /* CryptHashSessionKey */
1325 #define CRYPT_LITTLE_ENDIAN 0x00000001
1327 /* Crypt{Protect,Unprotect}Data PROMPTSTRUCT flags */
1328 #define CRYPTPROTECT_PROMPT_ON_PROTECT 0x0001
1329 #define CRYPTPROTECT_PROMPT_ON_UNPROTECT 0x0002
1330 /* Crypt{Protect,Unprotect}Data flags */
1331 #define CRYPTPROTECT_UI_FORBIDDEN 0x0001
1332 #define CRYPTPROTECT_LOCAL_MACHINE 0x0004
1333 #define CRYPTPROTECT_AUDIT 0x0010
1334 #define CRYPTPROTECT_VERIFY_PROTECTION 0x0040
1337 #define SIMPLEBLOB 0x1
1338 #define PUBLICKEYBLOB 0x6
1339 #define PRIVATEKEYBLOB 0x7
1340 #define PLAINTEXTKEYBLOB 0x8
1341 #define OPAQUEKEYBLOB 0x9
1342 #define PUBLICKEYBLOBEX 0xA
1343 #define SYMMETRICWRAPKEYBLOB 0xB
1345 #define CUR_BLOB_VERSION 2
1347 /* cert store provider types */
1348 #define CERT_STORE_PROV_MSG ((LPCSTR)1)
1349 #define CERT_STORE_PROV_MEMORY ((LPCSTR)2)
1350 #define CERT_STORE_PROV_FILE ((LPCSTR)3)
1351 #define CERT_STORE_PROV_REG ((LPCSTR)4)
1352 #define CERT_STORE_PROV_PKCS7 ((LPCSTR)5)
1353 #define CERT_STORE_PROV_SERIALIZED ((LPCSTR)6)
1354 #define CERT_STORE_PROV_FILENAME_A ((LPCSTR)7)
1355 #define CERT_STORE_PROV_FILENAME_W ((LPCSTR)8)
1356 #define CERT_STORE_PROV_SYSTEM_A ((LPCSTR)9)
1357 #define CERT_STORE_PROV_SYSTEM_W ((LPCSTR)10)
1358 #define CERT_STORE_PROV_SYSTEM CERT_STORE_PROV_SYSTEM_W
1359 #define CERT_STORE_PROV_COLLECTION ((LPCSTR)11)
1360 #define CERT_STORE_PROV_SYSTEM_REGISTRY_A ((LPCSTR)12)
1361 #define CERT_STORE_PROV_SYSTEM_REGISTRY_W ((LPCSTR)13)
1362 #define CERT_STORE_PROV_SYSTEM_REGISTRY CERT_STORE_PROV_SYSTEM_REGISTRY_W
1363 #define CERT_STORE_PROV_PHYSICAL_W ((LPCSTR)14)
1364 #define CERT_STORE_PROV_PHYSICAL CERT_STORE_PROV_PHYSICAL_W
1365 #define CERT_STORE_PROV_SMART_CARD_W ((LPCSTR)15)
1366 #define CERT_STORE_PROV_SMART_CARD CERT_STORE_PROV_SMART_CARD_W
1367 #define CERT_STORE_PROV_LDAP_W ((LPCSTR)16)
1368 #define CERT_STORE_PROV_LDAP CERT_STORE_PROV_LDAP_W
1370 #define sz_CERT_STORE_PROV_MEMORY "Memory"
1371 #define sz_CERT_STORE_PROV_FILENAME_W "File"
1372 #define sz_CERT_STORE_PROV_FILENAME sz_CERT_STORE_PROV_FILENAME_W
1373 #define sz_CERT_STORE_PROV_SYSTEM_W "System"
1374 #define sz_CERT_STORE_PROV_SYSTEM sz_CERT_STORE_PROV_SYSTEM_W
1375 #define sz_CERT_STORE_PROV_PKCS7 "PKCS7"
1376 #define sz_CERT_STORE_PROV_SERIALIZED "Serialized"
1377 #define sz_CERT_STORE_PROV_COLLECTION "Collection"
1378 #define sz_CERT_STORE_PROV_SYSTEM_REGISTRY_W "SystemRegistry"
1379 #define sz_CERT_STORE_PROV_SYSTEM_REGISTRY sz_CERT_STORE_PROV_SYSTEM_REGISTRY_W
1380 #define sz_CERT_STORE_PROV_PHYSICAL_W "Physical"
1381 #define sz_CERT_STORE_PROV_PHYSICAL sz_CERT_STORE_PROV_PHYSICAL_W
1382 #define sz_CERT_STORE_PROV_SMART_CARD_W "SmartCard"
1383 #define sz_CERT_STORE_PROV_SMART_CARD sz_CERT_STORE_PROV_SMART_CARD_W
1384 #define sz_CERT_STORE_PROV_LDAP_W "Ldap"
1385 #define sz_CERT_STORE_PROV_LDAP sz_CERT_STORE_PROV_LDAP_W
1387 /* types for CertOpenStore dwEncodingType */
1388 #define CERT_ENCODING_TYPE_MASK 0x0000ffff
1389 #define CMSG_ENCODING_TYPE_MASK 0xffff0000
1390 #define GET_CERT_ENCODING_TYPE(x) ((x) & CERT_ENCODING_TYPE_MASK)
1391 #define GET_CMSG_ENCODING_TYPE(x) ((x) & CMSG_ENCODING_TYPE_MASK)
1393 #define CRYPT_ASN_ENCODING 0x00000001
1394 #define CRYPT_NDR_ENCODING 0x00000002
1395 #define X509_ASN_ENCODING 0x00000001
1396 #define X509_NDR_ENCODING 0x00000002
1397 #define PKCS_7_ASN_ENCODING 0x00010000
1398 #define PKCS_7_NDR_ENCODING 0x00020000
1400 /* system store locations */
1401 #define CERT_SYSTEM_STORE_LOCATION_MASK 0x00ff0000
1402 #define CERT_SYSTEM_STORE_LOCATION_SHIFT 16
1404 /* system store location ids */
1406 #define CERT_SYSTEM_STORE_CURRENT_USER_ID 1
1408 #define CERT_SYSTEM_STORE_LOCAL_MACHINE_ID 2
1409 /* hklm\Software\Microsoft\Cryptography\Services */
1410 #define CERT_SYSTEM_STORE_CURRENT_SERVICE_ID 4
1411 #define CERT_SYSTEM_STORE_SERVICES_ID 5
1413 #define CERT_SYSTEM_STORE_USERS_ID 6
1414 /* hkcu\Software\Policies\Microsoft\SystemCertificates */
1415 #define CERT_SYSTEM_STORE_CURRENT_USER_GROUP_POLICY_ID 7
1416 /* hklm\Software\Policies\Microsoft\SystemCertificates */
1417 #define CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY_ID 8
1418 /* hklm\Software\Microsoft\EnterpriseCertificates */
1419 #define CERT_SYSTEM_STORE_LOCAL_MACHINE_ENTERPRISE_ID 9
1421 /* system store location values */
1422 #define CERT_SYSTEM_STORE_CURRENT_USER \
1423 (CERT_SYSTEM_STORE_CURRENT_USER_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
1424 #define CERT_SYSTEM_STORE_LOCAL_MACHINE \
1425 (CERT_SYSTEM_STORE_LOCAL_MACHINE_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
1426 #define CERT_SYSTEM_STORE_CURRENT_SERVICE \
1427 (CERT_SYSTEM_STORE_CURRENT_SERVICE_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
1428 #define CERT_SYSTEM_STORE_SERVICES \
1429 (CERT_SYSTEM_STORE_SERVICES_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
1430 #define CERT_SYSTEM_STORE_USERS \
1431 (CERT_SYSTEM_STORE_USERS_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
1432 #define CERT_SYSTEM_STORE_CURRENT_USER_GROUP_POLICY \
1433 (CERT_SYSTEM_STORE_CURRENT_USER_GROUP_POLICY_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
1434 #define CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY \
1435 (CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
1436 #define CERT_SYSTEM_STORE_LOCAL_MACHINE_ENTERPRISE \
1437 (CERT_SYSTEM_STORE_LOCAL_MACHINE_ENTERPRISE_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
1439 #if defined(__GNUC__)
1440 #define CERT_LOCAL_MACHINE_SYSTEM_STORE_REGPATH (const WCHAR[])\
1441 {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t',\
1442 '\\','S','y','s','t','e','m','C','e','r','t','i','f','i','c','a','t','e','s',\
1444 #define CERT_GROUP_POLICY_SYSTEM_STORE_REGPATH (const WCHAR[])\
1445 {'S','o','f','t','w','a','r','e','\\','P','o','l','i','c','i','e','s','\\',\
1446 'M','i','c','r','o','s','o','f','t','\\','S','y','s','t','e','m','C','e','r',\
1447 't','i','f','i','c','a','t','e','s',0 }
1448 #elif defined(_MSC_VER)
1449 #define CERT_LOCAL_MACHINE_SYSTEM_STORE_REGPATH \
1450 L"Software\\Microsoft\\SystemCertificates"
1451 #define CERT_GROUP_POLICY_SYSTEM_STORE_REGPATH \
1452 L"Software\\Policies\\Microsoft\\SystemCertificates"
1454 static const WCHAR CERT_LOCAL_MACHINE_SYSTEM_STORE_REGPATH
[] =
1455 {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
1456 'S','y','s','t','e','m','C','e','r','t','i','f','i','c','a','t','e','s',0 };
1457 static const WCHAR CERT_GROUP_POLICY_SYSTEM_STORE_REGPATH
[] =
1458 {'S','o','f','t','w','a','r','e','\\','P','o','l','i','c','i','e','s','\\',
1459 'M','i','c','r','o','s','o','f','t','\\','S','y','s','t','e','m','C','e','r',
1460 't','i','f','i','c','a','t','e','s',0 };
1463 /* flags for CertOpenStore dwFlags */
1464 #define CERT_STORE_NO_CRYPT_RELEASE_FLAG 0x00000001
1465 #define CERT_STORE_SET_LOCALIZED_NAME_FLAG 0x00000002
1466 #define CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG 0x00000004
1467 #define CERT_STORE_DELETE_FLAG 0x00000010
1468 #define CERT_STORE_UNSAFE_PHYSICAL_FLAG 0x00000020
1469 #define CERT_STORE_SHARE_STORE_FLAG 0x00000040
1470 #define CERT_STORE_SHARE_CONTEXT_FLAG 0x00000080
1471 #define CERT_STORE_MANIFOLD_FLAG 0x00000100
1472 #define CERT_STORE_ENUM_ARCHIVED_FLAG 0x00000200
1473 #define CERT_STORE_UPDATE_KEYID_FLAG 0x00000400
1474 #define CERT_STORE_BACKUP_RESTORE_FLAG 0x00000800
1475 #define CERT_STORE_MAXIMUM_ALLOWED_FLAG 0x00001000
1476 #define CERT_STORE_CREATE_NEW_FLAG 0x00002000
1477 #define CERT_STORE_OPEN_EXISTING_FLAG 0x00004000
1478 #define CERT_STORE_READONLY_FLAG 0x00008000
1480 /* dwAddDisposition */
1481 #define CERT_STORE_ADD_NEW 1
1482 #define CERT_STORE_ADD_USE_EXISTING 2
1483 #define CERT_STORE_ADD_REPLACE_EXISTING 3
1484 #define CERT_STORE_ADD_ALWAYS 4
1485 #define CERT_STORE_ADD_REPLACE_EXISTING_INHERIT_PROPERTIES 5
1486 #define CERT_STORE_ADD_NEWER 6
1487 #define CERT_STORE_ADD_NEWER_INHERIT_PROPERTIES 7
1489 /* Installable OID function defs */
1490 #define CRYPT_OID_OPEN_STORE_PROV_FUNC "CertDllOpenStoreProv"
1491 #define CRYPT_OID_ENCODE_OBJECT_FUNC "CryptDllEncodeObject"
1492 #define CRYPT_OID_DECODE_OBJECT_FUNC "CryptDllDecodeObject"
1493 #define CRYPT_OID_ENCODE_OBJECT_EX_FUNC "CryptDllEncodeObjectEx"
1494 #define CRYPT_OID_DECODE_OBJECT_EX_FUNC "CryptDllDecodeObjectEx"
1495 #define CRYPT_OID_CREATE_COM_OBJECT_FUNC "CryptDllCreateComObject"
1496 #define CRYPT_OID_VERIFY_REVOCATION_FUNC "CertDllVerifyRevocation"
1497 #define CRYPT_OID_VERIFY_CTL_USAGE_FUNC "CertDllVerifyCTLUsage"
1498 #define CRYPT_OID_FORMAT_OBJECT_FUNC "CryptDllFormatObject"
1499 #define CRYPT_OID_FIND_OID_INFO_FUNC "CryptDllFindOIDInfo"
1500 #define CRYPT_OID_FIND_LOCALIZED_NAME_FUNC "CryptDllFindLocalizedName"
1501 #define CRYPT_OID_EXPORT_PUBLIC_KEY_INFO_FUNC "CryptDllExportPublicKeyInfoEx"
1502 #define CRYPT_OID_IMPORT_PUBLIC_KEY_INFO_FUNC "CryptDllImportPublicKeyInfoEx"
1503 #define CRYPT_OID_EXPORT_PRIVATE_KEY_INFO_FUNC "CryptDllExportPrivateKeyInfoEx"
1504 #define CRYPT_OID_IMPORT_PRIVATE_KEY_INFO_FUNC "CryptDllImportPrivateKeyInfoEx"
1505 #define CRYPT_OID_VERIFY_CERTIFICATE_CHAIN_POLICY_FUNC \
1506 "CertDllVerifyCertificateChainPolicy"
1507 #define URL_OID_GET_OBJECT_URL_FUNC "UrlDllGetObjectUrl"
1508 #define TIME_VALID_OID_GET_OBJECT_FUNC "TimeValidDllGetObject"
1510 #define CRYPT_OID_REGPATH "Software\\Microsoft\\Cryptography\\OID"
1511 #define CRYPT_OID_REG_ENCODING_TYPE_PREFIX "EncodingType "
1512 #if defined(__GNUC__)
1513 # define CRYPT_OID_REG_DLL_VALUE_NAME (const WCHAR []){ 'D','l','l',0 }
1514 # define CRYPT_OID_REG_FUNC_NAME_VALUE_NAME \
1515 (const WCHAR []){ 'F','u','n','c','N','a','m','e',0 }
1516 # define CRYPT_OID_REG_FLAGS_VALUE_NAME \
1517 (const WCHAR []){ 'C','r','y','p','t','F','l','a','g','s',0 }
1518 #elif defined(_MSC_VER)
1519 # define CRYPT_OID_REG_DLL_VALUE_NAME L"Dll"
1520 # define CRYPT_OID_REG_FUNC_NAME_VALUE_NAME L"FuncName"
1521 # define CRYPT_OID_REG_FLAGS_VALUE_NAME L"CryptFlags"
1523 static const WCHAR CRYPT_OID_REG_DLL_VALUE_NAME
[] = { 'D','l','l',0 };
1524 static const WCHAR CRYPT_OID_REG_FUNC_NAME_VALUE_NAME
[] =
1525 { 'F','u','n','c','N','a','m','e',0 };
1526 static const WCHAR CRYPT_OID_REG_FLAGS_VALUE_NAME
[] =
1527 { 'C','r','y','p','t','F','l','a','g','s',0 };
1529 #define CRYPT_OID_REG_FUNC_NAME_VALUE_NAME_A "FuncName"
1530 #define CRYPT_DEFAULT_OID "DEFAULT"
1532 #define CRYPT_INSTALL_OID_FUNC_BEFORE_FLAG 1
1534 #define CRYPT_GET_INSTALLED_OID_FUNC_FLAG 0x1
1536 #define CRYPT_REGISTER_FIRST_INDEX 0
1537 #define CRYPT_REGISTER_LAST_INDEX 0xffffffff
1539 /* values for CERT_STORE_PROV_INFO's dwStoreProvFlags */
1540 #define CERT_STORE_PROV_EXTERNAL_FLAG 0x1
1541 #define CERT_STORE_PROV_DELETED_FLAG 0x2
1542 #define CERT_STORE_PROV_NO_PERSIST_FLAG 0x4
1543 #define CERT_STORE_PROV_SYSTEM_STORE_FLAG 0x8
1544 #define CERT_STORE_PROV_LM_SYSTEM_STORE_FLAG 0x10
1546 /* function indices */
1547 #define CERT_STORE_PROV_CLOSE_FUNC 0
1548 #define CERT_STORE_PROV_READ_CERT_FUNC 1
1549 #define CERT_STORE_PROV_WRITE_CERT_FUNC 2
1550 #define CERT_STORE_PROV_DELETE_CERT_FUNC 3
1551 #define CERT_STORE_PROV_SET_CERT_PROPERTY_FUNC 4
1552 #define CERT_STORE_PROV_READ_CRL_FUNC 5
1553 #define CERT_STORE_PROV_WRITE_CRL_FUNC 6
1554 #define CERT_STORE_PROV_DELETE_CRL_FUNC 7
1555 #define CERT_STORE_PROV_SET_CRL_PROPERTY_FUNC 8
1556 #define CERT_STORE_PROV_READ_CTL_FUNC 9
1557 #define CERT_STORE_PROV_WRITE_CTL_FUNC 10
1558 #define CERT_STORE_PROV_DELETE_CTL_FUNC 11
1559 #define CERT_STORE_PROV_SET_CTL_PROPERTY_FUNC 12
1560 #define CERT_STORE_PROV_CONTROL_FUNC 13
1561 #define CERT_STORE_PROV_FIND_CERT_FUNC 14
1562 #define CERT_STORE_PROV_FREE_FIND_CERT_FUNC 15
1563 #define CERT_STORE_PROV_GET_CERT_PROPERTY_FUNC 16
1564 #define CERT_STORE_PROV_FIND_CRL_FUNC 17
1565 #define CERT_STORE_PROV_FREE_FIND_CRL_FUNC 18
1566 #define CERT_STORE_PROV_GET_CRL_PROPERTY_FUNC 19
1567 #define CERT_STORE_PROV_FIND_CTL_FUNC 20
1568 #define CERT_STORE_PROV_FREE_FIND_CTL_FUNC 21
1569 #define CERT_STORE_PROV_GET_CTL_PROPERTY_FUNC 22
1571 /* physical store dwFlags, also used by CertAddStoreToCollection as
1574 #define CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG 0x1
1575 #define CERT_PHYSICAL_STORE_OPEN_DISABLE_FLAG 0x2
1576 #define CERT_PHYSICAL_STORE_REMOVE_OPEN_DISABLE_FLAG 0x4
1577 #define CERT_PHYSICAL_STORE_INSERT_COMPUTER_NAME_ENABLE_FLAG 0x8
1579 /* dwFlag values for CertEnumPhysicalStore callback */
1580 #define CERT_PHYSICAL_STORE_PREDEFINED_ENUM_FLAG 0x1
1582 /* predefined store names */
1583 #if defined(__GNUC__)
1584 # define CERT_PHYSICAL_STORE_DEFAULT_NAME (const WCHAR[])\
1585 {'.','D','e','f','a','u','l','t','0'}
1586 # define CERT_PHYSICAL_STORE_GROUP_POLICY_NAME (const WCHAR[])\
1587 {'.','G','r','o','u','p','P','o','l','i','c','y',0}
1588 # define CERT_PHYSICAL_STORE_LOCAL_MACHINE_NAME (const WCHAR[])\
1589 {'.','L','o','c','a','l','M','a','c','h','i','n','e',0}
1590 # define CERT_PHYSICAL_STORE_DS_USER_CERTIFICATE_NAME (const WCHAR[])\
1591 {'.','U','s','e','r','C','e','r','t','i','f','i','c','a','t','e',0}
1592 # define CERT_PHYSICAL_STORE_LOCAL_MACHINE_GROUP_POLICY_NAME (const WCHAR[])\
1593 {'.','L','o','c','a','l','M','a','c','h','i','n','e','G','r','o','u','p',\
1594 'P','o','l','i','c','y',0}
1595 # define CERT_PHYSICAL_STORE_ENTERPRISE_NAME (const WCHAR[])\
1596 {'.','E','n','t','e','r','p','r','i','s','e',0}
1597 # define CERT_PHYSICAL_STORE_AUTH_ROOT_NAME (const WCHAR[])\
1598 {'.','A','u','t','h','R','o','o','t',0}
1599 #elif defined(_MSC_VER)
1600 # define CERT_PHYSICAL_STORE_DEFAULT_NAME \
1602 # define CERT_PHYSICAL_STORE_GROUP_POLICY_NAME \
1604 # define CERT_PHYSICAL_STORE_LOCAL_MACHINE_NAME \
1606 # define CERT_PHYSICAL_STORE_DS_USER_CERTIFICATE_NAME \
1608 # define CERT_PHYSICAL_STORE_LOCAL_MACHINE_GROUP_POLICY_NAME \
1609 L".LocalMachineGroupPolicy"
1610 # define CERT_PHYSICAL_STORE_ENTERPRISE_NAME \
1612 # define CERT_PHYSICAL_STORE_AUTH_ROOT_NAME \
1615 static const WCHAR CERT_PHYSICAL_STORE_DEFAULT_NAME
[] =
1616 {'.','D','e','f','a','u','l','t','0'};
1617 static const WCHAR CERT_PHYSICAL_STORE_GROUP_POLICY_NAME
[] =
1618 {'.','G','r','o','u','p','P','o','l','i','c','y',0};
1619 static const WCHAR CERT_PHYSICAL_STORE_LOCAL_MACHINE_NAME
[] =
1620 {'.','L','o','c','a','l','M','a','c','h','i','n','e',0};
1621 static const WCHAR CERT_PHYSICAL_STORE_DS_USER_CERTIFICATE_NAME
[] =
1622 {'.','U','s','e','r','C','e','r','t','i','f','i','c','a','t','e',0};
1623 static const WCHAR CERT_PHYSICAL_STORE_LOCAL_MACHINE_GROUP_POLICY_NAME
[] =
1624 {'.','L','o','c','a','l','M','a','c','h','i','n','e','G','r','o','u','p',
1625 'P','o','l','i','c','y',0};
1626 static const WCHAR CERT_PHYSICAL_STORE_ENTERPRISE_NAME
[] =
1627 {'.','E','n','t','e','r','p','r','i','s','e',0};
1628 static const WCHAR CERT_PHYSICAL_STORE_AUTH_ROOT_NAME
[] =
1629 {'.','A','u','t','h','R','o','o','t',0};
1632 /* cert system store flags */
1633 #define CERT_SYSTEM_STORE_MASK 0xffff0000
1634 #define CERT_SYSTEM_STORE_RELOCATE_FLAG 0x80000000
1636 /* CertFindChainInStore dwFindType types */
1637 #define CERT_CHAIN_FIND_BY_ISSUER 1
1639 /* CERT_INFO versions/flags */
1643 #define CERT_INFO_VERSION_FLAG 1
1644 #define CERT_INFO_SERIAL_NUMBER_FLAG 2
1645 #define CERT_INFO_SIGNATURE_ALGORITHM_FLAG 3
1646 #define CERT_INFO_ISSUER_FLAG 4
1647 #define CERT_INFO_NOT_BEFORE_FLAG 5
1648 #define CERT_INFO_NOT_AFTER_FLAG 6
1649 #define CERT_INFO_SUBJECT_FLAG 7
1650 #define CERT_INFO_SUBJECT_PUBLIC_KEY_INFO_FLAG 8
1651 #define CERT_INFO_ISSUER_UNIQUE_ID_FLAG 9
1652 #define CERT_INFO_SUBJECT_UNIQUE_ID_FLAG 10
1653 #define CERT_INFO_EXTENSION_FLAG 11
1655 /* CERT_REQUEST_INFO versions */
1656 #define CERT_REQUEST_V1 0
1658 /* CERT_KEYGEN_REQUEST_INFO versions */
1659 #define CERT_KEYGEN_REQUEST_V1 0
1668 /* Certificate, CRL, CTL property IDs */
1669 #define CERT_KEY_PROV_HANDLE_PROP_ID 1
1670 #define CERT_KEY_PROV_INFO_PROP_ID 2
1671 #define CERT_SHA1_HASH_PROP_ID 3
1672 #define CERT_HASH_PROP_ID CERT_SHA1_HASH_PROP_ID
1673 #define CERT_MD5_HASH_PROP_ID 4
1674 #define CERT_KEY_CONTEXT_PROP_ID 5
1675 #define CERT_KEY_SPEC_PROP_ID 6
1676 #define CERT_IE30_RESERVED_PROP_ID 7
1677 #define CERT_PUBKEY_HASH_RESERVED_PROP_ID 8
1678 #define CERT_ENHKEY_USAGE_PROP_ID 9
1679 #define CERT_CTL_USAGE_PROP_ID CERT_ENHKEY_USAGE_PROP_ID
1680 #define CERT_NEXT_UPDATE_LOCATION_PROP_ID 10
1681 #define CERT_FRIENDLY_NAME_PROP_ID 11
1682 #define CERT_PVK_FILE_PROP_ID 12
1683 #define CERT_DESCRIPTION_PROP_ID 13
1684 #define CERT_ACCESS_STATE_PROP_ID 14
1685 #define CERT_SIGNATURE_HASH_PROP_ID 15
1686 #define CERT_SMART_CARD_DATA_PROP_ID 16
1687 #define CERT_EFS_PROP_ID 17
1688 #define CERT_FORTEZZA_DATA_PROP 18
1689 #define CERT_ARCHIVED_PROP_ID 19
1690 #define CERT_KEY_IDENTIFIER_PROP_ID 20
1691 #define CERT_AUTO_ENROLL_PROP_ID 21
1692 #define CERT_PUBKEY_ALG_PARA_PROP_ID 22
1693 #define CERT_CROSS_CERT_DIST_POINTS_PROP_ID 23
1694 #define CERT_ISSUER_PUBLIC_KEY_MD5_HASH_PROP_ID 24
1695 #define CERT_SUBJECT_PUBLIC_KEY_MD5_HASH_PROP_ID 25
1696 #define CERT_ENROLLMENT_PROP_ID 26
1697 #define CERT_DATE_STAMP_PROP_ID 27
1698 #define CERT_ISSUER_SERIAL_NUMBER_MD5_HASH_PROP_ID 28
1699 #define CERT_SUBJECT_NAME_MD5_HASH_PROP_ID 29
1700 #define CERT_EXTENDED_ERROR_INFO_PROP_ID 30
1708 #define CERT_RENEWAL_PROP_ID 64
1709 #define CERT_ARCHIVED_KEY_HASH_PROP_ID 65
1710 #define CERT_AUTO_ENROLL_RETRY_PROP_ID 66
1711 #define CERT_AIA_URL_RETRIEVED_PROP_ID 67
1712 #define CERT_FIRST_RESERVED_PROP_ID 68
1713 #define CERT_LAST_RESERVED_PROP_ID 0x00007fff
1714 #define CERT_FIRST_USER_PROP_ID 0x00008000
1715 #define CERT_LAST_USER_PROP_ID 0x0000ffff
1717 #define IS_CERT_HASH_PROP_ID(x) \
1718 ((x) == CERT_SHA1_HASH_PROP_ID || (x) == CERT_MD5_HASH_PROP_ID || \
1719 (x) == CERT_SIGNATURE_HASH_PROP_ID)
1721 #define IS_PUBKEY_HASH_PROP_ID(x) \
1722 ((x) == CERT_ISSUER_PUBLIC_KEY_MD5_HASH_PROP_ID || \
1723 (x) == CERT_SUBJECT_PUBLIC_KEY_MD5_HASH_PROP_ID)
1725 #define IS_CHAIN_HASH_PROP_ID(x) \
1726 ((x) == CERT_ISSUER_PUBLIC_KEY_MD5_HASH_PROP_ID || \
1727 (x) == CERT_SUBJECT_PUBLIC_KEY_MD5_HASH_PROP_ID || \
1728 (x) == CERT_ISSUER_SERIAL_NUMBER_MD5_HASH_PROP_ID || \
1729 (x) == CERT_SUBJECT_NAME_MD5_HASH_PROP_ID)
1731 /* access state flags */
1732 #define CERT_ACCESS_STATE_WRITE_PERSIST_FLAG 0x1
1733 #define CERT_ACCESS_STATE_SYSTEM_STORE_FLAG 0x2
1734 #define CERT_ACCESS_STATE_LM_SYSTEM_STORE_FLAG 0x4
1736 /* CERT_RDN attribute dwValueType types */
1737 #define CERT_RDN_TYPE_MASK 0x000000ff
1738 #define CERT_RDN_ANY_TYPE 0
1739 #define CERT_RDN_ENCODED_BLOB 1
1740 #define CERT_RDN_OCTET_STRING 2
1741 #define CERT_RDN_NUMERIC_STRING 3
1742 #define CERT_RDN_PRINTABLE_STRING 4
1743 #define CERT_RDN_TELETEX_STRING 5
1744 #define CERT_RDN_T61_STRING 5
1745 #define CERT_RDN_VIDEOTEX_STRING 6
1746 #define CERT_RDN_IA5_STRING 7
1747 #define CERT_RDN_GRAPHIC_STRING 8
1748 #define CERT_RDN_VISIBLE_STRING 9
1749 #define CERT_RDN_ISO646_STRING 9
1750 #define CERT_RDN_GENERAL_STRING 10
1751 #define CERT_RDN_UNIVERSAL_STRING 11
1752 #define CERT_RDN_INT4_STRING 11
1753 #define CERT_RDN_BMP_STRING 12
1754 #define CERT_RDN_UNICODE_STRING 12
1755 #define CERT_RDN_UTF8_STRING 13
1757 /* CERT_RDN attribute dwValueType flags */
1758 #define CERT_RDN_FLAGS_MASK 0xff000000
1759 #define CERT_RDN_ENABLE_T61_UNICODE_FLAG 0x80000000
1760 #define CERT_RDN_DISABLE_CHECK_TYPE_FLAG 0x4000000
1761 #define CERT_RDN_ENABLE_UTF8_UNICODE_FLAG 0x2000000
1762 #define CERT_RDN_DISABLE_IE4_UTF8_FLAG 0x0100000
1764 #define IS_CERT_RDN_CHAR_STRING(x) \
1765 (((x) & CERT_RDN_TYPE_MASK) >= CERT_RDN_NUMERIC_STRING)
1767 /* CRL reason codes */
1768 #define CRL_REASON_UNSPECIFIED 0
1769 #define CRL_REASON_KEY_COMPROMISE 1
1770 #define CRL_REASON_CA_COMPROMISE 2
1771 #define CRL_REASON_AFFILIATION_CHANGED 3
1772 #define CRL_REASON_SUPERSEDED 4
1773 #define CRL_REASON_CESSATION_OF_OPERATION 5
1774 #define CRL_REASON_CERTIFICATE_HOLD 6
1775 #define CRL_REASON_REMOVE_FROM_CRL 8
1777 /* CertControlStore control types */
1778 #define CERT_STORE_CTRL_RESYNC 1
1779 #define CERT_STORE_CTRL_NOTIFY_CHANGE 2
1780 #define CERT_STORE_CTRL_COMMIT 3
1781 #define CERT_STORE_CTRL_AUTO_RESYNC 4
1782 #define CERT_STORE_CTRL_CANCEL_NOTIFY 5
1784 #define CERT_STORE_CTRL_COMMIT_FORCE_FLAG 0x1
1785 #define CERT_STORE_CTRL_COMMIT_CLEAR_FLAG 0x2
1787 /* cert store properties */
1788 #define CERT_STORE_LOCALIZED_NAME_PROP_ID 0x1000
1790 /* CertCreateContext flags */
1791 #define CERT_CREATE_CONTEXT_NOCOPY_FLAG 0x1
1792 #define CERT_CREATE_CONTEXT_SORTED_FLAG 0x2
1793 #define CERT_CREATE_CONTEXT_NO_HCRYPTMSG_FLAG 0x4
1794 #define CERT_CREATE_CONTEXT_NO_ENTRY_FLAG 0x8
1796 #define CERT_COMPARE_MASK 0xffff
1797 #define CERT_COMPARE_SHIFT 16
1798 #define CERT_COMPARE_ANY 0
1799 #define CERT_COMPARE_SHA1_HASH 1
1800 #define CERT_COMPARE_HASH CERT_COMPARE_SHA1_HASH
1801 #define CERT_COMPARE_NAME 2
1802 #define CERT_COMPARE_ATTR 3
1803 #define CERT_COMPARE_MD5_HASH 4
1804 #define CERT_COMPARE_PROPERTY 5
1805 #define CERT_COMPARE_PUBLIC_KEY 6
1806 #define CERT_COMPARE_NAME_STR_A 7
1807 #define CERT_COMPARE_NAME_STR_W 8
1808 #define CERT_COMPARE_KEY_SPEC 9
1809 #define CERT_COMPARE_ENHKEY_USAGE 10
1810 #define CERT_COMPARE_CTL_USAGE CERT_COMPARE_ENHKEY_USAGE
1811 #define CERT_COMPARE_SUBJECT_CERT 11
1812 #define CERT_COMPARE_ISSUER_OF 12
1813 #define CERT_COMPARE_EXISTING 13
1814 #define CERT_COMPARE_SIGNATURE_HASH 14
1815 #define CERT_COMPARE_KEY_IDENTIFIER 15
1816 #define CERT_COMPARE_CERT_ID 16
1817 #define CERT_COMPARE_CROSS_CERT_DIST_POINTS 17
1818 #define CERT_COMPARE_PUBKEY_MD5_HASH 18
1820 /* values of dwFindType for CertFind*InStore */
1821 #define CERT_FIND_ANY \
1822 (CERT_COMPARE_ANY << CERT_COMPARE_SHIFT)
1823 #define CERT_FIND_SHA1_HASH \
1824 (CERT_COMPARE_SHA1_HASH << CERT_COMPARE_SHIFT)
1825 #define CERT_FIND_MD5_HASH \
1826 (CERT_COMPARE_MD5_HASH << CERT_COMPARE_SHIFT)
1827 #define CERT_FIND_SIGNATURE_HASH \
1828 (CERT_COMPARE_SIGNATURE_HASH << CERT_COMPARE_SHIFT)
1829 #define CERT_FIND_KEY_IDENTIFIER \
1830 (CERT_COMPARE_KEY_IDENTIFIER << CERT_COMPARE_SHIFT)
1831 #define CERT_FIND_HASH CERT_FIND_SHA1_HASH
1832 #define CERT_FIND_PROPERTY \
1833 (CERT_COMPARE_PROPERTY << CERT_COMPARE_SHIFT)
1834 #define CERT_FIND_PUBLIC_KEY \
1835 (CERT_COMPARE_PUBLIC_KEY << CERT_COMPARE_SHIFT)
1836 #define CERT_FIND_SUBJECT_NAME \
1837 (CERT_COMPARE_NAME << CERT_COMPARE_SHIFT | CERT_INFO_SUBJECT_FLAG)
1838 #define CERT_FIND_SUBJECT_ATTR \
1839 (CERT_COMPARE_ATTR << CERT_COMPARE_SHIFT | CERT_INFO_SUBJECT_FLAG)
1840 #define CERT_FIND_ISSUER_NAME \
1841 (CERT_COMPARE_NAME << CERT_COMPARE_SHIFT | CERT_INFO_ISSUER_FLAG)
1842 #define CERT_FIND_ISSUER_ATTR \
1843 (CERT_COMPARE_ATTR << CERT_COMPARE_SHIFT | CERT_INFO_ISSUER_FLAG)
1844 #define CERT_FIND_SUBJECT_STR_A \
1845 (CERT_COMPARE_NAME_STR_A << CERT_COMPARE_SHIFT | CERT_INFO_SUBJECT_FLAG)
1846 #define CERT_FIND_SUBJECT_STR_W \
1847 (CERT_COMPARE_NAME_STR_W << CERT_COMPARE_SHIFT | CERT_INFO_SUBJECT_FLAG)
1848 #define CERT_FIND_SUBJECT_STR CERT_FIND_SUBJECT_STR_W
1849 #define CERT_FIND_ISSUER_STR_A \
1850 (CERT_COMPARE_NAME_STR_A << CERT_COMPARE_SHIFT | CERT_INFO_ISSUER_FLAG)
1851 #define CERT_FIND_ISSUER_STR_W \
1852 (CERT_COMPARE_NAME_STR_W << CERT_COMPARE_SHIFT | CERT_INFO_ISSUER_FLAG)
1853 #define CERT_FIND_ISSUER_STR CERT_FIND_ISSUER_STR_W
1854 #define CERT_FIND_KEY_SPEC \
1855 (CERT_COMPARE_KEY_SPEC << CERT_COMPARE_SHIFT)
1856 #define CERT_FIND_ENHKEY_USAGE \
1857 (CERT_COMPARE_ENHKEY_USAGE << CERT_COMPARE_SHIFT)
1858 #define CERT_FIND_CTL_USAGE CERT_FIND_ENHKEY_USAGE
1859 #define CERT_FIND_SUBJECT_CERT \
1860 (CERT_COMPARE_SUBJECT_CERT << CERT_COMPARE_SHIFT)
1861 #define CERT_FIND_ISSUER_OF \
1862 (CERT_COMPARE_ISSUER_OF << CERT_COMPARE_SHIFT)
1863 #define CERT_FIND_EXISTING \
1864 (CERT_COMPARE_EXISTING << CERT_COMPARE_SHIFT)
1865 #define CERT_FIND_CERT_ID \
1866 (CERT_COMPARE_CERT_ID << CERT_COMPARE_SHIFT)
1867 #define CERT_FIND_CROSS_CERT_DIST_POINTS \
1868 (CERT_COMPARE_CROSS_CERT_DIST_POINTS << CERT_COMPARE_SHIFT)
1869 #define CERT_FIND_PUBKEY_MD5_HASH \
1870 (CERT_COMPARE_PUBKEY_MD5_HASH << CERT_COMPARE_SHIFT)
1872 /* PFN_CERT_STORE_PROV_WRITE_CERT dwFlags values */
1873 #define CERT_STORE_PROV_WRITE_ADD_FLAG 0x1
1875 /* CertAddSerializedElementToStore context types */
1876 #define CERT_STORE_CERTIFICATE_CONTEXT 1
1877 #define CERT_STORE_CRL_CONTEXT 2
1878 #define CERT_STORE_CTL_CONTEXT 3
1879 #define CERT_STORE_ALL_CONTEXT_FLAG ~0U
1880 #define CERT_STORE_CERTIFICATE_CONTEXT_FLAG \
1881 (1 << CERT_STORE_CERTIFICATE_CONTEXT)
1882 #define CERT_STORE_CRL_CONTEXT_FLAG (1 << CERT_STORE_CRL_CONTEXT)
1883 #define CERT_STORE_CTL_CONTEXT_FLAG (1 << CERT_STORE_CTL_CONTEXT)
1886 #define szOID_RSA "1.2.840.113549"
1887 #define szOID_PKCS "1.2.840.113549.1"
1888 #define szOID_RSA_HASH "1.2.840.113549.2"
1889 #define szOID_RSA_ENCRYPT "1.2.840.113549.3"
1890 #define szOID_PKCS_1 "1.2.840.113549.1.1"
1891 #define szOID_PKCS_2 "1.2.840.113549.1.2"
1892 #define szOID_PKCS_3 "1.2.840.113549.1.3"
1893 #define szOID_PKCS_4 "1.2.840.113549.1.4"
1894 #define szOID_PKCS_5 "1.2.840.113549.1.5"
1895 #define szOID_PKCS_6 "1.2.840.113549.1.6"
1896 #define szOID_PKCS_7 "1.2.840.113549.1.7"
1897 #define szOID_PKCS_8 "1.2.840.113549.1.8"
1898 #define szOID_PKCS_9 "1.2.840.113549.1.9"
1899 #define szOID_PKCS_10 "1.2.840.113549.1.10"
1900 #define szOID_PKCS_11 "1.2.840.113549.1.12"
1901 #define szOID_RSA_RSA "1.2.840.113549.1.1.1"
1902 #define CERT_RSA_PUBLIC_KEY_OBJID szOID_RSA_RSA
1903 #define CERT_DEFAULT_OID_PUBLIC_KEY_SIGN szOID_RSA_RSA
1904 #define CERT_DEFAULT_OID_PUBLIC_KEY_XCHG szOID_RSA_RSA
1905 #define szOID_RSA_MD2RSA "1.2.840.113549.1.1.2"
1906 #define szOID_RSA_MD4RSA "1.2.840.113549.1.1.3"
1907 #define szOID_RSA_MD5RSA "1.2.840.113549.1.1.4"
1908 #define szOID_RSA_SHA1RSA "1.2.840.113549.1.1.5"
1909 #define szOID_RSA_SET0AEP_RSA "1.2.840.113549.1.1.6"
1910 #define szOID_RSA_DH "1.2.840.113549.1.3.1"
1911 #define szOID_RSA_data "1.2.840.113549.1.7.1"
1912 #define szOID_RSA_signedData "1.2.840.113549.1.7.2"
1913 #define szOID_RSA_envelopedData "1.2.840.113549.1.7.3"
1914 #define szOID_RSA_signEnvData "1.2.840.113549.1.7.4"
1915 #define szOID_RSA_digestedData "1.2.840.113549.1.7.5"
1916 #define szOID_RSA_hashedData "1.2.840.113549.1.7.5"
1917 #define szOID_RSA_encryptedData "1.2.840.113549.1.7.6"
1918 #define szOID_RSA_emailAddr "1.2.840.113549.1.9.1"
1919 #define szOID_RSA_unstructName "1.2.840.113549.1.9.2"
1920 #define szOID_RSA_contentType "1.2.840.113549.1.9.3"
1921 #define szOID_RSA_messageDigest "1.2.840.113549.1.9.4"
1922 #define szOID_RSA_signingTime "1.2.840.113549.1.9.5"
1923 #define szOID_RSA_counterSign "1.2.840.113549.1.9.6"
1924 #define szOID_RSA_challengePwd "1.2.840.113549.1.9.7"
1925 #define szOID_RSA_unstructAddr "1.2.840.113549.1.9.9"
1926 #define szOID_RSA_extCertAttrs "1.2.840.113549.1.9.9"
1927 #define szOID_RSA_certExtensions "1.2.840.113549.1.9.14"
1928 #define szOID_RSA_SMIMECapabilities "1.2.840.113549.1.9.15"
1929 #define szOID_RSA_preferSignedData "1.2.840.113549.1.9.15.1"
1930 #define szOID_RSA_SMIMEalg "1.2.840.113549.1.9.16.3"
1931 #define szOID_RSA_SMIMEalgESDH "1.2.840.113549.1.9.16.3.5"
1932 #define szOID_RSA_SMIMEalgCMS3DESwrap "1.2.840.113549.1.9.16.3.6"
1933 #define szOID_RSA_SMIMEalgCMSRC2wrap "1.2.840.113549.1.9.16.3.7"
1934 #define szOID_RSA_MD2 "1.2.840.113549.2.2"
1935 #define szOID_RSA_MD4 "1.2.840.113549.2.4"
1936 #define szOID_RSA_MD5 "1.2.840.113549.2.5"
1937 #define szOID_RSA_RC2CBC "1.2.840.113549.3.2"
1938 #define szOID_RSA_RC4 "1.2.840.113549.3.4"
1939 #define szOID_RSA_DES_EDE3_CBC "1.2.840.113549.3.7"
1940 #define szOID_RSA_RC5_CBCPad "1.2.840.113549.3.9"
1941 #define szOID_ANSI_X942 "1.2.840.10046"
1942 #define szOID_ANSI_X942_DH "1.2.840.10046.2.1"
1943 #define szOID_X957 "1.2.840.10040"
1944 #define szOID_X957_DSA "1.2.840.10040.4.1"
1945 #define szOID_X957_SHA1DSA "1.2.840.10040.4.3"
1946 #define szOID_DS "2.5"
1947 #define szOID_DSALG "2.5.8"
1948 #define szOID_DSALG_CRPT "2.5.8.1"
1949 #define szOID_DSALG_HASH "2.5.8.2"
1950 #define szOID_DSALG_SIGN "2.5.8.3"
1951 #define szOID_DSALG_RSA "2.5.8.1.1"
1952 #define szOID_OIW "1.3.14"
1953 #define szOID_OIWSEC "1.3.14.3.2"
1954 #define szOID_OIWSEC_md4RSA "1.3.14.3.2.2"
1955 #define szOID_OIWSEC_md5RSA "1.3.14.3.2.3"
1956 #define szOID_OIWSEC_md4RSA2 "1.3.14.3.2.4"
1957 #define szOID_OIWSEC_desECB "1.3.14.3.2.6"
1958 #define szOID_OIWSEC_desCBC "1.3.14.3.2.7"
1959 #define szOID_OIWSEC_desOFB "1.3.14.3.2.8"
1960 #define szOID_OIWSEC_desCFB "1.3.14.3.2.9"
1961 #define szOID_OIWSEC_desMAC "1.3.14.3.2.10"
1962 #define szOID_OIWSEC_rsaSign "1.3.14.3.2.11"
1963 #define szOID_OIWSEC_dsa "1.3.14.3.2.12"
1964 #define szOID_OIWSEC_shaDSA "1.3.14.3.2.13"
1965 #define szOID_OIWSEC_mdc2RSA "1.3.14.3.2.14"
1966 #define szOID_OIWSEC_shaRSA "1.3.14.3.2.15"
1967 #define szOID_OIWSEC_dhCommMod "1.3.14.3.2.16"
1968 #define szOID_OIWSEC_desEDE "1.3.14.3.2.17"
1969 #define szOID_OIWSEC_sha "1.3.14.3.2.18"
1970 #define szOID_OIWSEC_mdc2 "1.3.14.3.2.19"
1971 #define szOID_OIWSEC_dsaComm "1.3.14.3.2.20"
1972 #define szOID_OIWSEC_dsaCommSHA "1.3.14.3.2.21"
1973 #define szOID_OIWSEC_rsaXchg "1.3.14.3.2.22"
1974 #define szOID_OIWSEC_keyHashSeal "1.3.14.3.2.23"
1975 #define szOID_OIWSEC_md2RSASign "1.3.14.3.2.24"
1976 #define szOID_OIWSEC_md5RSASign "1.3.14.3.2.25"
1977 #define szOID_OIWSEC_sha1 "1.3.14.3.2.26"
1978 #define szOID_OIWSEC_dsaSHA1 "1.3.14.3.2.27"
1979 #define szOID_OIWSEC_dsaCommSHA1 "1.3.14.3.2.28"
1980 #define szOID_OIWSEC_sha1RSASign "1.3.14.3.2.29"
1981 #define szOID_OIWDIR "1.3.14.7.2"
1982 #define szOID_OIWDIR_CRPT "1.3.14.7.2.1"
1983 #define szOID_OIWDIR_HASH "1.3.14.7.2.2"
1984 #define szOID_OIWDIR_SIGN "1.3.14.7.2.3"
1985 #define szOID_OIWDIR_md2 "1.3.14.7.2.2.1"
1986 #define szOID_OIWDIR_md2RSA "1.3.14.7.2.3.1"
1987 #define szOID_INFOSEC "2.16.840.1.101.2.1"
1988 #define szOID_INFOSEC_sdnsSignature "2.16.840.1.101.2.1.1.1"
1989 #define szOID_INFOSEC_mosaicSignature "2.16.840.1.101.2.1.1.2"
1990 #define szOID_INFOSEC_sdnsConfidentiality "2.16.840.1.101.2.1.1.3"
1991 #define szOID_INFOSEC_mosaicConfidentiality "2.16.840.1.101.2.1.1.4"
1992 #define szOID_INFOSEC_sdnsIntegrity "2.16.840.1.101.2.1.1.5"
1993 #define szOID_INFOSEC_mosaicIntegrity "2.16.840.1.101.2.1.1.6"
1994 #define szOID_INFOSEC_sdnsTokenProtection "2.16.840.1.101.2.1.1.7"
1995 #define szOID_INFOSEC_mosaicTokenProtection "2.16.840.1.101.2.1.1.8"
1996 #define szOID_INFOSEC_sdnsKeyManagement "2.16.840.1.101.2.1.1.9"
1997 #define szOID_INFOSEC_mosaicKeyManagement "2.16.840.1.101.2.1.1.10"
1998 #define szOID_INFOSEC_sdnsKMandSig "2.16.840.1.101.2.1.1.11"
1999 #define szOID_INFOSEC_mosaicKMandSig "2.16.840.1.101.2.1.1.12"
2000 #define szOID_INFOSEC_SuiteASignature "2.16.840.1.101.2.1.1.13"
2001 #define szOID_INFOSEC_SuiteAConfidentiality "2.16.840.1.101.2.1.1.14"
2002 #define szOID_INFOSEC_SuiteAIntegrity "2.16.840.1.101.2.1.1.15"
2003 #define szOID_INFOSEC_SuiteATokenProtection "2.16.840.1.101.2.1.1.16"
2004 #define szOID_INFOSEC_SuiteAKeyManagement "2.16.840.1.101.2.1.1.17"
2005 #define szOID_INFOSEC_SuiteAKMandSig "2.16.840.1.101.2.1.1.18"
2006 #define szOID_INFOSEC_mosaicUpdatedSig "2.16.840.1.101.2.1.1.19"
2007 #define szOID_INFOSEC_mosaicKMandUpdSig "2.16.840.1.101.2.1.1.20"
2008 #define szOID_INFOSEC_mosaicUpdateInteg "2.16.840.1.101.2.1.1.21"
2009 #define szOID_COMMON_NAME "2.5.4.3"
2010 #define szOID_SUR_NAME "2.5.4.4"
2011 #define szOID_DEVICE_SERIAL_NUMBER "2.5.4.5"
2012 #define szOID_COUNTRY_NAME "2.5.4.6"
2013 #define szOID_LOCALITY_NAME "2.5.4.7"
2014 #define szOID_STATE_OR_PROVINCE_NAME "2.5.4.8"
2015 #define szOID_STREET_ADDRESS "2.5.4.9"
2016 #define szOID_ORGANIZATION_NAME "2.5.4.10"
2017 #define szOID_ORGANIZATIONAL_UNIT_NAME "2.5.4.11"
2018 #define szOID_TITLE "2.5.4.12"
2019 #define szOID_DESCRIPTION "2.5.4.13"
2020 #define szOID_SEARCH_GUIDE "2.5.4.14"
2021 #define szOID_BUSINESS_CATEGORY "2.5.4.15"
2022 #define szOID_POSTAL_ADDRESS "2.5.4.16"
2023 #define szOID_POSTAL_CODE "2.5.4.17"
2024 #define szOID_POST_OFFICE_BOX "2.5.4.18"
2025 #define szOID_PHYSICAL_DELIVERY_OFFICE_NAME "2.5.4.19"
2026 #define szOID_TELEPHONE_NUMBER "2.5.4.20"
2027 #define szOID_TELEX_NUMBER "2.5.4.21"
2028 #define szOID_TELETEXT_TERMINAL_IDENTIFIER "2.5.4.22"
2029 #define szOID_FACSIMILE_TELEPHONE_NUMBER "2.5.4.23"
2030 #define szOID_X21_ADDRESS "2.5.4.24"
2031 #define szOID_INTERNATIONAL_ISDN_NUMBER "2.5.4.25"
2032 #define szOID_REGISTERED_ADDRESS "2.5.4.26"
2033 #define szOID_DESTINATION_INDICATOR "2.5.4.27"
2034 #define szOID_PREFERRED_DELIVERY_METHOD "2.5.4.28"
2035 #define szOID_PRESENTATION_ADDRESS "2.5.4.29"
2036 #define szOID_SUPPORTED_APPLICATION_CONTEXT "2.5.4.30"
2037 #define szOID_MEMBER "2.5.4.31"
2038 #define szOID_OWNER "2.5.4.32"
2039 #define szOID_ROLE_OCCUPANT "2.5.4.33"
2040 #define szOID_SEE_ALSO "2.5.4.34"
2041 #define szOID_USER_PASSWORD "2.5.4.35"
2042 #define szOID_USER_CERTIFICATE "2.5.4.36"
2043 #define szOID_CA_CERTIFICATE "2.5.4.37"
2044 #define szOID_AUTHORITY_REVOCATION_LIST "2.5.4.38"
2045 #define szOID_CERTIFICATE_REVOCATION_LIST "2.5.4.39"
2046 #define szOID_CROSS_CERTIFICATE_PAIR "2.5.4.40"
2047 #define szOID_GIVEN_NAME "2.5.4.42"
2048 #define szOID_INITIALS "2.5.4.43"
2049 #define szOID_DN_QUALIFIER "2.5.4.46"
2050 #define szOID_AUTHORITY_KEY_IDENTIFIER "2.5.29.1"
2051 #define szOID_KEY_ATTRIBUTES "2.5.29.2"
2052 #define szOID_CERT_POLICIES_95 "2.5.29.3"
2053 #define szOID_KEY_USAGE_RESTRICTION "2.5.29.4"
2054 #define szOID_LEGACY_POLICY_MAPPINGS "2.5.29.5"
2055 #define szOID_SUBJECT_ALT_NAME "2.5.29.7"
2056 #define szOID_ISSUER_ALT_NAME "2.5.29.8"
2057 #define szOID_SUBJECT_DIR_ATTRS "2.5.29.9"
2058 #define szOID_BASIC_CONSTRAINTS "2.5.29.10"
2059 #define szOID_SUBJECT_KEY_IDENTIFIER "2.5.29.14"
2060 #define szOID_KEY_USAGE "2.5.29.15"
2061 #define szOID_PRIVATEKEY_USAGE_PERIOD "2.5.29.16"
2062 #define szOID_SUBJECT_ALT_NAME2 "2.5.29.17"
2063 #define szOID_ISSUER_ALT_NAME2 "2.5.29.18"
2064 #define szOID_BASIC_CONSTRAINTS2 "2.5.29.19"
2065 #define szOID_CRL_NUMBER "2.5.29.20"
2066 #define szOID_CRL_REASON_CODE "2.5.29.21"
2067 #define szOID_REASON_CODE_HOLD "2.5.29.23"
2068 #define szOID_DELTA_CRL_INDICATOR "2.5.29.27"
2069 #define szOID_ISSUING_DIST_POINT "2.5.29.28"
2070 #define szOID_NAME_CONSTRAINTS "2.5.29.30"
2071 #define szOID_CRL_DIST_POINTS "2.5.29.31"
2072 #define szOID_CERT_POLICIES "2.5.29.32"
2073 #define szOID_ANY_CERT_POLICY "2.5.29.32.0"
2074 #define szOID_POLICY_MAPPINGS "2.5.29.33"
2075 #define szOID_AUTHORITY_KEY_IDENTIFIER2 "2.5.29.35"
2076 #define szOID_POLICY_CONSTRAINTS "2.5.29.36"
2077 #define szOID_ENHANCED_KEY_USAGE "2.5.29.37"
2078 #define szOID_FRESHEST_CRL "2.5.29.46"
2079 #define szOID_DOMAIN_COMPONENT "0.9.2342.19200300.100.1.25"
2080 #define szOID_PKCS_12_FRIENDLY_NAME_ATTR "1.2.840.113549.1.9.20"
2081 #define szOID_PKCS_12_LOCAL_KEY_ID "1.2.840.113549.1.9.21"
2082 #define szOID_CERT_EXTENSIONS "1.3.6.1.4.1.311.2.1.14"
2083 #define szOID_NEXT_UPDATE_LOCATION "1.3.6.1.4.1.311.10.2"
2084 #define szOID_REMOVE_CERTIFICATE "1.3.6.1.4.1.311.10.8.1"
2085 #define szOID_CROSS_CERT_DIST_POINTS "1.3.6.1.4.1.311.10.9.1"
2086 #define szOID_CTL "1.3.6.1.4.1.311.10.10.1"
2087 #define szOID_SORTED_CTL "1.3.6.1.4.1.311.10.10.1.1"
2088 #define szOID_ANY_APPLICATION_POLICY "1.3.6.1.4.1.311.10.12.1"
2089 #define szOID_RENEWAL_CERTIFICATE "1.3.6.1.4.1.311.13.1"
2090 #define szOID_ENROLLMENT_NAME_VALUE_PAIR "1.3.6.1.4.1.311.13.2.1"
2091 #define szOID_ENROLLMENT_CSP_PROVIDER "1.3.6.1.4.1.311.13.2.2"
2092 #define szOID_OS_VERSION "1.3.6.1.4.1.311.13.2.3"
2093 #define szOID_PKCS_12_KEY_PROVIDER_NAME_ATTR "1.3.6.1.4.1.311.17.1"
2094 #define szOID_LOCAL_MACHINE_KEYSET "1.3.6.1.4.1.311.17.2"
2095 #define szOID_AUTO_ENROLL_CTL_USAGE "1.3.6.1.4.1.311.20.1"
2096 #define szOID_ENROLL_CERTTYPE_EXTENSION "1.3.6.1.4.1.311.20.2"
2097 #define szOID_ENROLLMENT_AGENT "1.3.6.1.4.1.311.20.2.1"
2098 #define szOID_CERT_MANIFOLD "1.3.6.1.4.1.311.20.3"
2099 #define szOID_CERTSRV_PREVIOUS_CERT_HASH "1.3.6.1.4.1.311.21.2"
2100 #define szOID_CRL_VIRTUAL_BASE "1.3.6.1.4.1.311.21.3"
2101 #define szOID_CRL_NEXT_PUBLISH "1.3.6.1.4.1.311.21.4"
2102 #define szOID_KP_CA_EXCHANGE "1.3.6.1.4.1.311.21.5"
2103 #define szOID_KP_KEY_RECOVERY_AGENT "1.3.6.1.4.1.311.21.6"
2104 #define szOID_CERTIFICATE_TEMPLATE "1.3.6.1.4.1.311.21.7"
2105 #define szOID_ENTERPRISE_OID_ROOT "1.3.6.1.4.1.311.21.8"
2106 #define szOID_RDN_DUMMY_SIGNER "1.3.6.1.4.1.311.21.9"
2107 #define szOID_APPLICATION_CERT_POLICIES "1.3.6.1.4.1.311.21.10"
2108 #define szOID_APPLICATION_POLICY_MAPPINGS "1.3.6.1.4.1.311.21.11"
2109 #define szOID_APPLICATION_POLICY_CONSTRAINTS "1.3.6.1.4.1.311.21.12"
2110 #define szOID_ARCHIVED_KEY_ATTR "1.3.6.1.4.1.311.21.13"
2111 #define szOID_CRL_SELF_CDP "1.3.6.1.4.1.311.21.14"
2112 #define szOID_REQUIRE_CERT_CHAIN_POLICY "1.3.6.1.4.1.311.21.15"
2113 #define szOID_ARCHIVED_KEY_CERT_HASH "1.3.6.1.4.1.311.21.16"
2114 #define szOID_ISSUED_CERT_HASH "1.3.6.1.4.1.311.21.17"
2115 #define szOID_DS_EMAIL_REPLICATION "1.3.6.1.4.1.311.21.19"
2116 #define szOID_REQUEST_CLIENT_INFO "1.3.6.1.4.1.311.21.20"
2117 #define szOID_ENCRYPTED_KEY_HASH "1.3.6.1.4.1.311.21.21"
2118 #define szOID_CERTSRV_CROSSCA_VERSION "1.3.6.1.4.1.311.21.22"
2119 #define szOID_KEYID_RDN "1.3.6.1.4.1.311.10.7.1"
2120 #define szOID_PKIX "1.3.6.1.5.5.7"
2121 #define szOID_PKIX_PE "1.3.6.1.5.5.7.1"
2122 #define szOID_AUTHORITY_INFO_ACCESS "1.3.6.1.5.5.7.1.1"
2123 #define szOID_PKIX_POLICY_QUALIFIER_CPS "1.3.6.1.5.5.7.2.1"
2124 #define szOID_PKIX_POLICY_QUALIFIER_USERNOTICE "1.3.6.1.5.5.7.2.2"
2125 #define szOID_PKIX_KP "1.3.6.1.5.5.7.3"
2126 #define szOID_PKIX_KP_SERVER_AUTH "1.3.6.1.5.5.7.3.1"
2127 #define szOID_PKIX_KP_CLIENT_AUTH "1.3.6.1.5.5.7.3.2"
2128 #define szOID_PKIX_KP_CODE_SIGNING "1.3.6.1.5.5.7.3.3"
2129 #define szOID_PKIX_KP_EMAIL_PROTECTION "1.3.6.1.5.5.7.3.4"
2130 #define szOID_PKIX_KP_IPSEC_END_SYSTEM "1.3.6.1.5.5.7.3.5"
2131 #define szOID_PKIX_KP_IPSEC_TUNNEL "1.3.6.1.5.5.7.3.6"
2132 #define szOID_PKIX_KP_IPSEC_USER "1.3.6.1.5.5.7.3.7"
2133 #define szOID_PKIX_KP_TIMESTAMP_SIGNING "1.3.6.1.5.5.7.3.8"
2134 #define szOID_IPSEC_KP_IKE_INTERMEDIATE "1.3.6.1.5.5.8.2.2"
2136 #ifndef szOID_SERIALIZED
2137 #define szOID_SERIALIZED "1.3.6.1.4.1.311.10.3.3.1"
2140 #ifndef szOID_NT_PRINCIPAL_NAME
2141 #define szOID_NT_PRINCIPAL_NAME "1.3.6.1.4.1.311.20.2.3"
2144 #ifndef szOID_CERTSRV_CA_VERSION
2145 #define szOID_CERTSRV_CA_VERSION "1.3.6.1.4.1.311.21.1"
2148 #ifndef szOID_PRODUCT_UPDATE
2149 #define szOID_PRODUCT_UPDATE "1.3.6.1.4.1.311.31.1"
2152 #define CRYPT_ENCODE_DECODE_NONE 0
2153 #define X509_CERT ((LPCSTR)1)
2154 #define X509_CERT_TO_BE_SIGNED ((LPCSTR)2)
2155 #define X509_CERT_CRL_TO_BE_SIGNED ((LPCSTR)3)
2156 #define X509_CERT_REQUEST_TO_BE_SIGNED ((LPCSTR)4)
2157 #define X509_EXTENSIONS ((LPCSTR)5)
2158 #define X509_NAME_VALUE ((LPCSTR)6)
2159 #define X509_ANY_STRING X509_NAME_VALUE
2160 #define X509_NAME ((LPCSTR)7)
2161 #define X509_PUBLIC_KEY_INFO ((LPCSTR)8)
2162 #define X509_AUTHORITY_KEY_ID ((LPCSTR)9)
2163 #define X509_KEY_ATTRIBUTES ((LPCSTR)10)
2164 #define X509_KEY_USAGE_RESTRICTION ((LPCSTR)11)
2165 #define X509_ALTERNATE_NAME ((LPCSTR)12)
2166 #define X509_BASIC_CONSTRAINTS ((LPCSTR)13)
2167 #define X509_KEY_USAGE ((LPCSTR)14)
2168 #define X509_BASIC_CONSTRAINTS2 ((LPCSTR)15)
2169 #define X509_CERT_POLICIES ((LPCSTR)16)
2170 #define PKCS_UTC_TIME ((LPCSTR)17)
2171 #define PKCS_TIME_REQUEST ((LPCSTR)18)
2172 #define RSA_CSP_PUBLICKEYBLOB ((LPCSTR)19)
2173 #define X509_UNICODE_NAME ((LPCSTR)20)
2174 #define X509_KEYGEN_REQUEST_TO_BE_SIGNED ((LPCSTR)21)
2175 #define PKCS_ATTRIBUTE ((LPCSTR)22)
2176 #define PKCS_CONTENT_INFO_SEQUENCE_OF_ANY ((LPCSTR)23)
2177 #define X509_UNICODE_NAME_VALUE ((LPCSTR)24)
2178 #define X509_UNICODE_ANY_STRING X509_UNICODE_NAME_VALUE
2179 #define X509_OCTET_STRING ((LPCSTR)25)
2180 #define X509_BITS ((LPCSTR)26)
2181 #define X509_INTEGER ((LPCSTR)27)
2182 #define X509_MULTI_BYTE_INTEGER ((LPCSTR)28)
2183 #define X509_ENUMERATED ((LPCSTR)29)
2184 #define X509_CRL_REASON_CODE X509_ENUMERATED
2185 #define X509_CHOICE_OF_TIME ((LPCSTR)30)
2186 #define X509_AUTHORITY_KEY_ID2 ((LPCSTR)31)
2187 #define X509_AUTHORITY_INFO_ACCESS ((LPCSTR)32)
2188 #define PKCS_CONTENT_INFO ((LPCSTR)33)
2189 #define X509_SEQUENCE_OF_ANY ((LPCSTR)34)
2190 #define X509_CRL_DIST_POINTS ((LPCSTR)35)
2191 #define X509_ENHANCED_KEY_USAGE ((LPCSTR)36)
2192 #define PKCS_CTL ((LPCSTR)37)
2193 #define X509_MULTI_BYTE_UINT ((LPCSTR)38)
2194 #define X509_DSS_PUBLICKEY X509_MULTI_BYTE_UINT
2195 #define X509_DSS_PARAMETERS ((LPCSTR)39)
2196 #define X509_DSS_SIGNATURE ((LPCSTR)40)
2197 #define PKCS_RC2_CBC_PARAMETERS ((LPCSTR)41)
2198 #define PKCS_SMIME_CAPABILITIES ((LPCSTR)42)
2199 #define PKCS_RSA_PRIVATE_KEY ((LPCSTR)43)
2200 #define PKCS_PRIVATE_KEY_INFO ((LPCSTR)44)
2201 #define PKCS_ENCRYPTED_PRIVATE_KEY_INFO ((LPCSTR)45)
2202 #define X509_PKIX_POLICY_QUALIFIER_USERNOTICE ((LPCSTR)46)
2203 #define X509_DH_PUBLICKEY X509_MULTI_BYTE_UINT
2204 #define X509_DH_PARAMETERS ((LPCSTR)47)
2205 #define PKCS_ATTRIBUTES ((LPCSTR)48)
2206 #define PKCS_SORTED_CTL ((LPCSTR)49)
2207 #define X942_DH_PARAMETERS ((LPCSTR)50)
2208 #define X509_BITS_WITHOUT_TRAILING_ZEROES ((LPCSTR)51)
2209 #define X942_OTHER_INFO ((LPCSTR)52)
2210 #define X509_CERT_PAIR ((LPCSTR)53)
2211 #define X509_ISSUING_DIST_POINT ((LPCSTR)54)
2212 #define X509_NAME_CONSTRAINTS ((LPCSTR)55)
2213 #define X509_POLICY_MAPPINGS ((LPCSTR)56)
2214 #define X509_POLICY_CONSTRAINTS ((LPCSTR)57)
2215 #define X509_CROSS_CERT_DIST_POINTS ((LPCSTR)58)
2216 #define CMC_DATA ((LPCSTR)59)
2217 #define CMC_RESPONSE ((LPCSTR)60)
2218 #define CMC_STATUS ((LPCSTR)61)
2219 #define CMC_ADD_EXTENSIONS ((LPCSTR)62)
2220 #define CMC_ADD_ATTRIBUTES ((LPCSTR)63)
2221 #define X509_CERTIFICATE_TEMPLATE ((LPCSTR)64)
2222 #define PKCS7_SIGNER_INFO ((LPCSTR)500)
2223 #define CMS_SIGNER_INFO ((LPCSTR)501)
2225 /* encode/decode flags */
2226 #define CRYPT_ENCODE_NO_SIGNATURE_BYTE_REVERSAL_FLAG 0x00008
2227 #define CRYPT_ENCODE_ALLOC_FLAG 0x08000
2228 #define CRYPT_SORTED_CTL_ENCODE_HASHED_SUBJECT_IDENTIFIER_FLAG 0x10000
2229 #define CRYPT_UNICODE_NAME_ENCODE_ENABLE_T61_UNICODE_FLAG \
2230 CERT_RDN_ENABLE_T61_UNICODE_FLAG
2231 #define CRYPT_UNICODE_NAME_ENCODE_ENABLE_UTF8_UNICODE_FLAG \
2232 CERT_RDN_ENABLE_UTF8_UNICODE_FLAG
2233 #define CRYPT_UNICODE_NAME_ENCODE_DISABLE_CHECK_TYPE_FLAG \
2234 CERT_RDN_DISABLE_CHECK_TYPE_FLAG
2236 #define CRYPT_DECODE_NOCOPY_FLAG 0x00001
2237 #define CRYPT_DECODE_TO_BE_SIGNED_FLAG 0x00002
2238 #define CRYPT_DECODE_SHARE_OID_STRING_FLAG 0x00004
2239 #define CRYPT_DECODE_NO_SIGNATURE_BYTE_REVERSAL_FLAG 0x00008
2240 #define CRYPT_DECODE_ALLOC_FLAG 0x08000
2241 #define CRYPT_UNICODE_NAME_DECODE_DISABLE_IE4_UTF8_FLAG \
2242 CERT_RDN_DISABLE_IE4_UTF8_FLAG
2244 /* subject types for CryptVerifyCertificateSignatureEx */
2245 #define CRYPT_VERIFY_CERT_SIGN_SUBJECT_BLOB 1
2246 #define CRYPT_VERIFY_CERT_SIGN_SUBJECT_CERT 2
2247 #define CRYPT_VERIFY_CERT_SIGN_SUBJECT_CRL 3
2249 /* issuer types for CryptVerifyCertificateSignatureEx */
2250 #define CRYPT_VERIFY_CERT_SIGN_ISSUER_PUBKEY 1
2251 #define CRYPT_VERIFY_CERT_SIGN_ISSUER_CERT 2
2252 #define CRYPT_VERIFY_CERT_SIGN_ISSUER_CHAIN 3
2253 #define CRYPT_VERIFY_CERT_SIGN_ISSUER_NULL 4
2255 /* function declarations */
2257 BOOL WINAPI
CryptAcquireContextA(HCRYPTPROV
*phProv
, LPCSTR pszContainer
,
2258 LPCSTR pszProvider
, DWORD dwProvType
,
2260 BOOL WINAPI
CryptAcquireContextW (HCRYPTPROV
*phProv
, LPCWSTR pszContainer
,
2261 LPCWSTR pszProvider
, DWORD dwProvType
, DWORD dwFlags
);
2262 #define CryptAcquireContext WINELIB_NAME_AW(CryptAcquireContext)
2263 BOOL WINAPI
CryptGenRandom (HCRYPTPROV hProv
, DWORD dwLen
, BYTE
*pbBuffer
);
2264 BOOL WINAPI
CryptContextAddRef (HCRYPTPROV hProv
, DWORD
*pdwReserved
, DWORD dwFlags
);
2265 BOOL WINAPI
CryptCreateHash (HCRYPTPROV hProv
, ALG_ID Algid
, HCRYPTKEY hKey
,
2266 DWORD dwFlags
, HCRYPTHASH
*phHash
);
2267 BOOL WINAPI
CryptDecrypt (HCRYPTKEY hKey
, HCRYPTHASH hHash
, BOOL Final
,
2268 DWORD dwFlags
, BYTE
*pbData
, DWORD
*pdwDataLen
);
2269 BOOL WINAPI
CryptDeriveKey (HCRYPTPROV hProv
, ALG_ID Algid
, HCRYPTHASH hBaseData
,
2270 DWORD dwFlags
, HCRYPTKEY
*phKey
);
2271 BOOL WINAPI
CryptDestroyHash (HCRYPTHASH hHash
);
2272 BOOL WINAPI
CryptDestroyKey (HCRYPTKEY hKey
);
2273 BOOL WINAPI
CryptDuplicateKey (HCRYPTKEY hKey
, DWORD
*pdwReserved
, DWORD dwFlags
, HCRYPTKEY
*phKey
);
2274 BOOL WINAPI
CryptDuplicateHash (HCRYPTHASH hHash
, DWORD
*pdwReserved
,
2275 DWORD dwFlags
, HCRYPTHASH
*phHash
);
2276 BOOL WINAPI
CryptEncrypt (HCRYPTKEY hKey
, HCRYPTHASH hHash
, BOOL Final
,
2277 DWORD dwFlags
, BYTE
*pbData
, DWORD
*pdwDataLen
, DWORD dwBufLen
);
2278 BOOL WINAPI
CryptEnumProvidersA (DWORD dwIndex
, DWORD
*pdwReserved
,
2279 DWORD dwFlags
, DWORD
*pdwProvType
, LPSTR pszProvName
, DWORD
*pcbProvName
);
2280 BOOL WINAPI
CryptEnumProvidersW (DWORD dwIndex
, DWORD
*pdwReserved
,
2281 DWORD dwFlags
, DWORD
*pdwProvType
, LPWSTR pszProvName
, DWORD
*pcbProvName
);
2282 #define CryptEnumProviders WINELIB_NAME_AW(CryptEnumProviders)
2283 BOOL WINAPI
CryptEnumProviderTypesA (DWORD dwIndex
, DWORD
*pdwReserved
,
2284 DWORD dwFlags
, DWORD
*pdwProvType
, LPSTR pszTypeName
, DWORD
*pcbTypeName
);
2285 BOOL WINAPI
CryptEnumProviderTypesW (DWORD dwIndex
, DWORD
*pdwReserved
,
2286 DWORD dwFlags
, DWORD
*pdwProvType
, LPWSTR pszTypeName
, DWORD
*pcbTypeName
);
2287 #define CryptEnumProviderTypes WINELIB_NAME_AW(CryptEnumProviderTypes)
2288 BOOL WINAPI
CryptExportKey (HCRYPTKEY hKey
, HCRYPTKEY hExpKey
, DWORD dwBlobType
,
2289 DWORD dwFlags
, BYTE
*pbData
, DWORD
*pdwDataLen
);
2290 BOOL WINAPI
CryptGenKey (HCRYPTPROV hProv
, ALG_ID Algid
, DWORD dwFlags
, HCRYPTKEY
*phKey
);
2291 BOOL WINAPI
CryptGetKeyParam (HCRYPTKEY hKey
, DWORD dwParam
, BYTE
*pbData
,
2292 DWORD
*pdwDataLen
, DWORD dwFlags
);
2293 BOOL WINAPI
CryptGetHashParam (HCRYPTHASH hHash
, DWORD dwParam
, BYTE
*pbData
,
2294 DWORD
*pdwDataLen
, DWORD dwFlags
);
2295 BOOL WINAPI
CryptGetProvParam (HCRYPTPROV hProv
, DWORD dwParam
, BYTE
*pbData
,
2296 DWORD
*pdwDataLen
, DWORD dwFlags
);
2297 BOOL WINAPI
CryptGetDefaultProviderA (DWORD dwProvType
, DWORD
*pdwReserved
,
2298 DWORD dwFlags
, LPSTR pszProvName
, DWORD
*pcbProvName
);
2299 BOOL WINAPI
CryptGetDefaultProviderW (DWORD dwProvType
, DWORD
*pdwReserved
,
2300 DWORD dwFlags
, LPWSTR pszProvName
, DWORD
*pcbProvName
);
2301 #define CryptGetDefaultProvider WINELIB_NAME_AW(CryptGetDefaultProvider)
2302 BOOL WINAPI
CryptGetUserKey (HCRYPTPROV hProv
, DWORD dwKeySpec
, HCRYPTKEY
*phUserKey
);
2303 BOOL WINAPI
CryptHashData (HCRYPTHASH hHash
, const BYTE
*pbData
, DWORD dwDataLen
, DWORD dwFlags
);
2304 BOOL WINAPI
CryptHashSessionKey (HCRYPTHASH hHash
, HCRYPTKEY hKey
, DWORD dwFlags
);
2305 BOOL WINAPI
CryptImportKey (HCRYPTPROV hProv
, BYTE
*pbData
, DWORD dwDataLen
,
2306 HCRYPTKEY hPubKey
, DWORD dwFlags
, HCRYPTKEY
*phKey
);
2307 BOOL WINAPI
CryptReleaseContext (HCRYPTPROV hProv
, DWORD dwFlags
);
2308 BOOL WINAPI
CryptSetHashParam (HCRYPTHASH hHash
, DWORD dwParam
, BYTE
*pbData
, DWORD dwFlags
);
2309 BOOL WINAPI
CryptSetKeyParam (HCRYPTKEY hKey
, DWORD dwParam
, BYTE
*pbData
, DWORD dwFlags
);
2310 BOOL WINAPI
CryptSetProviderA (LPCSTR pszProvName
, DWORD dwProvType
);
2311 BOOL WINAPI
CryptSetProviderW (LPCWSTR pszProvName
, DWORD dwProvType
);
2312 #define CryptSetProvider WINELIB_NAME_AW(CryptSetProvider)
2313 BOOL WINAPI
CryptSetProviderExA (LPCSTR pszProvName
, DWORD dwProvType
, DWORD
*pdwReserved
, DWORD dwFlags
);
2314 BOOL WINAPI
CryptSetProviderExW (LPCWSTR pszProvName
, DWORD dwProvType
, DWORD
*pdwReserved
, DWORD dwFlags
);
2315 #define CryptSetProviderEx WINELIB_NAME_AW(CryptSetProviderEx)
2316 BOOL WINAPI
CryptSetProvParam (HCRYPTPROV hProv
, DWORD dwParam
, BYTE
*pbData
, DWORD dwFlags
);
2317 BOOL WINAPI
CryptSignHashA (HCRYPTHASH hHash
, DWORD dwKeySpec
, LPCSTR sDescription
,
2318 DWORD dwFlags
, BYTE
*pbSignature
, DWORD
*pdwSigLen
);
2319 BOOL WINAPI
CryptSignHashW (HCRYPTHASH hHash
, DWORD dwKeySpec
, LPCWSTR sDescription
,
2320 DWORD dwFlags
, BYTE
*pbSignature
, DWORD
*pdwSigLen
);
2321 #define CryptSignHash WINELIB_NAME_AW(CryptSignHash)
2322 BOOL WINAPI
CryptVerifySignatureA (HCRYPTHASH hHash
, BYTE
*pbSignature
, DWORD dwSigLen
,
2323 HCRYPTKEY hPubKey
, LPCSTR sDescription
, DWORD dwFlags
);
2324 BOOL WINAPI
CryptVerifySignatureW (HCRYPTHASH hHash
, BYTE
*pbSignature
, DWORD dwSigLen
,
2325 HCRYPTKEY hPubKey
, LPCWSTR sDescription
, DWORD dwFlags
);
2326 #define CryptVerifySignature WINELIB_NAME_AW(CryptVerifySignature)
2328 /* crypt32.dll functions */
2329 LPVOID WINAPI
CryptMemAlloc(ULONG cbSize
);
2330 LPVOID WINAPI
CryptMemRealloc(LPVOID pv
, ULONG cbSize
);
2331 VOID WINAPI
CryptMemFree(LPVOID pv
);
2333 BOOL WINAPI
CryptRegisterDefaultOIDFunction(DWORD
,LPCSTR
,DWORD
,LPCWSTR
);
2334 BOOL WINAPI
CryptRegisterOIDFunction(DWORD
,LPCSTR
,LPCSTR
,LPCWSTR
,LPCSTR
);
2335 BOOL WINAPI
CryptGetOIDFunctionValue(DWORD dwEncodingType
, LPCSTR pszFuncName
,
2336 LPCSTR pszOID
, LPCWSTR szValueName
, DWORD
*pdwValueType
,
2337 BYTE
*pbValueData
, DWORD
*pcbValueData
);
2338 BOOL WINAPI
CryptSetOIDFunctionValue(DWORD dwEncodingType
, LPCSTR pszFuncName
,
2339 LPCSTR pszOID
, LPCWSTR pwszValueName
, DWORD dwValueType
,
2340 const BYTE
*pbValueData
, DWORD cbValueData
);
2341 BOOL WINAPI
CryptUnregisterDefaultOIDFunction(DWORD
,LPCSTR
,LPCWSTR
);
2342 BOOL WINAPI
CryptUnregisterOIDFunction(DWORD
,LPCSTR
,LPCSTR
);
2343 BOOL WINAPI
CryptEnumOIDFunction(DWORD dwEncodingType
, LPCSTR pszFuncName
,
2344 LPCSTR pszOID
, DWORD dwFlags
, void *pvArg
,
2345 PFN_CRYPT_ENUM_OID_FUNC pfnEnumOIDFunc
);
2346 HCRYPTOIDFUNCSET WINAPI
CryptInitOIDFunctionSet(LPCSTR
,DWORD
);
2347 BOOL WINAPI
CryptGetDefaultOIDDllList(HCRYPTOIDFUNCSET hFuncSet
,
2348 DWORD dwEncodingType
, LPWSTR pwszDllList
, DWORD
*pcchDllList
);
2349 BOOL WINAPI
CryptGetDefaultOIDFunctionAddress(HCRYPTOIDFUNCSET hFuncSet
,
2350 DWORD dwEncodingType
, LPCWSTR pwszDll
, DWORD dwFlags
, void *ppvFuncAddr
,
2351 HCRYPTOIDFUNCADDR
*phFuncAddr
);
2352 BOOL WINAPI
CryptGetOIDFunctionAddress(HCRYPTOIDFUNCSET hFuncSet
,
2353 DWORD dwEncodingType
, LPCSTR pszOID
, DWORD dwFlags
, void **ppvFuncAddr
,
2354 HCRYPTOIDFUNCADDR
*phFuncAddr
);
2355 BOOL WINAPI
CryptFreeOIDFunctionAddress(HCRYPTOIDFUNCADDR hFuncAddr
,
2357 BOOL WINAPI
CryptInstallOIDFunctionAddress(HMODULE hModule
,
2358 DWORD dwEncodingType
, LPCSTR pszFuncName
, DWORD cFuncEntry
,
2359 const CRYPT_OID_FUNC_ENTRY rgFuncEntry
[], DWORD dwFlags
);
2361 BOOL WINAPI
CryptEnumOIDInfo(DWORD dwGroupId
, DWORD dwFlags
, void *pvArg
,
2362 PFN_CRYPT_ENUM_OID_INFO pfnEnumOIDInfo
);
2363 PCCRYPT_OID_INFO WINAPI
CryptFindOIDInfo(DWORD dwKeyType
, void *pvKey
,
2365 BOOL WINAPI
CryptRegisterOIDInfo(PCCRYPT_OID_INFO pInfo
, DWORD dwFlags
);
2366 BOOL WINAPI
CryptUnregisterOIDInfo(PCCRYPT_OID_INFO pInfo
);
2368 LPCSTR WINAPI
CertAlgIdToOID(DWORD dwAlgId
);
2369 DWORD WINAPI
CertOIDToAlgId(LPCSTR pszObjId
);
2371 /* cert store functions */
2372 HCERTSTORE WINAPI
CertOpenStore(LPCSTR lpszStoreProvider
, DWORD dwEncodingType
,
2373 HCRYPTPROV hCryptProv
, DWORD dwFlags
, const void *pvPara
);
2375 HCERTSTORE WINAPI
CertOpenSystemStoreA(HCRYPTPROV hProv
,
2376 LPCSTR szSubSystemProtocol
);
2377 HCERTSTORE WINAPI
CertOpenSystemStoreW(HCRYPTPROV hProv
,
2378 LPCWSTR szSubSystemProtocol
);
2379 #define CertOpenSystemStore WINELIB_NAME_AW(CertOpenSystemStore)
2381 PCCERT_CONTEXT WINAPI
CertEnumCertificatesInStore(HCERTSTORE hCertStore
,
2382 PCCERT_CONTEXT pPrev
);
2384 PCCRL_CONTEXT WINAPI
CertEnumCRLsInStore(HCERTSTORE hCertStore
,
2385 PCCRL_CONTEXT pPrev
);
2387 PCCTL_CONTEXT WINAPI
CertEnumCTLsInStore(HCERTSTORE hCertStore
,
2388 PCCTL_CONTEXT pPrev
);
2390 BOOL WINAPI
CertEnumSystemStoreLocation(DWORD dwFlags
, void *pvArg
,
2391 PFN_CERT_ENUM_SYSTEM_STORE_LOCATION pfnEnum
);
2393 BOOL WINAPI
CertEnumSystemStore(DWORD dwFlags
, void *pvSystemStoreLocationPara
,
2394 void *pvArg
, PFN_CERT_ENUM_SYSTEM_STORE pfnEnum
);
2396 BOOL WINAPI
CertEnumPhysicalStore(const void *pvSystemStore
, DWORD dwFlags
,
2397 void *pvArg
, PFN_CERT_ENUM_PHYSICAL_STORE pfnEnum
);
2399 BOOL WINAPI
CertSaveStore(HCERTSTORE hCertStore
, DWORD dwMsgAndCertEncodingType
,
2400 DWORD dwSaveAs
, DWORD dwSaveTo
, void* pvSaveToPara
, DWORD dwFlags
);
2402 BOOL WINAPI
CertAddStoreToCollection(HCERTSTORE hCollectionStore
,
2403 HCERTSTORE hSiblingStore
, DWORD dwUpdateFlags
, DWORD dwPriority
);
2405 void WINAPI
CertRemoveStoreFromCollection(HCERTSTORE hCollectionStore
,
2406 HCERTSTORE hSiblingStore
);
2408 PCCERT_CHAIN_CONTEXT WINAPI
CertFindChainInStore(HCERTSTORE hCertStore
,
2409 DWORD dwCertEncodingType
, DWORD dwFindFlags
, DWORD dwFindType
,
2410 const void *pvFindPara
, PCCERT_CHAIN_CONTEXT pPrevChainContext
);
2412 BOOL WINAPI
CertVerifyCertificateChainPolicy(LPCSTR szPolicyOID
,
2413 PCCERT_CHAIN_CONTEXT pChainContext
, PCERT_CHAIN_POLICY_PARA pPolicyPara
,
2414 PCERT_CHAIN_POLICY_STATUS pPolicyStatus
);
2416 DWORD WINAPI
CertEnumCertificateContextProperties(PCCERT_CONTEXT pCertContext
,
2419 BOOL WINAPI
CertGetCertificateContextProperty(PCCERT_CONTEXT pCertContext
,
2420 DWORD dwPropId
, void *pvData
, DWORD
*pcbData
);
2422 BOOL WINAPI
CertSetCertificateContextProperty(PCCERT_CONTEXT pCertContext
,
2423 DWORD dwPropId
, DWORD dwFlags
, const void *pvData
);
2425 DWORD WINAPI
CertEnumCRLContextProperties(PCCRL_CONTEXT pCRLContext
,
2428 BOOL WINAPI
CertGetCRLContextProperty(PCCRL_CONTEXT pCRLContext
,
2429 DWORD dwPropId
, void *pvData
, DWORD
*pcbData
);
2431 BOOL WINAPI
CertSetCRLContextProperty(PCCRL_CONTEXT pCRLContext
,
2432 DWORD dwPropId
, DWORD dwFlags
, const void *pvData
);
2434 DWORD WINAPI
CertEnumCTLContextProperties(PCCTL_CONTEXT pCTLContext
,
2437 BOOL WINAPI
CertGetCTLContextProperty(PCCTL_CONTEXT pCTLContext
,
2438 DWORD dwPropId
, void *pvData
, DWORD
*pcbData
);
2440 BOOL WINAPI
CertSetCTLContextProperty(PCCTL_CONTEXT pCTLContext
,
2441 DWORD dwPropId
, DWORD dwFlags
, const void *pvData
);
2443 BOOL WINAPI
CertGetStoreProperty(HCERTSTORE hCertStore
, DWORD dwPropId
,
2444 void *pvData
, DWORD
*pcbData
);
2446 BOOL WINAPI
CertSetStoreProperty(HCERTSTORE hCertStore
, DWORD dwPropId
,
2447 DWORD dwFlags
, const void *pvData
);
2449 BOOL WINAPI
CertControlStore(HCERTSTORE hCertStore
, DWORD dwFlags
,
2450 DWORD dwCtrlType
, void const *pvCtrlPara
);
2452 BOOL WINAPI
CertCloseStore( HCERTSTORE hCertStore
, DWORD dwFlags
);
2454 BOOL WINAPI
CertFreeCertificateContext( PCCERT_CONTEXT pCertContext
);
2456 BOOL WINAPI
CertFreeCRLContext( PCCRL_CONTEXT pCrlContext
);
2458 BOOL WINAPI
CertFreeCTLContext( PCCTL_CONTEXT pCtlContext
);
2460 BOOL WINAPI
CertAddCertificateContextToStore(HCERTSTORE hCertStore
,
2461 PCCERT_CONTEXT pCertContext
, DWORD dwAddDisposition
,
2462 PCCERT_CONTEXT
*ppStoreContext
);
2464 BOOL WINAPI
CertAddCRLContextToStore( HCERTSTORE hCertStore
,
2465 PCCRL_CONTEXT pCrlContext
, DWORD dwAddDisposition
,
2466 PCCRL_CONTEXT
*ppStoreContext
);
2468 BOOL WINAPI
CertAddCTLContextToStore( HCERTSTORE hCertStore
,
2469 PCCTL_CONTEXT pCtlContext
, DWORD dwAddDisposition
,
2470 PCCTL_CONTEXT
*ppStoreContext
);
2472 BOOL WINAPI
CertAddCertificateLinkToStore(HCERTSTORE hCertStore
,
2473 PCCERT_CONTEXT pCertContext
, DWORD dwAddDisposition
,
2474 PCCERT_CONTEXT
*ppStoreContext
);
2476 BOOL WINAPI
CertAddCRLLinkToStore(HCERTSTORE hCertStore
,
2477 PCCRL_CONTEXT pCrlContext
, DWORD dwAddDisposition
,
2478 PCCRL_CONTEXT
*ppStoreContext
);
2480 BOOL WINAPI
CertAddCTLLinkToStore(HCERTSTORE hCertStore
,
2481 PCCTL_CONTEXT pCtlContext
, DWORD dwAddDisposition
,
2482 PCCTL_CONTEXT
*ppStoreContext
);
2484 BOOL WINAPI
CertAddEncodedCertificateToStore(HCERTSTORE hCertStore
,
2485 DWORD dwCertEncodingType
, const BYTE
*pbCertEncoded
, DWORD cbCertEncoded
,
2486 DWORD dwAddDisposition
, PCCERT_CONTEXT
*ppCertContext
);
2488 BOOL WINAPI
CertAddEncodedCRLToStore(HCERTSTORE hCertStore
,
2489 DWORD dwCertEncodingType
, const BYTE
*pbCrlEncoded
, DWORD cbCrlEncoded
,
2490 DWORD dwAddDisposition
, PCCRL_CONTEXT
*ppCrlContext
);
2492 BOOL WINAPI
CertAddEncodedCTLToStore(HCERTSTORE hCertStore
,
2493 DWORD dwMsgAndCertEncodingType
, const BYTE
*pbCtlEncoded
, DWORD cbCtlEncoded
,
2494 DWORD dwAddDisposition
, PCCTL_CONTEXT
*ppCtlContext
);
2496 BOOL WINAPI
CertAddSerializedElementToStore(HCERTSTORE hCertStore
,
2497 const BYTE
*pbElement
, DWORD cbElement
, DWORD dwAddDisposition
, DWORD dwFlags
,
2498 DWORD dwContextTypeFlags
, DWORD
*pdwContentType
, const void **ppvContext
);
2500 const void *CertCreateContext(DWORD dwContextType
, DWORD dwEncodingType
,
2501 const BYTE
*pbEncoded
, DWORD cbEncoded
, DWORD dwFlags
,
2502 PCERT_CREATE_CONTEXT_PARA pCreatePara
);
2504 PCCERT_CONTEXT WINAPI
CertCreateCertificateContext(DWORD dwCertEncodingType
,
2505 const BYTE
*pbCertEncoded
, DWORD cbCertEncoded
);
2507 PCCRL_CONTEXT WINAPI
CertCreateCRLContext( DWORD dwCertEncodingType
,
2508 const BYTE
* pbCrlEncoded
, DWORD cbCrlEncoded
);
2510 PCCTL_CONTEXT WINAPI
CertCreateCTLContext(DWORD dwMsgAndCertEncodingType
,
2511 const BYTE
*pbCtlEncoded
, DWORD cbCtlEncoded
);
2513 BOOL WINAPI
CertDeleteCertificateFromStore(PCCERT_CONTEXT pCertContext
);
2515 BOOL WINAPI
CertDeleteCRLFromStore(PCCRL_CONTEXT pCrlContext
);
2517 BOOL WINAPI
CertDeleteCTLFromStore(PCCTL_CONTEXT pCtlContext
);
2519 PCCERT_CONTEXT WINAPI
CertDuplicateCertificateContext(
2520 PCCERT_CONTEXT pCertContext
);
2522 PCCRL_CONTEXT WINAPI
CertDuplicateCRLContext(PCCRL_CONTEXT pCrlContext
);
2524 PCCTL_CONTEXT WINAPI
CertDuplicateCTLContext(PCCTL_CONTEXT pCtlContext
);
2526 PCCERT_CONTEXT WINAPI
CertFindCertificateInStore( HCERTSTORE hCertStore
,
2527 DWORD dwCertEncodingType
, DWORD dwFindFlags
, DWORD dwFindType
,
2528 const void *pvFindPara
, PCCERT_CONTEXT pPrevCertContext
);
2530 PCCRL_CONTEXT WINAPI
CertFindCRLInStore(HCERTSTORE hCertStore
,
2531 DWORD dwCertEncodingType
, DWORD dwFindFlags
, DWORD dwFindType
,
2532 const void *pvFindPara
, PCCRL_CONTEXT pPrevCrlContext
);
2534 PCCTL_CONTEXT WINAPI
CertFindCTLInStore(HCERTSTORE hCertStore
,
2535 DWORD dwCertEncodingType
, DWORD dwFindFlags
, DWORD dwFindType
,
2536 const void *pvFindPara
, PCCTL_CONTEXT pPrevCtlContext
);
2538 BOOL WINAPI
CertSerializeCertificateStoreElement(PCCERT_CONTEXT pCertContext
,
2539 DWORD dwFlags
, BYTE
*pbElement
, DWORD
*pcbElement
);
2541 BOOL WINAPI
CertSerializeCRLStoreElement(PCCRL_CONTEXT pCrlContext
,
2542 DWORD dwFlags
, BYTE
*pbElement
, DWORD
*pcbElement
);
2544 BOOL WINAPI
CertSerializeCTLStoreElement(PCCTL_CONTEXT pCtlContext
,
2545 DWORD dwFlags
, BYTE
*pbElement
, DWORD
*pcbElement
);
2547 BOOL WINAPI
CryptEncodeObject(DWORD dwCertEncodingType
, LPCSTR lpszStructType
,
2548 const void *pvStructInfo
, BYTE
*pbEncoded
, DWORD
*pcbEncoded
);
2549 BOOL WINAPI
CryptEncodeObjectEx(DWORD dwCertEncodingType
, LPCSTR lpszStructType
,
2550 const void *pvStructInfo
, DWORD dwFlags
, PCRYPT_ENCODE_PARA pEncodePara
,
2551 void *pvEncoded
, DWORD
*pcbEncoded
);
2553 BOOL WINAPI
CryptDecodeObject(DWORD dwCertEncodingType
, LPCSTR lpszStructType
,
2554 const BYTE
*pbEncoded
, DWORD cbEncoded
, DWORD dwFlags
, void *pvStructInfo
,
2555 DWORD
*pcbStructInfo
);
2556 BOOL WINAPI
CryptDecodeObjectEx(DWORD dwCertEncodingType
, LPCSTR lpszStructType
,
2557 const BYTE
*pbEncoded
, DWORD cbEncoded
, DWORD dwFlags
,
2558 PCRYPT_DECODE_PARA pDecodePara
, void *pvStructInfo
, DWORD
*pcbStructInfo
);
2560 BOOL WINAPI
CryptHashCertificate(HCRYPTPROV hCryptProv
, ALG_ID Algid
,
2561 DWORD dwFlags
, const BYTE
*pbEncoded
, DWORD cbEncoded
, BYTE
*pbComputedHash
,
2562 DWORD
*pcbComputedHash
);
2564 BOOL WINAPI
CryptHashToBeSigned(HCRYPTPROV hCryptProv
, DWORD dwCertEncodingType
,
2565 const BYTE
*pbEncoded
, DWORD cbEncoded
, BYTE
*pbComputedHash
,
2566 DWORD
*pcbComputedHash
);
2568 BOOL WINAPI
CryptSignCertificate(HCRYPTPROV hCryptProv
, DWORD dwKeySpec
,
2569 DWORD dwCertEncodingType
, const BYTE
*pbEncodedToBeSigned
,
2570 DWORD cbEncodedToBeSigned
, PCRYPT_ALGORITHM_IDENTIFIER pSignatureAlgorithm
,
2571 const void *pvHashAuxInfo
, BYTE
*pbSignature
, DWORD
*pcbSignature
);
2573 BOOL WINAPI
CryptSignAndEncodeCertificate(HCRYPTPROV hCryptProv
,
2574 DWORD dwKeySpec
, DWORD dwCertEncodingType
, LPCSTR lpszStructType
,
2575 const void *pvStructInfo
, PCRYPT_ALGORITHM_IDENTIFIER pSignatureAlgorithm
,
2576 const void *pvHashAuxInfo
, PBYTE pbEncoded
, DWORD
*pcbEncoded
);
2578 BOOL WINAPI
CryptVerifyCertificateSignature(HCRYPTPROV hCryptProv
,
2579 DWORD dwCertEncodingType
, const BYTE
*pbEncoded
, DWORD cbEncoded
,
2580 PCERT_PUBLIC_KEY_INFO pPublicKey
);
2582 BOOL WINAPI
CryptVerifyCertificateSignatureEx(HCRYPTPROV hCryptProv
,
2583 DWORD dwCertEncodingType
, DWORD dwSubjectType
, void *pvSubject
,
2584 DWORD dwIssuerType
, void *pvIssuer
, DWORD dwFlags
, void *pvReserved
);
2586 PCRYPT_ATTRIBUTE WINAPI
CertFindAttribute(LPCSTR pszObjId
, DWORD cAttr
,
2587 CRYPT_ATTRIBUTE rgAttr
[]);
2588 PCERT_EXTENSION WINAPI
CertFindExtension(LPCSTR pszObjId
, DWORD cExtensions
,
2589 CERT_EXTENSION rgExtensions
[]);
2590 PCERT_RDN_ATTR WINAPI
CertFindRDNAttr(LPCSTR pszObjId
, PCERT_NAME_INFO pName
);
2592 LONG WINAPI
CertVerifyTimeValidity(LPFILETIME pTimeToVerify
,
2593 PCERT_INFO pCertInfo
);
2595 BOOL WINAPI
CryptExportPublicKeyInfo(HCRYPTPROV hCryptProv
, DWORD dwKeySpec
,
2596 DWORD dwCertEncodingType
, PCERT_PUBLIC_KEY_INFO pInfo
, DWORD
*pcbInfo
);
2597 BOOL WINAPI
CryptExportPublicKeyInfoEx(HCRYPTPROV hCryptProv
, DWORD dwKeySpec
,
2598 DWORD dwCertEncodingType
, LPSTR pszPublicKeyObjId
, DWORD dwFlags
,
2599 void *pvAuxInfo
, PCERT_PUBLIC_KEY_INFO pInfo
, DWORD
*pcbInfo
);
2600 BOOL WINAPI
CryptImportPublicKeyInfo(HCRYPTPROV hCryptProv
,
2601 DWORD dwCertEncodingType
, PCERT_PUBLIC_KEY_INFO pInfo
, HCRYPTKEY
*phKey
);
2602 BOOL WINAPI
CryptImportPublicKeyInfoEx(HCRYPTPROV hCryptProv
,
2603 DWORD dwCertEncodingType
, PCERT_PUBLIC_KEY_INFO pInfo
, ALG_ID aiKeyAlg
,
2604 DWORD dwFlags
, void *pvAuxInfo
, HCRYPTKEY
*phKey
);
2606 BOOL WINAPI
CryptProtectData( DATA_BLOB
* pDataIn
, LPCWSTR szDataDescr
,
2607 DATA_BLOB
* pOptionalEntropy
, PVOID pvReserved
,
2608 CRYPTPROTECT_PROMPTSTRUCT
* pPromptStruct
, DWORD dwFlags
, DATA_BLOB
* pDataOut
);
2610 BOOL WINAPI
CryptUnprotectData( DATA_BLOB
* pDataIn
, LPWSTR
* ppszDataDescr
,
2611 DATA_BLOB
* pOptionalEntropy
, PVOID pvReserved
,
2612 CRYPTPROTECT_PROMPTSTRUCT
* pPromptStruct
, DWORD dwFlags
, DATA_BLOB
* pDataOut
);