Home | History | Annotate | Download | only in include
      1 /**
      2  * This file has no copyright assigned and is placed in the Public Domain.
      3  * This file is part of the mingw-w64 runtime package.
      4  * No warranty is given; refer to the file DISCLAIMER.PD within this package.
      5  */
      6 #ifndef __WINCRYPT_H__
      7 #define __WINCRYPT_H__
      8 
      9 #include <_mingw.h>
     10 #include <_mingw_unicode.h>
     11 #include <guiddef.h>
     12 #include <winapifamily.h>
     13 
     14 #ifdef __cplusplus
     15 extern "C" {
     16 #endif
     17 
     18 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
     19 
     20 #ifndef _HRESULT_DEFINED
     21 #define _HRESULT_DEFINED
     22   typedef LONG HRESULT;
     23 #endif
     24 
     25 #ifndef DECLSPEC_IMPORT
     26 #ifndef __WIDL__
     27 #define DECLSPEC_IMPORT __declspec(dllimport)
     28 #else
     29 #define DECLSPEC_IMPORT
     30 #endif
     31 #endif
     32 
     33 #ifndef WINIMPM
     34 #define WINIMPM DECLSPEC_IMPORT
     35 #endif
     36 
     37 #include <apisetcconv.h>
     38 
     39 #ifndef WINAPI
     40 #if defined(_ARM_)
     41 #define WINAPI
     42 #else
     43 #define WINAPI __stdcall
     44 #endif
     45 #endif
     46 
     47 #ifndef CALLBACK
     48 #if defined(_ARM_)
     49 #define CALLBACK
     50 #else
     51 #define CALLBACK __stdcall
     52 #endif
     53 #endif
     54 
     55 #ifndef CONST
     56 #define CONST const
     57 #endif
     58 
     59 #ifndef _NO_W32_PSEUDO_MODIFIERS
     60 #ifndef IN
     61 #define IN
     62 #endif
     63 
     64 #ifndef OUT
     65 #define OUT
     66 #endif
     67 
     68 #ifndef OPTIONAL
     69 #define OPTIONAL
     70 #endif
     71 #endif
     72 
     73 #ifndef WINCRYPT32API
     74 #define WINCRYPT32API WINIMPM
     75 #endif
     76 
     77 #ifndef WINCRYPT32STRINGAPI
     78 #define WINCRYPT32STRINGAPI WINIMPM
     79 #endif
     80 
     81 #define GET_ALG_CLASS(x) (x & (7 << 13))
     82 #define GET_ALG_TYPE(x) (x & (15 << 9))
     83 #define GET_ALG_SID(x) (x & 511)
     84 
     85 #define ALG_CLASS_ANY (0)
     86 #define ALG_CLASS_SIGNATURE (1 << 13)
     87 #define ALG_CLASS_MSG_ENCRYPT (2 << 13)
     88 #define ALG_CLASS_DATA_ENCRYPT (3 << 13)
     89 #define ALG_CLASS_HASH (4 << 13)
     90 #define ALG_CLASS_KEY_EXCHANGE (5 << 13)
     91 #define ALG_CLASS_ALL (7 << 13)
     92 
     93 #define ALG_TYPE_ANY (0)
     94 #define ALG_TYPE_DSS (1 << 9)
     95 #define ALG_TYPE_RSA (2 << 9)
     96 #define ALG_TYPE_BLOCK (3 << 9)
     97 #define ALG_TYPE_STREAM (4 << 9)
     98 #define ALG_TYPE_DH (5 << 9)
     99 #define ALG_TYPE_SECURECHANNEL (6 << 9)
    100 
    101 #define ALG_SID_ANY (0)
    102 
    103 #define ALG_SID_RSA_ANY 0
    104 #define ALG_SID_RSA_PKCS 1
    105 #define ALG_SID_RSA_MSATWORK 2
    106 #define ALG_SID_RSA_ENTRUST 3
    107 #define ALG_SID_RSA_PGP 4
    108 
    109 #define ALG_SID_DSS_ANY 0
    110 #define ALG_SID_DSS_PKCS 1
    111 #define ALG_SID_DSS_DMS 2
    112 #if NTDDI_VERSION >= 0x06000000
    113 #define ALG_SID_ECDSA 3
    114 #endif
    115 
    116 #define ALG_SID_DES 1
    117 #define ALG_SID_3DES 3
    118 #define ALG_SID_DESX 4
    119 #define ALG_SID_IDEA 5
    120 #define ALG_SID_CAST 6
    121 #define ALG_SID_SAFERSK64 7
    122 #define ALG_SID_SAFERSK128 8
    123 #define ALG_SID_3DES_112 9
    124 #define ALG_SID_SKIPJACK 10
    125 #define ALG_SID_TEK 11
    126 #define ALG_SID_CYLINK_MEK 12
    127 #define ALG_SID_RC5 13
    128 #define ALG_SID_AES_128 14
    129 #define ALG_SID_AES_192 15
    130 #define ALG_SID_AES_256 16
    131 #define ALG_SID_AES 17
    132 
    133 #define CRYPT_MODE_CBCI 6
    134 #define CRYPT_MODE_CFBP 7
    135 #define CRYPT_MODE_OFBP 8
    136 #define CRYPT_MODE_CBCOFM 9
    137 #define CRYPT_MODE_CBCOFMI 10
    138 
    139 #define ALG_SID_RC2 2
    140 
    141 #define ALG_SID_RC4 1
    142 #define ALG_SID_SEAL 2
    143 
    144 #define ALG_SID_DH_SANDF 1
    145 #define ALG_SID_DH_EPHEM 2
    146 #define ALG_SID_AGREED_KEY_ANY 3
    147 #define ALG_SID_KEA 4
    148 #if NTDDI_VERSION >= 0x06000000
    149 #define ALG_SID_ECDH 5
    150 #endif
    151 
    152 #define ALG_SID_MD2 1
    153 #define ALG_SID_MD4 2
    154 #define ALG_SID_MD5 3
    155 #define ALG_SID_SHA 4
    156 #define ALG_SID_SHA1 4
    157 #define ALG_SID_MAC 5
    158 #define ALG_SID_RIPEMD 6
    159 #define ALG_SID_RIPEMD160 7
    160 #define ALG_SID_SSL3SHAMD5 8
    161 #define ALG_SID_HMAC 9
    162 #define ALG_SID_TLS1PRF 10
    163 #define ALG_SID_HASH_REPLACE_OWF 11
    164 #define ALG_SID_SHA_256 12
    165 #define ALG_SID_SHA_384 13
    166 #define ALG_SID_SHA_512 14
    167 
    168 #define ALG_SID_SSL3_MASTER 1
    169 #define ALG_SID_SCHANNEL_MASTER_HASH 2
    170 #define ALG_SID_SCHANNEL_MAC_KEY 3
    171 #define ALG_SID_PCT1_MASTER 4
    172 #define ALG_SID_SSL2_MASTER 5
    173 #define ALG_SID_TLS1_MASTER 6
    174 #define ALG_SID_SCHANNEL_ENC_KEY 7
    175 
    176 #if NTDDI_VERSION >= 0x06000000
    177 #define ALG_SID_ECMQV 1
    178 #endif
    179 
    180 #define ALG_SID_EXAMPLE 80
    181 
    182 #ifndef ALGIDDEF
    183 #define ALGIDDEF
    184   typedef unsigned int ALG_ID;
    185 #endif
    186 
    187 #define CALG_MD2 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MD2)
    188 #define CALG_MD4 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MD4)
    189 #define CALG_MD5 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MD5)
    190 #define CALG_SHA (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA)
    191 #define CALG_SHA1 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA1)
    192 #define CALG_MAC (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_MAC)
    193 #define CALG_RSA_SIGN (ALG_CLASS_SIGNATURE | ALG_TYPE_RSA | ALG_SID_RSA_ANY)
    194 #define CALG_DSS_SIGN (ALG_CLASS_SIGNATURE | ALG_TYPE_DSS | ALG_SID_DSS_ANY)
    195 #define CALG_NO_SIGN (ALG_CLASS_SIGNATURE | ALG_TYPE_ANY | ALG_SID_ANY)
    196 #define CALG_RSA_KEYX (ALG_CLASS_KEY_EXCHANGE|ALG_TYPE_RSA|ALG_SID_RSA_ANY)
    197 #define CALG_DES (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_DES)
    198 #define CALG_3DES_112 (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_3DES_112)
    199 #define CALG_3DES (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_3DES)
    200 #define CALG_DESX (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_DESX)
    201 #define CALG_RC2 (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_RC2)
    202 #define CALG_RC4 (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_STREAM|ALG_SID_RC4)
    203 #define CALG_SEAL (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_STREAM|ALG_SID_SEAL)
    204 #define CALG_DH_SF (ALG_CLASS_KEY_EXCHANGE|ALG_TYPE_DH|ALG_SID_DH_SANDF)
    205 #define CALG_DH_EPHEM (ALG_CLASS_KEY_EXCHANGE|ALG_TYPE_DH|ALG_SID_DH_EPHEM)
    206 #define CALG_AGREEDKEY_ANY (ALG_CLASS_KEY_EXCHANGE|ALG_TYPE_DH|ALG_SID_AGREED_KEY_ANY)
    207 #define CALG_KEA_KEYX (ALG_CLASS_KEY_EXCHANGE|ALG_TYPE_DH|ALG_SID_KEA)
    208 #define CALG_HUGHES_MD5 (ALG_CLASS_KEY_EXCHANGE|ALG_TYPE_ANY|ALG_SID_MD5)
    209 #define CALG_SKIPJACK (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_SKIPJACK)
    210 #define CALG_TEK (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_TEK)
    211 #define CALG_CYLINK_MEK (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_CYLINK_MEK)
    212 #define CALG_SSL3_SHAMD5 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SSL3SHAMD5)
    213 #define CALG_SSL3_MASTER (ALG_CLASS_MSG_ENCRYPT|ALG_TYPE_SECURECHANNEL|ALG_SID_SSL3_MASTER)
    214 #define CALG_SCHANNEL_MASTER_HASH (ALG_CLASS_MSG_ENCRYPT|ALG_TYPE_SECURECHANNEL|ALG_SID_SCHANNEL_MASTER_HASH)
    215 #define CALG_SCHANNEL_MAC_KEY (ALG_CLASS_MSG_ENCRYPT|ALG_TYPE_SECURECHANNEL|ALG_SID_SCHANNEL_MAC_KEY)
    216 #define CALG_SCHANNEL_ENC_KEY (ALG_CLASS_MSG_ENCRYPT|ALG_TYPE_SECURECHANNEL|ALG_SID_SCHANNEL_ENC_KEY)
    217 #define CALG_PCT1_MASTER (ALG_CLASS_MSG_ENCRYPT|ALG_TYPE_SECURECHANNEL|ALG_SID_PCT1_MASTER)
    218 #define CALG_SSL2_MASTER (ALG_CLASS_MSG_ENCRYPT|ALG_TYPE_SECURECHANNEL|ALG_SID_SSL2_MASTER)
    219 #define CALG_TLS1_MASTER (ALG_CLASS_MSG_ENCRYPT|ALG_TYPE_SECURECHANNEL|ALG_SID_TLS1_MASTER)
    220 #define CALG_RC5 (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_RC5)
    221 #define CALG_HMAC (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_HMAC)
    222 #define CALG_TLS1PRF (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_TLS1PRF)
    223 #define CALG_HASH_REPLACE_OWF (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_HASH_REPLACE_OWF)
    224 #define CALG_AES_128 (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_AES_128)
    225 #define CALG_AES_192 (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_AES_192)
    226 #define CALG_AES_256 (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_AES_256)
    227 #define CALG_AES (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_AES)
    228 #define CALG_SHA_256 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA_256)
    229 #define CALG_SHA_384 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA_384)
    230 #define CALG_SHA_512 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA_512)
    231 #if NTDDI_VERSION >= 0x06000000
    232 #define CALG_ECDH (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_DH | ALG_SID_ECDH)
    233 #define CALG_ECMQV (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_ANY | ALG_SID_ECMQV)
    234 #define CALG_ECDSA (ALG_CLASS_SIGNATURE | ALG_TYPE_DSS | ALG_SID_ECDSA)
    235 #endif
    236 
    237 /* In ncrypt.h too */
    238 #ifndef HCRYPTPROV_DEFINED
    239 #define HCRYPTPROV_DEFINED
    240   typedef ULONG_PTR HCRYPTHASH;
    241   typedef ULONG_PTR HCRYPTKEY;
    242   typedef ULONG_PTR HCRYPTPROV;
    243 #endif
    244 
    245 #define CRYPT_VERIFYCONTEXT 0xf0000000
    246 #define CRYPT_NEWKEYSET 0x8
    247 #define CRYPT_DELETEKEYSET 0x10
    248 #define CRYPT_MACHINE_KEYSET 0x20
    249 #define CRYPT_SILENT 0x40
    250 #if NTDDI_VERSION >= 0x06000000
    251 #define CRYPT_DEFAULT_CONTAINER_OPTIONAL 0x80
    252 #endif
    253 
    254 #define CRYPT_EXPORTABLE 0x1
    255 #define CRYPT_USER_PROTECTED 0x2
    256 #define CRYPT_CREATE_SALT 0x4
    257 #define CRYPT_UPDATE_KEY 0x8
    258 #define CRYPT_NO_SALT 0x10
    259 #define CRYPT_PREGEN 0x40
    260 #define CRYPT_RECIPIENT 0x10
    261 #define CRYPT_INITIATOR 0x40
    262 #define CRYPT_ONLINE 0x80
    263 #define CRYPT_SF 0x100
    264 #define CRYPT_CREATE_IV 0x200
    265 #define CRYPT_KEK 0x400
    266 #define CRYPT_DATA_KEY 0x800
    267 #define CRYPT_VOLATILE 0x1000
    268 #define CRYPT_SGCKEY 0x2000
    269 #define CRYPT_ARCHIVABLE 0x4000
    270 #if NTDDI_VERSION >= 0x06000000
    271 #define CRYPT_FORCE_KEY_PROTECTION_HIGH 0x8000
    272 #endif
    273 #define CRYPT_USER_PROTECTED_STRONG 0x100000
    274 
    275 #define RSA1024BIT_KEY 0x4000000
    276 
    277 #define CRYPT_SERVER 0x400
    278 
    279 #define KEY_LENGTH_MASK 0xffff0000
    280 
    281 #define CRYPT_Y_ONLY 0x1
    282 #define CRYPT_SSL2_FALLBACK 0x2
    283 #define CRYPT_DESTROYKEY 0x4
    284 #define CRYPT_DECRYPT_RSA_NO_PADDING_CHECK 0x20
    285 #define CRYPT_OAEP 0x40
    286 #define CRYPT_BLOB_VER3 0x80
    287 #define CRYPT_IPSEC_HMAC_KEY 0x100
    288 
    289 #define CRYPT_SECRETDIGEST 0x1
    290 #define CRYPT_OWF_REPL_LM_HASH 0x1
    291 #define CRYPT_LITTLE_ENDIAN 0x1
    292 
    293 #define CRYPT_NOHASHOID 0x1
    294 #define CRYPT_TYPE2_FORMAT 0x2
    295 #define CRYPT_X931_FORMAT 0x4
    296 
    297 #define CRYPT_MACHINE_DEFAULT 0x1
    298 #define CRYPT_USER_DEFAULT 0x2
    299 #define CRYPT_DELETE_DEFAULT 0x4
    300 
    301 #define SIMPLEBLOB 0x1
    302 #define PUBLICKEYBLOB 0x6
    303 #define PRIVATEKEYBLOB 0x7
    304 #define PLAINTEXTKEYBLOB 0x8
    305 #define OPAQUEKEYBLOB 0x9
    306 #define PUBLICKEYBLOBEX 0xa
    307 #define SYMMETRICWRAPKEYBLOB 0xb
    308 #define KEYSTATEBLOB 0xc
    309 
    310 #define AT_KEYEXCHANGE 1
    311 #define AT_SIGNATURE 2
    312 
    313 #define CRYPT_USERDATA 1
    314 
    315 #define KP_IV 1
    316 #define KP_SALT 2
    317 #define KP_PADDING 3
    318 #define KP_MODE 4
    319 #define KP_MODE_BITS 5
    320 #define KP_PERMISSIONS 6
    321 #define KP_ALGID 7
    322 #define KP_BLOCKLEN 8
    323 #define KP_KEYLEN 9
    324 #define KP_SALT_EX 10
    325 #define KP_P 11
    326 #define KP_G 12
    327 #define KP_Q 13
    328 #define KP_X 14
    329 #define KP_Y 15
    330 #define KP_RA 16
    331 #define KP_RB 17
    332 #define KP_INFO 18
    333 #define KP_EFFECTIVE_KEYLEN 19
    334 #define KP_SCHANNEL_ALG 20
    335 #define KP_CLIENT_RANDOM 21
    336 #define KP_SERVER_RANDOM 22
    337 #define KP_RP 23
    338 #define KP_PRECOMP_MD5 24
    339 #define KP_PRECOMP_SHA 25
    340 #define KP_CERTIFICATE 26
    341 #define KP_CLEAR_KEY 27
    342 #define KP_PUB_EX_LEN 28
    343 #define KP_PUB_EX_VAL 29
    344 #define KP_KEYVAL 30
    345 #define KP_ADMIN_PIN 31
    346 #define KP_KEYEXCHANGE_PIN 32
    347 #define KP_SIGNATURE_PIN 33
    348 #define KP_PREHASH 34
    349 #define KP_ROUNDS 35
    350 #define KP_OAEP_PARAMS 36
    351 #define KP_CMS_KEY_INFO 37
    352 #define KP_CMS_DH_KEY_INFO 38
    353 #define KP_PUB_PARAMS 39
    354 #define KP_VERIFY_PARAMS 40
    355 #define KP_HIGHEST_VERSION 41
    356 #define KP_GET_USE_COUNT 42
    357 #define KP_PIN_ID 43
    358 #define KP_PIN_INFO 44
    359 
    360 #define PKCS5_PADDING 1
    361 #define RANDOM_PADDING 2
    362 #define ZERO_PADDING 3
    363 
    364 #define CRYPT_MODE_CBC 1
    365 #define CRYPT_MODE_ECB 2
    366 #define CRYPT_MODE_OFB 3
    367 #define CRYPT_MODE_CFB 4
    368 #define CRYPT_MODE_CTS 5
    369 
    370 #define CRYPT_ENCRYPT 0x1
    371 #define CRYPT_DECRYPT 0x2
    372 #define CRYPT_EXPORT 0x4
    373 #define CRYPT_READ 0x8
    374 #define CRYPT_WRITE 0x10
    375 #define CRYPT_MAC 0x20
    376 #define CRYPT_EXPORT_KEY 0x40
    377 #define CRYPT_IMPORT_KEY 0x80
    378 #define CRYPT_ARCHIVE 0x100
    379 
    380 #define HP_ALGID 0x1
    381 #define HP_HASHVAL 0x2
    382 #define HP_HASHSIZE 0x4
    383 #define HP_HMAC_INFO 0x5
    384 #define HP_TLS1PRF_LABEL 0x6
    385 #define HP_TLS1PRF_SEED 0x7
    386 
    387 #define CRYPT_FAILED FALSE
    388 #define CRYPT_SUCCEED TRUE
    389 
    390 #define RCRYPT_SUCCEEDED(RT) ((RT) == CRYPT_SUCCEED)
    391 #define RCRYPT_FAILED(RT) ((RT) == CRYPT_FAILED)
    392 
    393 #define PP_ENUMALGS 1
    394 #define PP_ENUMCONTAINERS 2
    395 #define PP_IMPTYPE 3
    396 #define PP_NAME 4
    397 #define PP_VERSION 5
    398 #define PP_CONTAINER 6
    399 #define PP_CHANGE_PASSWORD 7
    400 #define PP_KEYSET_SEC_DESCR 8
    401 #define PP_CERTCHAIN 9
    402 #define PP_KEY_TYPE_SUBTYPE 10
    403 #define PP_PROVTYPE 16
    404 #define PP_KEYSTORAGE 17
    405 #define PP_APPLI_CERT 18
    406 #define PP_SYM_KEYSIZE 19
    407 #define PP_SESSION_KEYSIZE 20
    408 #define PP_UI_PROMPT 21
    409 #define PP_ENUMALGS_EX 22
    410 #define PP_ENUMMANDROOTS 25
    411 #define PP_ENUMELECTROOTS 26
    412 #define PP_KEYSET_TYPE 27
    413 #define PP_ADMIN_PIN 31
    414 #define PP_KEYEXCHANGE_PIN 32
    415 #define PP_SIGNATURE_PIN 33
    416 #define PP_SIG_KEYSIZE_INC 34
    417 #define PP_KEYX_KEYSIZE_INC 35
    418 #define PP_UNIQUE_CONTAINER 36
    419 #define PP_SGC_INFO 37
    420 #define PP_USE_HARDWARE_RNG 38
    421 #define PP_KEYSPEC 39
    422 #define PP_ENUMEX_SIGNING_PROT 40
    423 #define PP_CRYPT_COUNT_KEY_USE 41
    424 #if NTDDI_VERSION >= 0x06000000
    425 #define PP_USER_CERTSTORE 42
    426 #define PP_SMARTCARD_READER 43
    427 #define PP_SMARTCARD_GUID 45
    428 #define PP_ROOT_CERTSTORE 46
    429 #endif
    430 #if NTDDI_VERSION >= 0x06020000
    431 #define PP_SMARTCARD_READER_ICON 47
    432 #endif
    433 
    434 #define CRYPT_FIRST 1
    435 #define CRYPT_NEXT 2
    436 #define CRYPT_SGC_ENUM 4
    437 
    438 #define CRYPT_IMPL_HARDWARE 1
    439 #define CRYPT_IMPL_SOFTWARE 2
    440 #define CRYPT_IMPL_MIXED 3
    441 #define CRYPT_IMPL_UNKNOWN 4
    442 #define CRYPT_IMPL_REMOVABLE 8
    443 
    444 #define CRYPT_SEC_DESCR 0x1
    445 #define CRYPT_PSTORE 0x2
    446 #define CRYPT_UI_PROMPT 0x4
    447 
    448 #define CRYPT_FLAG_PCT1 0x1
    449 #define CRYPT_FLAG_SSL2 0x2
    450 #define CRYPT_FLAG_SSL3 0x4
    451 #define CRYPT_FLAG_TLS1 0x8
    452 #define CRYPT_FLAG_IPSEC 0x10
    453 #define CRYPT_FLAG_SIGNING 0x20
    454 
    455 #define CRYPT_SGC 0x1
    456 #define CRYPT_FASTSGC 0x2
    457 
    458 #define PP_CLIENT_HWND 1
    459 #define PP_CONTEXT_INFO 11
    460 #define PP_KEYEXCHANGE_KEYSIZE 12
    461 #define PP_SIGNATURE_KEYSIZE 13
    462 #define PP_KEYEXCHANGE_ALG 14
    463 #define PP_SIGNATURE_ALG 15
    464 #define PP_DELETEKEY 24
    465 #if NTDDI_VERSION >= 0x06000000
    466 #define PP_PIN_PROMPT_STRING 44
    467 #define PP_SECURE_KEYEXCHANGE_PIN 47
    468 #define PP_SECURE_SIGNATURE_PIN 48
    469 #endif
    470 
    471 #define PROV_RSA_FULL 1
    472 #define PROV_RSA_SIG 2
    473 #define PROV_DSS 3
    474 #define PROV_FORTEZZA 4
    475 #define PROV_MS_EXCHANGE 5
    476 #define PROV_SSL 6
    477 #define PROV_STT_MER 7
    478 #define PROV_STT_ACQ 8
    479 #define PROV_STT_BRND 9
    480 #define PROV_STT_ROOT 10
    481 #define PROV_STT_ISS 11
    482 #define PROV_RSA_SCHANNEL 12
    483 #define PROV_DSS_DH 13
    484 #define PROV_EC_ECDSA_SIG 14
    485 #define PROV_EC_ECNRA_SIG 15
    486 #define PROV_EC_ECDSA_FULL 16
    487 #define PROV_EC_ECNRA_FULL 17
    488 #define PROV_DH_SCHANNEL 18
    489 #define PROV_SPYRUS_LYNKS 20
    490 #define PROV_RNG 21
    491 #define PROV_INTEL_SEC 22
    492 #define PROV_REPLACE_OWF 23
    493 #define PROV_RSA_AES 24
    494 
    495 #define MS_DEF_PROV __MINGW_NAME_UAW(MS_DEF_PROV)
    496 #define MS_ENHANCED_PROV __MINGW_NAME_UAW(MS_ENHANCED_PROV)
    497 #define MS_STRONG_PROV __MINGW_NAME_UAW(MS_STRONG_PROV)
    498 #define MS_DEF_RSA_SIG_PROV __MINGW_NAME_UAW(MS_DEF_RSA_SIG_PROV)
    499 #define MS_DEF_RSA_SCHANNEL_PROV __MINGW_NAME_UAW(MS_DEF_RSA_SCHANNEL_PROV)
    500 #define MS_DEF_DSS_PROV __MINGW_NAME_UAW(MS_DEF_DSS_PROV)
    501 #define MS_DEF_DSS_DH_PROV __MINGW_NAME_UAW(MS_DEF_DSS_DH_PROV)
    502 #define MS_ENH_DSS_DH_PROV __MINGW_NAME_UAW(MS_ENH_DSS_DH_PROV)
    503 #define MS_DEF_DH_SCHANNEL_PROV __MINGW_NAME_UAW(MS_DEF_DH_SCHANNEL_PROV)
    504 #define MS_SCARD_PROV __MINGW_NAME_UAW(MS_SCARD_PROV)
    505 #define MS_ENH_RSA_AES_PROV_XP __MINGW_NAME_UAW(MS_ENH_RSA_AES_PROV_XP)
    506 #define MS_ENH_RSA_AES_PROV __MINGW_NAME_UAW(MS_ENH_RSA_AES_PROV)
    507 
    508 #define MS_DEF_PROV_A "Microsoft Base Cryptographic Provider v1.0"
    509 #define MS_DEF_PROV_W L"Microsoft Base Cryptographic Provider v1.0"
    510 #define MS_ENHANCED_PROV_A "Microsoft Enhanced Cryptographic Provider v1.0"
    511 #define MS_ENHANCED_PROV_W L"Microsoft Enhanced Cryptographic Provider v1.0"
    512 #define MS_STRONG_PROV_A "Microsoft Strong Cryptographic Provider"
    513 #define MS_STRONG_PROV_W L"Microsoft Strong Cryptographic Provider"
    514 #define MS_DEF_RSA_SIG_PROV_A "Microsoft RSA Signature Cryptographic Provider"
    515 #define MS_DEF_RSA_SIG_PROV_W L"Microsoft RSA Signature Cryptographic Provider"
    516 #define MS_DEF_RSA_SCHANNEL_PROV_A "Microsoft RSA SChannel Cryptographic Provider"
    517 #define MS_DEF_RSA_SCHANNEL_PROV_W L"Microsoft RSA SChannel Cryptographic Provider"
    518 #define MS_DEF_DSS_PROV_A "Microsoft Base DSS Cryptographic Provider"
    519 #define MS_DEF_DSS_PROV_W L"Microsoft Base DSS Cryptographic Provider"
    520 #define MS_DEF_DSS_DH_PROV_A "Microsoft Base DSS and Diffie-Hellman Cryptographic Provider"
    521 #define MS_DEF_DSS_DH_PROV_W L"Microsoft Base DSS and Diffie-Hellman Cryptographic Provider"
    522 #define MS_ENH_DSS_DH_PROV_A "Microsoft Enhanced DSS and Diffie-Hellman Cryptographic Provider"
    523 #define MS_ENH_DSS_DH_PROV_W L"Microsoft Enhanced DSS and Diffie-Hellman Cryptographic Provider"
    524 #define MS_DEF_DH_SCHANNEL_PROV_A "Microsoft DH SChannel Cryptographic Provider"
    525 #define MS_DEF_DH_SCHANNEL_PROV_W L"Microsoft DH SChannel Cryptographic Provider"
    526 #define MS_SCARD_PROV_A "Microsoft Base Smart Card Crypto Provider"
    527 #define MS_SCARD_PROV_W L"Microsoft Base Smart Card Crypto Provider"
    528 #define MS_ENH_RSA_AES_PROV_A "Microsoft Enhanced RSA and AES Cryptographic Provider"
    529 #define MS_ENH_RSA_AES_PROV_W L"Microsoft Enhanced RSA and AES Cryptographic Provider"
    530 #define MS_ENH_RSA_AES_PROV_XP_A "Microsoft Enhanced RSA and AES Cryptographic Provider (Prototype)"
    531 #define MS_ENH_RSA_AES_PROV_XP_W L"Microsoft Enhanced RSA and AES Cryptographic Provider (Prototype)"
    532 
    533 #define MAXUIDLEN 64
    534 
    535 #define EXPO_OFFLOAD_REG_VALUE "ExpoOffload"
    536 #define EXPO_OFFLOAD_FUNC_NAME "OffloadModExpo"
    537 
    538 #ifndef szKEY_CRYPTOAPI_PRIVATE_KEY_OPTIONS
    539 #define szKEY_CRYPTOAPI_PRIVATE_KEY_OPTIONS "Software\\Policies\\Microsoft\\Cryptography"
    540 #endif
    541 
    542 #define szKEY_CACHE_ENABLED "CachePrivateKeys"
    543 #define szKEY_CACHE_SECONDS "PrivateKeyLifetimeSeconds"
    544 
    545 #define szPRIV_KEY_CACHE_MAX_ITEMS "PrivKeyCacheMaxItems"
    546 #define cPRIV_KEY_CACHE_MAX_ITEMS_DEFAULT 20
    547 
    548 #define szPRIV_KEY_CACHE_PURGE_INTERVAL_SECONDS "PrivKeyCachePurgeIntervalSeconds"
    549 #define cPRIV_KEY_CACHE_PURGE_INTERVAL_SECONDS_DEFAULT 86400
    550 
    551 #define CUR_BLOB_VERSION 2
    552 
    553   typedef struct _CMS_KEY_INFO {
    554     DWORD dwVersion;
    555     ALG_ID Algid;
    556     BYTE *pbOID;
    557     DWORD cbOID;
    558   } CMS_KEY_INFO,*PCMS_KEY_INFO;
    559 
    560   typedef struct _HMAC_Info {
    561     ALG_ID HashAlgid;
    562     BYTE *pbInnerString;
    563     DWORD cbInnerString;
    564     BYTE *pbOuterString;
    565     DWORD cbOuterString;
    566   } HMAC_INFO,*PHMAC_INFO;
    567 
    568   typedef struct _SCHANNEL_ALG {
    569     DWORD dwUse;
    570     ALG_ID Algid;
    571     DWORD cBits;
    572     DWORD dwFlags;
    573     DWORD dwReserved;
    574   } SCHANNEL_ALG,*PSCHANNEL_ALG;
    575 #define SCHANNEL_MAC_KEY 0x0
    576 #define SCHANNEL_ENC_KEY 0x1
    577 
    578 #define INTERNATIONAL_USAGE 0x1
    579 
    580   typedef struct _PROV_ENUMALGS {
    581     ALG_ID aiAlgid;
    582     DWORD dwBitLen;
    583     DWORD dwNameLen;
    584     CHAR szName[20];
    585   } PROV_ENUMALGS;
    586 
    587   typedef struct _PROV_ENUMALGS_EX {
    588     ALG_ID aiAlgid;
    589     DWORD dwDefaultLen;
    590     DWORD dwMinLen;
    591     DWORD dwMaxLen;
    592     DWORD dwProtocols;
    593     DWORD dwNameLen;
    594     CHAR szName[20];
    595     DWORD dwLongNameLen;
    596     CHAR szLongName[40];
    597   } PROV_ENUMALGS_EX;
    598 
    599   typedef struct _PUBLICKEYSTRUC {
    600     BYTE bType;
    601     BYTE bVersion;
    602     WORD reserved;
    603     ALG_ID aiKeyAlg;
    604   } BLOBHEADER,PUBLICKEYSTRUC;
    605 
    606   typedef struct _RSAPUBKEY {
    607     DWORD magic;
    608     DWORD bitlen;
    609     DWORD pubexp;
    610   } RSAPUBKEY;
    611 
    612   typedef struct _PUBKEY {
    613     DWORD magic;
    614     DWORD bitlen;
    615   } DHPUBKEY,DSSPUBKEY,KEAPUBKEY,TEKPUBKEY;
    616 
    617   typedef struct _DSSSEED {
    618     DWORD counter;
    619     BYTE seed[20];
    620   } DSSSEED;
    621 
    622   typedef struct _PUBKEYVER3 {
    623     DWORD magic;
    624     DWORD bitlenP;
    625     DWORD bitlenQ;
    626     DWORD bitlenJ;
    627     DSSSEED DSSSeed;
    628   } DHPUBKEY_VER3, DSSPUBKEY_VER3;
    629 
    630   typedef struct _PRIVKEYVER3 {
    631     DWORD magic;
    632     DWORD bitlenP;
    633     DWORD bitlenQ;
    634     DWORD bitlenJ;
    635     DWORD bitlenX;
    636     DSSSEED DSSSeed;
    637   } DHPRIVKEY_VER3,DSSPRIVKEY_VER3;
    638 
    639   typedef struct _KEY_TYPE_SUBTYPE {
    640     DWORD dwKeySpec;
    641     GUID Type;
    642     GUID Subtype;
    643   } KEY_TYPE_SUBTYPE,*PKEY_TYPE_SUBTYPE;
    644 
    645   typedef struct _CERT_FORTEZZA_DATA_PROP {
    646     unsigned char SerialNumber[8];
    647     int CertIndex;
    648     unsigned char CertLabel[36];
    649   } CERT_FORTEZZA_DATA_PROP;
    650 
    651   typedef struct _CRYPT_RC4_KEY_STATE {
    652     unsigned char Key[16];
    653     unsigned char SBox[256];
    654     unsigned char i;
    655     unsigned char j;
    656   } CRYPT_RC4_KEY_STATE,*PCRYPT_RC4_KEY_STATE;
    657 
    658   typedef struct _CRYPT_DES_KEY_STATE {
    659     unsigned char Key[8];
    660     unsigned char IV[8];
    661     unsigned char Feedback[8];
    662   } CRYPT_DES_KEY_STATE,*PCRYPT_DES_KEY_STATE;
    663 
    664   typedef struct _CRYPT_3DES_KEY_STATE {
    665     unsigned char Key[24];
    666     unsigned char IV[8];
    667     unsigned char Feedback[8];
    668   } CRYPT_3DES_KEY_STATE,*PCRYPT_3DES_KEY_STATE;
    669 
    670 #if NTDDI_VERSION >= 0x06000000
    671   typedef struct _CRYPT_AES_128_KEY_STATE {
    672     unsigned char Key[16];
    673     unsigned char IV[16];
    674     unsigned char EncryptionState[11][16];
    675     unsigned char DecryptionState[11][16];
    676     unsigned char Feedback[16];
    677   } CRYPT_AES_128_KEY_STATE,*PCRYPT_AES_128_KEY_STATE;
    678 
    679   typedef struct _CRYPT_AES_256_KEY_STATE {
    680     unsigned char Key[32];
    681     unsigned char IV[16];
    682     unsigned char EncryptionState[15][16];
    683     unsigned char DecryptionState[15][16];
    684     unsigned char Feedback[16];
    685   } CRYPT_AES_256_KEY_STATE,*PCRYPT_AES_256_KEY_STATE;
    686 #endif
    687 #endif
    688 
    689 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_APP)
    690 
    691 #ifndef CRYPTO_BLOBS_DEFINED
    692 #define CRYPTO_BLOBS_DEFINED
    693   typedef struct _CRYPTOAPI_BLOB {
    694     DWORD cbData;
    695     BYTE *pbData;
    696   } CRYPT_INTEGER_BLOB,*PCRYPT_INTEGER_BLOB,CRYPT_UINT_BLOB,*PCRYPT_UINT_BLOB,CRYPT_OBJID_BLOB,*PCRYPT_OBJID_BLOB,CERT_NAME_BLOB,*PCERT_NAME_BLOB,CERT_RDN_VALUE_BLOB,*PCERT_RDN_VALUE_BLOB,CERT_BLOB,*PCERT_BLOB,CRL_BLOB,*PCRL_BLOB,DATA_BLOB,*PDATA_BLOB,CRYPT_DATA_BLOB,*PCRYPT_DATA_BLOB,CRYPT_HASH_BLOB,*PCRYPT_HASH_BLOB,CRYPT_DIGEST_BLOB,*PCRYPT_DIGEST_BLOB,CRYPT_DER_BLOB,*PCRYPT_DER_BLOB,CRYPT_ATTR_BLOB,*PCRYPT_ATTR_BLOB;
    697 #endif
    698 #endif
    699 
    700 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
    701   typedef struct _CMS_DH_KEY_INFO {
    702     DWORD dwVersion;
    703     ALG_ID Algid;
    704     LPSTR pszContentEncObjId;
    705     CRYPT_DATA_BLOB PubInfo;
    706     void *pReserved;
    707   } CMS_DH_KEY_INFO,*PCMS_DH_KEY_INFO;
    708 
    709 #define CryptAcquireContext __MINGW_NAME_AW(CryptAcquireContext)
    710 #define CryptSignHash __MINGW_NAME_AW(CryptSignHash)
    711 #define CryptVerifySignature __MINGW_NAME_AW(CryptVerifySignature)
    712 #define CryptSetProvider __MINGW_NAME_AW(CryptSetProvider)
    713 #define CryptSetProviderEx __MINGW_NAME_AW(CryptSetProviderEx)
    714 #define CryptGetDefaultProvider __MINGW_NAME_AW(CryptGetDefaultProvider)
    715 #define CryptEnumProviderTypes __MINGW_NAME_AW(CryptEnumProviderTypes)
    716 #define CryptEnumProviders __MINGW_NAME_AW(CryptEnumProviders)
    717 
    718   WINIMPM WINBOOL WINAPI CryptAcquireContextA (HCRYPTPROV *phProv, LPCSTR szContainer, LPCSTR szProvider, DWORD dwProvType, DWORD dwFlags);
    719   WINIMPM WINBOOL WINAPI CryptAcquireContextW (HCRYPTPROV *phProv, LPCWSTR szContainer, LPCWSTR szProvider, DWORD dwProvType, DWORD dwFlags);
    720   WINIMPM WINBOOL WINAPI CryptReleaseContext (HCRYPTPROV hProv, DWORD dwFlags);
    721   WINIMPM WINBOOL WINAPI CryptGenKey (HCRYPTPROV hProv, ALG_ID Algid, DWORD dwFlags, HCRYPTKEY *phKey);
    722   WINIMPM WINBOOL WINAPI CryptDeriveKey (HCRYPTPROV hProv, ALG_ID Algid, HCRYPTHASH hBaseData, DWORD dwFlags, HCRYPTKEY *phKey);
    723   WINIMPM WINBOOL WINAPI CryptDestroyKey (HCRYPTKEY hKey);
    724   WINIMPM WINBOOL WINAPI CryptSetKeyParam (HCRYPTKEY hKey, DWORD dwParam, CONST BYTE *pbData, DWORD dwFlags);
    725   WINIMPM WINBOOL WINAPI CryptGetKeyParam (HCRYPTKEY hKey, DWORD dwParam, BYTE *pbData, DWORD *pdwDataLen, DWORD dwFlags);
    726   WINIMPM WINBOOL WINAPI CryptSetHashParam (HCRYPTHASH hHash, DWORD dwParam, CONST BYTE *pbData, DWORD dwFlags);
    727   WINIMPM WINBOOL WINAPI CryptGetHashParam (HCRYPTHASH hHash, DWORD dwParam, BYTE *pbData, DWORD *pdwDataLen, DWORD dwFlags);
    728   WINIMPM WINBOOL WINAPI CryptSetProvParam (HCRYPTPROV hProv, DWORD dwParam, CONST BYTE *pbData, DWORD dwFlags);
    729   WINIMPM WINBOOL WINAPI CryptGetProvParam (HCRYPTPROV hProv, DWORD dwParam, BYTE *pbData, DWORD *pdwDataLen, DWORD dwFlags);
    730   WINIMPM WINBOOL WINAPI CryptGenRandom (HCRYPTPROV hProv, DWORD dwLen, BYTE *pbBuffer);
    731   WINIMPM WINBOOL WINAPI CryptGetUserKey (HCRYPTPROV hProv, DWORD dwKeySpec, HCRYPTKEY *phUserKey);
    732   WINIMPM WINBOOL WINAPI CryptExportKey (HCRYPTKEY hKey, HCRYPTKEY hExpKey, DWORD dwBlobType, DWORD dwFlags, BYTE *pbData, DWORD *pdwDataLen);
    733   WINIMPM WINBOOL WINAPI CryptImportKey (HCRYPTPROV hProv, CONST BYTE *pbData, DWORD dwDataLen, HCRYPTKEY hPubKey, DWORD dwFlags, HCRYPTKEY *phKey);
    734   WINIMPM WINBOOL WINAPI CryptEncrypt (HCRYPTKEY hKey, HCRYPTHASH hHash, WINBOOL Final, DWORD dwFlags, BYTE *pbData, DWORD *pdwDataLen, DWORD dwBufLen);
    735   WINIMPM WINBOOL WINAPI CryptDecrypt (HCRYPTKEY hKey, HCRYPTHASH hHash, WINBOOL Final, DWORD dwFlags, BYTE *pbData, DWORD *pdwDataLen);
    736   WINIMPM WINBOOL WINAPI CryptCreateHash (HCRYPTPROV hProv, ALG_ID Algid, HCRYPTKEY hKey, DWORD dwFlags, HCRYPTHASH *phHash);
    737   WINIMPM WINBOOL WINAPI CryptHashData (HCRYPTHASH hHash, CONST BYTE *pbData, DWORD dwDataLen, DWORD dwFlags);
    738   WINIMPM WINBOOL WINAPI CryptHashSessionKey (HCRYPTHASH hHash, HCRYPTKEY hKey, DWORD dwFlags);
    739   WINIMPM WINBOOL WINAPI CryptDestroyHash (HCRYPTHASH hHash);
    740   WINIMPM WINBOOL WINAPI CryptSignHashA (HCRYPTHASH hHash, DWORD dwKeySpec, LPCSTR szDescription, DWORD dwFlags, BYTE *pbSignature, DWORD *pdwSigLen);
    741   WINIMPM WINBOOL WINAPI CryptSignHashW (HCRYPTHASH hHash, DWORD dwKeySpec, LPCWSTR szDescription, DWORD dwFlags, BYTE *pbSignature, DWORD *pdwSigLen);
    742   WINIMPM WINBOOL WINAPI CryptVerifySignatureA (HCRYPTHASH hHash, CONST BYTE *pbSignature, DWORD dwSigLen, HCRYPTKEY hPubKey, LPCSTR szDescription, DWORD dwFlags);
    743   WINIMPM WINBOOL WINAPI CryptVerifySignatureW (HCRYPTHASH hHash, CONST BYTE *pbSignature, DWORD dwSigLen, HCRYPTKEY hPubKey, LPCWSTR szDescription, DWORD dwFlags);
    744   WINIMPM WINBOOL WINAPI CryptSetProviderA (LPCSTR pszProvName, DWORD dwProvType);
    745   WINIMPM WINBOOL WINAPI CryptSetProviderW (LPCWSTR pszProvName, DWORD dwProvType);
    746   WINIMPM WINBOOL WINAPI CryptSetProviderExA (LPCSTR pszProvName, DWORD dwProvType, DWORD *pdwReserved, DWORD dwFlags);
    747   WINIMPM WINBOOL WINAPI CryptSetProviderExW (LPCWSTR pszProvName, DWORD dwProvType, DWORD *pdwReserved, DWORD dwFlags);
    748   WINIMPM WINBOOL WINAPI CryptGetDefaultProviderA (DWORD dwProvType, DWORD *pdwReserved, DWORD dwFlags, LPSTR pszProvName, DWORD *pcbProvName);
    749   WINIMPM WINBOOL WINAPI CryptGetDefaultProviderW (DWORD dwProvType, DWORD *pdwReserved, DWORD dwFlags, LPWSTR pszProvName, DWORD *pcbProvName);
    750   WINIMPM WINBOOL WINAPI CryptEnumProviderTypesA (DWORD dwIndex, DWORD *pdwReserved, DWORD dwFlags, DWORD *pdwProvType, LPSTR szTypeName, DWORD *pcbTypeName);
    751   WINIMPM WINBOOL WINAPI CryptEnumProviderTypesW (DWORD dwIndex, DWORD *pdwReserved, DWORD dwFlags, DWORD *pdwProvType, LPWSTR szTypeName, DWORD *pcbTypeName);
    752   WINIMPM WINBOOL WINAPI CryptEnumProvidersA (DWORD dwIndex, DWORD *pdwReserved, DWORD dwFlags, DWORD *pdwProvType, LPSTR szProvName, DWORD *pcbProvName);
    753   WINIMPM WINBOOL WINAPI CryptEnumProvidersW (DWORD dwIndex, DWORD *pdwReserved, DWORD dwFlags, DWORD *pdwProvType, LPWSTR szProvName, DWORD *pcbProvName);
    754   WINIMPM WINBOOL WINAPI CryptContextAddRef (HCRYPTPROV hProv, DWORD *pdwReserved, DWORD dwFlags);
    755   WINIMPM WINBOOL WINAPI CryptDuplicateKey (HCRYPTKEY hKey, DWORD *pdwReserved, DWORD dwFlags, HCRYPTKEY *phKey);
    756   WINIMPM WINBOOL WINAPI CryptDuplicateHash (HCRYPTHASH hHash, DWORD *pdwReserved, DWORD dwFlags, HCRYPTHASH *phHash);
    757   WINBOOL __cdecl GetEncSChannel (BYTE **pData, DWORD *dwDecSize);
    758 #endif
    759 
    760 #ifndef _DDK_DRIVER_
    761 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
    762   typedef ULONG_PTR HCRYPTPROV_OR_NCRYPT_KEY_HANDLE;
    763   typedef ULONG_PTR HCRYPTPROV_LEGACY;
    764 
    765 #include <bcrypt.h>
    766 #endif
    767 
    768 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_APP)
    769 #include <ncrypt.h>
    770 
    771   typedef struct _CRYPT_BIT_BLOB {
    772     DWORD cbData;
    773     BYTE *pbData;
    774     DWORD cUnusedBits;
    775   } CRYPT_BIT_BLOB,*PCRYPT_BIT_BLOB;
    776 
    777   typedef struct _CRYPT_ALGORITHM_IDENTIFIER {
    778     LPSTR pszObjId;
    779     CRYPT_OBJID_BLOB Parameters;
    780   } CRYPT_ALGORITHM_IDENTIFIER,*PCRYPT_ALGORITHM_IDENTIFIER;
    781 #endif
    782 
    783 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
    784 #define szOID_RSA "1.2.840.113549"
    785 #define szOID_PKCS "1.2.840.113549.1"
    786 #define szOID_RSA_HASH "1.2.840.113549.2"
    787 #define szOID_RSA_ENCRYPT "1.2.840.113549.3"
    788 
    789 #define szOID_PKCS_1 "1.2.840.113549.1.1"
    790 #define szOID_PKCS_2 "1.2.840.113549.1.2"
    791 #define szOID_PKCS_3 "1.2.840.113549.1.3"
    792 #define szOID_PKCS_4 "1.2.840.113549.1.4"
    793 #define szOID_PKCS_5 "1.2.840.113549.1.5"
    794 #define szOID_PKCS_6 "1.2.840.113549.1.6"
    795 #define szOID_PKCS_7 "1.2.840.113549.1.7"
    796 #define szOID_PKCS_8 "1.2.840.113549.1.8"
    797 #define szOID_PKCS_9 "1.2.840.113549.1.9"
    798 #define szOID_PKCS_10 "1.2.840.113549.1.10"
    799 #define szOID_PKCS_12 "1.2.840.113549.1.12"
    800 
    801 #define szOID_RSA_RSA "1.2.840.113549.1.1.1"
    802 #define szOID_RSA_MD2RSA "1.2.840.113549.1.1.2"
    803 #define szOID_RSA_MD4RSA "1.2.840.113549.1.1.3"
    804 #define szOID_RSA_MD5RSA "1.2.840.113549.1.1.4"
    805 #define szOID_RSA_SHA1RSA "1.2.840.113549.1.1.5"
    806 #define szOID_RSA_SETOAEP_RSA "1.2.840.113549.1.1.6"
    807 
    808 #define szOID_RSAES_OAEP "1.2.840.113549.1.1.7"
    809 #define szOID_RSA_MGF1 "1.2.840.113549.1.1.8"
    810 #define szOID_RSA_PSPECIFIED "1.2.840.113549.1.1.9"
    811 #define szOID_RSA_SSA_PSS "1.2.840.113549.1.1.10"
    812 #define szOID_RSA_SHA256RSA "1.2.840.113549.1.1.11"
    813 #define szOID_RSA_SHA384RSA "1.2.840.113549.1.1.12"
    814 #define szOID_RSA_SHA512RSA "1.2.840.113549.1.1.13"
    815 
    816 #define szOID_RSA_DH "1.2.840.113549.1.3.1"
    817 
    818 #define szOID_RSA_data "1.2.840.113549.1.7.1"
    819 #define szOID_RSA_signedData "1.2.840.113549.1.7.2"
    820 #define szOID_RSA_envelopedData "1.2.840.113549.1.7.3"
    821 #define szOID_RSA_signEnvData "1.2.840.113549.1.7.4"
    822 #define szOID_RSA_digestedData "1.2.840.113549.1.7.5"
    823 #define szOID_RSA_hashedData "1.2.840.113549.1.7.5"
    824 #define szOID_RSA_encryptedData "1.2.840.113549.1.7.6"
    825 
    826 #define szOID_RSA_emailAddr "1.2.840.113549.1.9.1"
    827 #define szOID_RSA_unstructName "1.2.840.113549.1.9.2"
    828 #define szOID_RSA_contentType "1.2.840.113549.1.9.3"
    829 #define szOID_RSA_messageDigest "1.2.840.113549.1.9.4"
    830 #define szOID_RSA_signingTime "1.2.840.113549.1.9.5"
    831 #define szOID_RSA_counterSign "1.2.840.113549.1.9.6"
    832 #define szOID_RSA_challengePwd "1.2.840.113549.1.9.7"
    833 #define szOID_RSA_unstructAddr "1.2.840.113549.1.9.8"
    834 #define szOID_RSA_extCertAttrs "1.2.840.113549.1.9.9"
    835 #define szOID_RSA_certExtensions "1.2.840.113549.1.9.14"
    836 #define szOID_RSA_SMIMECapabilities "1.2.840.113549.1.9.15"
    837 #define szOID_RSA_preferSignedData "1.2.840.113549.1.9.15.1"
    838 
    839 #define szOID_TIMESTAMP_TOKEN "1.2.840.113549.1.9.16.1.4"
    840 #define szOID_RFC3161_counterSign "1.3.6.1.4.1.311.3.3.1"
    841 
    842 #define szOID_RSA_SMIMEalg "1.2.840.113549.1.9.16.3"
    843 #define szOID_RSA_SMIMEalgESDH "1.2.840.113549.1.9.16.3.5"
    844 #define szOID_RSA_SMIMEalgCMS3DESwrap "1.2.840.113549.1.9.16.3.6"
    845 #define szOID_RSA_SMIMEalgCMSRC2wrap "1.2.840.113549.1.9.16.3.7"
    846 
    847 #define szOID_RSA_MD2 "1.2.840.113549.2.2"
    848 #define szOID_RSA_MD4 "1.2.840.113549.2.4"
    849 #define szOID_RSA_MD5 "1.2.840.113549.2.5"
    850 
    851 #define szOID_RSA_RC2CBC "1.2.840.113549.3.2"
    852 #define szOID_RSA_RC4 "1.2.840.113549.3.4"
    853 #define szOID_RSA_DES_EDE3_CBC "1.2.840.113549.3.7"
    854 #define szOID_RSA_RC5_CBCPad "1.2.840.113549.3.9"
    855 
    856 #define szOID_ANSI_X942 "1.2.840.10046"
    857 #define szOID_ANSI_X942_DH "1.2.840.10046.2.1"
    858 
    859 #define szOID_X957 "1.2.840.10040"
    860 #define szOID_X957_DSA "1.2.840.10040.4.1"
    861 #define szOID_X957_SHA1DSA "1.2.840.10040.4.3"
    862 
    863 #define szOID_ECC_PUBLIC_KEY "1.2.840.10045.2.1"
    864 #define szOID_ECC_CURVE_P256 "1.2.840.10045.3.1.7"
    865 #define szOID_ECC_CURVE_P384 "1.3.132.0.34"
    866 #define szOID_ECC_CURVE_P521 "1.3.132.0.35"
    867 #define szOID_ECDSA_SHA1 "1.2.840.10045.4.1"
    868 #define szOID_ECDSA_SPECIFIED "1.2.840.10045.4.3"
    869 #define szOID_ECDSA_SHA256 "1.2.840.10045.4.3.2"
    870 #define szOID_ECDSA_SHA384 "1.2.840.10045.4.3.3"
    871 #define szOID_ECDSA_SHA512 "1.2.840.10045.4.3.4"
    872 
    873 #define szOID_NIST_AES128_CBC "2.16.840.1.101.3.4.1.2"
    874 #define szOID_NIST_AES192_CBC "2.16.840.1.101.3.4.1.22"
    875 #define szOID_NIST_AES256_CBC "2.16.840.1.101.3.4.1.42"
    876 
    877 #define szOID_NIST_AES128_WRAP "2.16.840.1.101.3.4.1.5"
    878 #define szOID_NIST_AES192_WRAP "2.16.840.1.101.3.4.1.25"
    879 #define szOID_NIST_AES256_WRAP "2.16.840.1.101.3.4.1.45"
    880 
    881 #define szOID_DH_SINGLE_PASS_STDDH_SHA1_KDF "1.3.133.16.840.63.0.2"
    882 #define szOID_DH_SINGLE_PASS_STDDH_SHA256_KDF "1.3.132.1.11.1"
    883 #define szOID_DH_SINGLE_PASS_STDDH_SHA384_KDF "1.3.132.1.11.2"
    884 
    885 #define szOID_DS "2.5"
    886 #define szOID_DSALG "2.5.8"
    887 #define szOID_DSALG_CRPT "2.5.8.1"
    888 #define szOID_DSALG_HASH "2.5.8.2"
    889 #define szOID_DSALG_SIGN "2.5.8.3"
    890 #define szOID_DSALG_RSA "2.5.8.1.1"
    891 
    892 #define szOID_OIW "1.3.14"
    893 
    894 #define szOID_OIWSEC "1.3.14.3.2"
    895 #define szOID_OIWSEC_md4RSA "1.3.14.3.2.2"
    896 #define szOID_OIWSEC_md5RSA "1.3.14.3.2.3"
    897 #define szOID_OIWSEC_md4RSA2 "1.3.14.3.2.4"
    898 #define szOID_OIWSEC_desECB "1.3.14.3.2.6"
    899 #define szOID_OIWSEC_desCBC "1.3.14.3.2.7"
    900 #define szOID_OIWSEC_desOFB "1.3.14.3.2.8"
    901 #define szOID_OIWSEC_desCFB "1.3.14.3.2.9"
    902 #define szOID_OIWSEC_desMAC "1.3.14.3.2.10"
    903 #define szOID_OIWSEC_rsaSign "1.3.14.3.2.11"
    904 #define szOID_OIWSEC_dsa "1.3.14.3.2.12"
    905 #define szOID_OIWSEC_shaDSA "1.3.14.3.2.13"
    906 #define szOID_OIWSEC_mdc2RSA "1.3.14.3.2.14"
    907 #define szOID_OIWSEC_shaRSA "1.3.14.3.2.15"
    908 #define szOID_OIWSEC_dhCommMod "1.3.14.3.2.16"
    909 #define szOID_OIWSEC_desEDE "1.3.14.3.2.17"
    910 #define szOID_OIWSEC_sha "1.3.14.3.2.18"
    911 #define szOID_OIWSEC_mdc2 "1.3.14.3.2.19"
    912 #define szOID_OIWSEC_dsaComm "1.3.14.3.2.20"
    913 #define szOID_OIWSEC_dsaCommSHA "1.3.14.3.2.21"
    914 #define szOID_OIWSEC_rsaXchg "1.3.14.3.2.22"
    915 #define szOID_OIWSEC_keyHashSeal "1.3.14.3.2.23"
    916 #define szOID_OIWSEC_md2RSASign "1.3.14.3.2.24"
    917 #define szOID_OIWSEC_md5RSASign "1.3.14.3.2.25"
    918 #define szOID_OIWSEC_sha1 "1.3.14.3.2.26"
    919 #define szOID_OIWSEC_dsaSHA1 "1.3.14.3.2.27"
    920 #define szOID_OIWSEC_dsaCommSHA1 "1.3.14.3.2.28"
    921 #define szOID_OIWSEC_sha1RSASign "1.3.14.3.2.29"
    922 
    923 #define szOID_OIWDIR "1.3.14.7.2"
    924 #define szOID_OIWDIR_CRPT "1.3.14.7.2.1"
    925 #define szOID_OIWDIR_HASH "1.3.14.7.2.2"
    926 #define szOID_OIWDIR_SIGN "1.3.14.7.2.3"
    927 #define szOID_OIWDIR_md2 "1.3.14.7.2.2.1"
    928 #define szOID_OIWDIR_md2RSA "1.3.14.7.2.3.1"
    929 
    930 #define szOID_INFOSEC "2.16.840.1.101.2.1"
    931 #define szOID_INFOSEC_sdnsSignature "2.16.840.1.101.2.1.1.1"
    932 #define szOID_INFOSEC_mosaicSignature "2.16.840.1.101.2.1.1.2"
    933 #define szOID_INFOSEC_sdnsConfidentiality "2.16.840.1.101.2.1.1.3"
    934 #define szOID_INFOSEC_mosaicConfidentiality "2.16.840.1.101.2.1.1.4"
    935 #define szOID_INFOSEC_sdnsIntegrity "2.16.840.1.101.2.1.1.5"
    936 #define szOID_INFOSEC_mosaicIntegrity "2.16.840.1.101.2.1.1.6"
    937 #define szOID_INFOSEC_sdnsTokenProtection "2.16.840.1.101.2.1.1.7"
    938 #define szOID_INFOSEC_mosaicTokenProtection "2.16.840.1.101.2.1.1.8"
    939 #define szOID_INFOSEC_sdnsKeyManagement "2.16.840.1.101.2.1.1.9"
    940 #define szOID_INFOSEC_mosaicKeyManagement "2.16.840.1.101.2.1.1.10"
    941 #define szOID_INFOSEC_sdnsKMandSig "2.16.840.1.101.2.1.1.11"
    942 #define szOID_INFOSEC_mosaicKMandSig "2.16.840.1.101.2.1.1.12"
    943 #define szOID_INFOSEC_SuiteASignature "2.16.840.1.101.2.1.1.13"
    944 #define szOID_INFOSEC_SuiteAConfidentiality "2.16.840.1.101.2.1.1.14"
    945 #define szOID_INFOSEC_SuiteAIntegrity "2.16.840.1.101.2.1.1.15"
    946 #define szOID_INFOSEC_SuiteATokenProtection "2.16.840.1.101.2.1.1.16"
    947 #define szOID_INFOSEC_SuiteAKeyManagement "2.16.840.1.101.2.1.1.17"
    948 #define szOID_INFOSEC_SuiteAKMandSig "2.16.840.1.101.2.1.1.18"
    949 #define szOID_INFOSEC_mosaicUpdatedSig "2.16.840.1.101.2.1.1.19"
    950 #define szOID_INFOSEC_mosaicKMandUpdSig "2.16.840.1.101.2.1.1.20"
    951 #define szOID_INFOSEC_mosaicUpdatedInteg "2.16.840.1.101.2.1.1.21"
    952 
    953 #define szOID_NIST_sha256 "2.16.840.1.101.3.4.2.1"
    954 #define szOID_NIST_sha384 "2.16.840.1.101.3.4.2.2"
    955 #define szOID_NIST_sha512 "2.16.840.1.101.3.4.2.3"
    956 
    957   typedef struct _CRYPT_OBJID_TABLE {
    958     DWORD dwAlgId;
    959     LPCSTR pszObjId;
    960   } CRYPT_OBJID_TABLE,*PCRYPT_OBJID_TABLE;
    961 
    962   typedef struct _CRYPT_HASH_INFO {
    963     CRYPT_ALGORITHM_IDENTIFIER HashAlgorithm;
    964     CRYPT_HASH_BLOB Hash;
    965   } CRYPT_HASH_INFO,*PCRYPT_HASH_INFO;
    966 #endif
    967 
    968 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_APP)
    969   typedef struct _CERT_EXTENSION {
    970     LPSTR pszObjId;
    971     WINBOOL fCritical;
    972     CRYPT_OBJID_BLOB Value;
    973   } CERT_EXTENSION,*PCERT_EXTENSION;
    974 
    975   typedef const CERT_EXTENSION *PCCERT_EXTENSION;
    976 #endif
    977 
    978 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
    979   typedef struct _CRYPT_ATTRIBUTE_TYPE_VALUE {
    980     LPSTR pszObjId;
    981     CRYPT_OBJID_BLOB Value;
    982   } CRYPT_ATTRIBUTE_TYPE_VALUE,*PCRYPT_ATTRIBUTE_TYPE_VALUE;
    983 
    984   typedef struct _CRYPT_ATTRIBUTE {
    985     LPSTR pszObjId;
    986     DWORD cValue;
    987     PCRYPT_ATTR_BLOB rgValue;
    988   } CRYPT_ATTRIBUTE,*PCRYPT_ATTRIBUTE;
    989 
    990   typedef struct _CRYPT_ATTRIBUTES {
    991     DWORD cAttr;
    992     PCRYPT_ATTRIBUTE rgAttr;
    993   } CRYPT_ATTRIBUTES,*PCRYPT_ATTRIBUTES;
    994 
    995   typedef struct _CERT_RDN_ATTR {
    996     LPSTR pszObjId;
    997     DWORD dwValueType;
    998     CERT_RDN_VALUE_BLOB Value;
    999   } CERT_RDN_ATTR,*PCERT_RDN_ATTR;
   1000 
   1001 #define szOID_COMMON_NAME "2.5.4.3"
   1002 #define szOID_SUR_NAME "2.5.4.4"
   1003 #define szOID_DEVICE_SERIAL_NUMBER "2.5.4.5"
   1004 #define szOID_COUNTRY_NAME "2.5.4.6"
   1005 #define szOID_LOCALITY_NAME "2.5.4.7"
   1006 #define szOID_STATE_OR_PROVINCE_NAME "2.5.4.8"
   1007 #define szOID_STREET_ADDRESS "2.5.4.9"
   1008 #define szOID_ORGANIZATION_NAME "2.5.4.10"
   1009 #define szOID_ORGANIZATIONAL_UNIT_NAME "2.5.4.11"
   1010 #define szOID_TITLE "2.5.4.12"
   1011 #define szOID_DESCRIPTION "2.5.4.13"
   1012 #define szOID_SEARCH_GUIDE "2.5.4.14"
   1013 #define szOID_BUSINESS_CATEGORY "2.5.4.15"
   1014 #define szOID_POSTAL_ADDRESS "2.5.4.16"
   1015 #define szOID_POSTAL_CODE "2.5.4.17"
   1016 #define szOID_POST_OFFICE_BOX "2.5.4.18"
   1017 #define szOID_PHYSICAL_DELIVERY_OFFICE_NAME "2.5.4.19"
   1018 #define szOID_TELEPHONE_NUMBER "2.5.4.20"
   1019 #define szOID_TELEX_NUMBER "2.5.4.21"
   1020 #define szOID_TELETEXT_TERMINAL_IDENTIFIER "2.5.4.22"
   1021 #define szOID_FACSIMILE_TELEPHONE_NUMBER "2.5.4.23"
   1022 #define szOID_X21_ADDRESS "2.5.4.24"
   1023 #define szOID_INTERNATIONAL_ISDN_NUMBER "2.5.4.25"
   1024 #define szOID_REGISTERED_ADDRESS "2.5.4.26"
   1025 #define szOID_DESTINATION_INDICATOR "2.5.4.27"
   1026 #define szOID_PREFERRED_DELIVERY_METHOD "2.5.4.28"
   1027 #define szOID_PRESENTATION_ADDRESS "2.5.4.29"
   1028 #define szOID_SUPPORTED_APPLICATION_CONTEXT "2.5.4.30"
   1029 #define szOID_MEMBER "2.5.4.31"
   1030 #define szOID_OWNER "2.5.4.32"
   1031 #define szOID_ROLE_OCCUPANT "2.5.4.33"
   1032 #define szOID_SEE_ALSO "2.5.4.34"
   1033 #define szOID_USER_PASSWORD "2.5.4.35"
   1034 #define szOID_USER_CERTIFICATE "2.5.4.36"
   1035 #define szOID_CA_CERTIFICATE "2.5.4.37"
   1036 #define szOID_AUTHORITY_REVOCATION_LIST "2.5.4.38"
   1037 #define szOID_CERTIFICATE_REVOCATION_LIST "2.5.4.39"
   1038 #define szOID_CROSS_CERTIFICATE_PAIR "2.5.4.40"
   1039 #define szOID_GIVEN_NAME "2.5.4.42"
   1040 #define szOID_INITIALS "2.5.4.43"
   1041 #define szOID_DN_QUALIFIER "2.5.4.46"
   1042 
   1043 #define szOID_DOMAIN_COMPONENT "0.9.2342.19200300.100.1.25"
   1044 
   1045 #define szOID_PKCS_12_FRIENDLY_NAME_ATTR "1.2.840.113549.1.9.20"
   1046 #define szOID_PKCS_12_LOCAL_KEY_ID "1.2.840.113549.1.9.21"
   1047 #define szOID_PKCS_12_KEY_PROVIDER_NAME_ATTR "1.3.6.1.4.1.311.17.1"
   1048 #define szOID_LOCAL_MACHINE_KEYSET "1.3.6.1.4.1.311.17.2"
   1049 #define szOID_PKCS_12_EXTENDED_ATTRIBUTES "1.3.6.1.4.1.311.17.3"
   1050 #define szOID_PKCS_12_PROTECTED_PASSWORD_SECRET_BAG_TYPE_ID "1.3.6.1.4.1.311.17.4"
   1051 
   1052 #define szOID_KEYID_RDN "1.3.6.1.4.1.311.10.7.1"
   1053 
   1054 #define szOID_EV_RDN_LOCALE "1.3.6.1.4.1.311.60.2.1.1"
   1055 #define szOID_EV_RDN_STATE_OR_PROVINCE "1.3.6.1.4.1.311.60.2.1.2"
   1056 #define szOID_EV_RDN_COUNTRY "1.3.6.1.4.1.311.60.2.1.3"
   1057 
   1058 #define CERT_RDN_ANY_TYPE 0
   1059 #define CERT_RDN_ENCODED_BLOB 1
   1060 #define CERT_RDN_OCTET_STRING 2
   1061 #define CERT_RDN_NUMERIC_STRING 3
   1062 #define CERT_RDN_PRINTABLE_STRING 4
   1063 #define CERT_RDN_TELETEX_STRING 5
   1064 #define CERT_RDN_T61_STRING 5
   1065 #define CERT_RDN_VIDEOTEX_STRING 6
   1066 #define CERT_RDN_IA5_STRING 7
   1067 #define CERT_RDN_GRAPHIC_STRING 8
   1068 #define CERT_RDN_VISIBLE_STRING 9
   1069 #define CERT_RDN_ISO646_STRING 9
   1070 #define CERT_RDN_GENERAL_STRING 10
   1071 #define CERT_RDN_UNIVERSAL_STRING 11
   1072 #define CERT_RDN_INT4_STRING 11
   1073 #define CERT_RDN_BMP_STRING 12
   1074 #define CERT_RDN_UNICODE_STRING 12
   1075 #define CERT_RDN_UTF8_STRING 13
   1076 
   1077 #define CERT_RDN_TYPE_MASK 0x000000ff
   1078 #define CERT_RDN_FLAGS_MASK 0xff000000
   1079 
   1080 #define CERT_RDN_ENABLE_T61_UNICODE_FLAG 0x80000000
   1081 #define CERT_RDN_ENABLE_UTF8_UNICODE_FLAG 0x20000000
   1082 #define CERT_RDN_FORCE_UTF8_UNICODE_FLAG 0x10000000
   1083 #define CERT_RDN_DISABLE_CHECK_TYPE_FLAG 0x40000000
   1084 #define CERT_RDN_DISABLE_IE4_UTF8_FLAG 0x1000000
   1085 #define CERT_RDN_ENABLE_PUNYCODE_FLAG 0x2000000
   1086 
   1087 #define IS_CERT_RDN_CHAR_STRING(X) (((X) & CERT_RDN_TYPE_MASK) >= CERT_RDN_NUMERIC_STRING)
   1088 
   1089   typedef struct _CERT_RDN {
   1090     DWORD cRDNAttr;
   1091     PCERT_RDN_ATTR rgRDNAttr;
   1092   } CERT_RDN,*PCERT_RDN;
   1093 
   1094   typedef struct _CERT_NAME_INFO {
   1095     DWORD cRDN;
   1096     PCERT_RDN rgRDN;
   1097   } CERT_NAME_INFO,*PCERT_NAME_INFO;
   1098 
   1099   typedef struct _CERT_NAME_VALUE {
   1100     DWORD dwValueType;
   1101     CERT_RDN_VALUE_BLOB Value;
   1102   } CERT_NAME_VALUE,*PCERT_NAME_VALUE;
   1103 #endif
   1104 
   1105 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_APP)
   1106   typedef struct _CERT_PUBLIC_KEY_INFO {
   1107     CRYPT_ALGORITHM_IDENTIFIER Algorithm;
   1108     CRYPT_BIT_BLOB PublicKey;
   1109   } CERT_PUBLIC_KEY_INFO,*PCERT_PUBLIC_KEY_INFO;
   1110 #endif
   1111 
   1112 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
   1113 #define CERT_RSA_PUBLIC_KEY_OBJID szOID_RSA_RSA
   1114 #define CERT_DEFAULT_OID_PUBLIC_KEY_SIGN szOID_RSA_RSA
   1115 #define CERT_DEFAULT_OID_PUBLIC_KEY_XCHG szOID_RSA_RSA
   1116 
   1117   typedef struct _CRYPT_ECC_PRIVATE_KEY_INFO {
   1118     DWORD dwVersion;
   1119     CRYPT_DER_BLOB PrivateKey;
   1120     LPSTR szCurveOid;
   1121     CRYPT_BIT_BLOB PublicKey;
   1122   } CRYPT_ECC_PRIVATE_KEY_INFO,*PCRYPT_ECC_PRIVATE_KEY_INFO;
   1123 
   1124 #define CRYPT_ECC_PRIVATE_KEY_INFO_v1 1
   1125 
   1126   typedef struct _CRYPT_PRIVATE_KEY_INFO {
   1127     DWORD Version;
   1128     CRYPT_ALGORITHM_IDENTIFIER Algorithm;
   1129     CRYPT_DER_BLOB PrivateKey;
   1130     PCRYPT_ATTRIBUTES pAttributes;
   1131   } CRYPT_PRIVATE_KEY_INFO,*PCRYPT_PRIVATE_KEY_INFO;
   1132 
   1133   typedef struct _CRYPT_ENCRYPTED_PRIVATE_KEY_INFO {
   1134     CRYPT_ALGORITHM_IDENTIFIER EncryptionAlgorithm;
   1135     CRYPT_DATA_BLOB EncryptedPrivateKey;
   1136   } CRYPT_ENCRYPTED_PRIVATE_KEY_INFO,*PCRYPT_ENCRYPTED_PRIVATE_KEY_INFO;
   1137 
   1138   typedef WINBOOL (CALLBACK *PCRYPT_DECRYPT_PRIVATE_KEY_FUNC) (CRYPT_ALGORITHM_IDENTIFIER Algorithm, CRYPT_DATA_BLOB EncryptedPrivateKey, BYTE *pbClearTextKey, DWORD *pcbClearTextKey, LPVOID pVoidDecryptFunc);
   1139   typedef WINBOOL (CALLBACK *PCRYPT_ENCRYPT_PRIVATE_KEY_FUNC) (CRYPT_ALGORITHM_IDENTIFIER *pAlgorithm, CRYPT_DATA_BLOB *pClearTextPrivateKey, BYTE *pbEncryptedKey, DWORD *pcbEncryptedKey, LPVOID pVoidEncryptFunc);
   1140   typedef WINBOOL (CALLBACK *PCRYPT_RESOLVE_HCRYPTPROV_FUNC) (CRYPT_PRIVATE_KEY_INFO *pPrivateKeyInfo, HCRYPTPROV *phCryptProv, LPVOID pVoidResolveFunc);
   1141 
   1142   typedef struct _CRYPT_PKCS8_IMPORT_PARAMS {
   1143     CRYPT_DIGEST_BLOB PrivateKey;
   1144     PCRYPT_RESOLVE_HCRYPTPROV_FUNC pResolvehCryptProvFunc;
   1145     LPVOID pVoidResolveFunc;
   1146     PCRYPT_DECRYPT_PRIVATE_KEY_FUNC pDecryptPrivateKeyFunc;
   1147     LPVOID pVoidDecryptFunc;
   1148   } CRYPT_PKCS8_IMPORT_PARAMS,*PCRYPT_PKCS8_IMPORT_PARAMS, CRYPT_PRIVATE_KEY_BLOB_AND_PARAMS,*PCRYPT_PRIVATE_KEY_BLOB_AND_PARAMS;
   1149 
   1150   typedef struct _CRYPT_PKCS8_EXPORT_PARAMS {
   1151     HCRYPTPROV hCryptProv;
   1152     DWORD dwKeySpec;
   1153     LPSTR pszPrivateKeyObjId;
   1154     PCRYPT_ENCRYPT_PRIVATE_KEY_FUNC pEncryptPrivateKeyFunc;
   1155     LPVOID pVoidEncryptFunc;
   1156   } CRYPT_PKCS8_EXPORT_PARAMS,*PCRYPT_PKCS8_EXPORT_PARAMS;
   1157 #endif
   1158 
   1159 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_APP)
   1160   typedef struct _CERT_INFO {
   1161     DWORD dwVersion;
   1162     CRYPT_INTEGER_BLOB SerialNumber;
   1163     CRYPT_ALGORITHM_IDENTIFIER SignatureAlgorithm;
   1164     CERT_NAME_BLOB Issuer;
   1165     FILETIME NotBefore;
   1166     FILETIME NotAfter;
   1167     CERT_NAME_BLOB Subject;
   1168     CERT_PUBLIC_KEY_INFO SubjectPublicKeyInfo;
   1169     CRYPT_BIT_BLOB IssuerUniqueId;
   1170     CRYPT_BIT_BLOB SubjectUniqueId;
   1171     DWORD cExtension;
   1172     PCERT_EXTENSION rgExtension;
   1173   } CERT_INFO,*PCERT_INFO;
   1174 #endif
   1175 
   1176 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
   1177 #define CERT_V1 0
   1178 #define CERT_V2 1
   1179 #define CERT_V3 2
   1180 
   1181 #define CERT_INFO_VERSION_FLAG 1
   1182 #define CERT_INFO_SERIAL_NUMBER_FLAG 2
   1183 #define CERT_INFO_SIGNATURE_ALGORITHM_FLAG 3
   1184 #define CERT_INFO_ISSUER_FLAG 4
   1185 #define CERT_INFO_NOT_BEFORE_FLAG 5
   1186 #define CERT_INFO_NOT_AFTER_FLAG 6
   1187 #define CERT_INFO_SUBJECT_FLAG 7
   1188 #define CERT_INFO_SUBJECT_PUBLIC_KEY_INFO_FLAG 8
   1189 #define CERT_INFO_ISSUER_UNIQUE_ID_FLAG 9
   1190 #define CERT_INFO_SUBJECT_UNIQUE_ID_FLAG 10
   1191 #define CERT_INFO_EXTENSION_FLAG 11
   1192 
   1193   typedef struct _CRL_ENTRY {
   1194     CRYPT_INTEGER_BLOB SerialNumber;
   1195     FILETIME RevocationDate;
   1196     DWORD cExtension;
   1197     PCERT_EXTENSION rgExtension;
   1198   } CRL_ENTRY,*PCRL_ENTRY;
   1199 
   1200   typedef struct _CRL_INFO {
   1201     DWORD dwVersion;
   1202     CRYPT_ALGORITHM_IDENTIFIER SignatureAlgorithm;
   1203     CERT_NAME_BLOB Issuer;
   1204     FILETIME ThisUpdate;
   1205     FILETIME NextUpdate;
   1206     DWORD cCRLEntry;
   1207     PCRL_ENTRY rgCRLEntry;
   1208     DWORD cExtension;
   1209     PCERT_EXTENSION rgExtension;
   1210   } CRL_INFO,*PCRL_INFO;
   1211 
   1212 #define CRL_V1 0
   1213 #define CRL_V2 1
   1214 
   1215 #define CERT_BUNDLE_CERTIFICATE 0
   1216 #define CERT_BUNDLE_CRL 1
   1217 
   1218   typedef struct _CERT_OR_CRL_BLOB {
   1219     DWORD dwChoice;
   1220     DWORD cbEncoded;
   1221     BYTE *pbEncoded;
   1222   } CERT_OR_CRL_BLOB,*PCERT_OR_CRL_BLOB;
   1223 
   1224   typedef struct _CERT_OR_CRL_BUNDLE {
   1225     DWORD cItem;
   1226     PCERT_OR_CRL_BLOB rgItem;
   1227   } CERT_OR_CRL_BUNDLE,*PCERT_OR_CRL_BUNDLE;
   1228 
   1229   typedef struct _CERT_REQUEST_INFO {
   1230     DWORD dwVersion;
   1231     CERT_NAME_BLOB Subject;
   1232     CERT_PUBLIC_KEY_INFO SubjectPublicKeyInfo;
   1233     DWORD cAttribute;
   1234     PCRYPT_ATTRIBUTE rgAttribute;
   1235   } CERT_REQUEST_INFO,*PCERT_REQUEST_INFO;
   1236 
   1237 #define CERT_REQUEST_V1 0
   1238 
   1239   typedef struct _CERT_KEYGEN_REQUEST_INFO {
   1240     DWORD dwVersion;
   1241     CERT_PUBLIC_KEY_INFO SubjectPublicKeyInfo;
   1242     LPWSTR pwszChallengeString;
   1243   } CERT_KEYGEN_REQUEST_INFO,*PCERT_KEYGEN_REQUEST_INFO;
   1244 
   1245 #define CERT_KEYGEN_REQUEST_V1 0
   1246 
   1247   typedef struct _CERT_SIGNED_CONTENT_INFO {
   1248     CRYPT_DER_BLOB ToBeSigned;
   1249     CRYPT_ALGORITHM_IDENTIFIER SignatureAlgorithm;
   1250     CRYPT_BIT_BLOB Signature;
   1251   } CERT_SIGNED_CONTENT_INFO,*PCERT_SIGNED_CONTENT_INFO;
   1252 
   1253   typedef struct _CTL_USAGE {
   1254     DWORD cUsageIdentifier;
   1255     LPSTR *rgpszUsageIdentifier;
   1256   } CTL_USAGE,*PCTL_USAGE,CERT_ENHKEY_USAGE,*PCERT_ENHKEY_USAGE;
   1257 
   1258   typedef const CTL_USAGE *PCCTL_USAGE;
   1259   typedef const CERT_ENHKEY_USAGE *PCCERT_ENHKEY_USAGE;
   1260 
   1261   typedef struct _CTL_ENTRY {
   1262     CRYPT_DATA_BLOB SubjectIdentifier;
   1263     DWORD cAttribute;
   1264     PCRYPT_ATTRIBUTE rgAttribute;
   1265   } CTL_ENTRY,*PCTL_ENTRY;
   1266 
   1267   typedef struct _CTL_INFO {
   1268     DWORD dwVersion;
   1269     CTL_USAGE SubjectUsage;
   1270     CRYPT_DATA_BLOB ListIdentifier;
   1271     CRYPT_INTEGER_BLOB SequenceNumber;
   1272     FILETIME ThisUpdate;
   1273     FILETIME NextUpdate;
   1274     CRYPT_ALGORITHM_IDENTIFIER SubjectAlgorithm;
   1275     DWORD cCTLEntry;
   1276     PCTL_ENTRY rgCTLEntry;
   1277     DWORD cExtension;
   1278     PCERT_EXTENSION rgExtension;
   1279   } CTL_INFO,*PCTL_INFO;
   1280 
   1281 #define CTL_V1 0
   1282 
   1283   typedef struct _CRYPT_TIME_STAMP_REQUEST_INFO {
   1284     LPSTR pszTimeStampAlgorithm;
   1285     LPSTR pszContentType;
   1286     CRYPT_OBJID_BLOB Content;
   1287     DWORD cAttribute;
   1288     PCRYPT_ATTRIBUTE rgAttribute;
   1289   } CRYPT_TIME_STAMP_REQUEST_INFO,*PCRYPT_TIME_STAMP_REQUEST_INFO;
   1290 
   1291   typedef struct _CRYPT_ENROLLMENT_NAME_VALUE_PAIR {
   1292     LPWSTR pwszName;
   1293     LPWSTR pwszValue;
   1294   } CRYPT_ENROLLMENT_NAME_VALUE_PAIR,*PCRYPT_ENROLLMENT_NAME_VALUE_PAIR;
   1295 
   1296   typedef struct _CRYPT_CSP_PROVIDER {
   1297     DWORD dwKeySpec;
   1298     LPWSTR pwszProviderName;
   1299     CRYPT_BIT_BLOB Signature;
   1300   } CRYPT_CSP_PROVIDER,*PCRYPT_CSP_PROVIDER;
   1301 
   1302 #define CERT_ENCODING_TYPE_MASK 0x0000ffff
   1303 #define CMSG_ENCODING_TYPE_MASK 0xffff0000
   1304 #define GET_CERT_ENCODING_TYPE(T) (T & CERT_ENCODING_TYPE_MASK)
   1305 #define GET_CMSG_ENCODING_TYPE(T) (T & CMSG_ENCODING_TYPE_MASK)
   1306 
   1307 #define CRYPT_ASN_ENCODING 0x1
   1308 #define CRYPT_NDR_ENCODING 0x2
   1309 #define X509_ASN_ENCODING 0x1
   1310 #define X509_NDR_ENCODING 0x2
   1311 #define PKCS_7_ASN_ENCODING 0x10000
   1312 #define PKCS_7_NDR_ENCODING 0x20000
   1313 
   1314   WINIMPM WINBOOL WINAPI CryptFormatObject (DWORD dwCertEncodingType, DWORD dwFormatType, DWORD dwFormatStrType, void *pFormatStruct, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, void *pbFormat, DWORD *pcbFormat);
   1315 
   1316 #define CRYPT_FORMAT_STR_MULTI_LINE 0x1
   1317 #define CRYPT_FORMAT_STR_NO_HEX 0x10
   1318 
   1319 #define CRYPT_FORMAT_SIMPLE 0x1
   1320 #define CRYPT_FORMAT_X509 0x2
   1321 #define CRYPT_FORMAT_OID 0x4
   1322 #define CRYPT_FORMAT_RDN_SEMICOLON 0x100
   1323 #define CRYPT_FORMAT_RDN_CRLF 0x200
   1324 #define CRYPT_FORMAT_RDN_UNQUOTE 0x400
   1325 #define CRYPT_FORMAT_RDN_REVERSE 0x800
   1326 #define CRYPT_FORMAT_COMMA 0x1000
   1327 #define CRYPT_FORMAT_SEMICOLON CRYPT_FORMAT_RDN_SEMICOLON
   1328 #define CRYPT_FORMAT_CRLF CRYPT_FORMAT_RDN_CRLF
   1329 
   1330   typedef LPVOID (WINAPI *PFN_CRYPT_ALLOC)(size_t cbSize);
   1331   typedef VOID (WINAPI *PFN_CRYPT_FREE)(LPVOID pv);
   1332 
   1333   typedef struct _CRYPT_ENCODE_PARA {
   1334     DWORD cbSize;
   1335     PFN_CRYPT_ALLOC pfnAlloc;
   1336     PFN_CRYPT_FREE pfnFree;
   1337   } CRYPT_ENCODE_PARA,*PCRYPT_ENCODE_PARA;
   1338 
   1339   WINIMPM WINBOOL WINAPI CryptEncodeObjectEx (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, void *pvEncoded, DWORD *pcbEncoded);
   1340   WINIMPM WINBOOL WINAPI CryptEncodeObject (DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, BYTE *pbEncoded, DWORD *pcbEncoded);
   1341 
   1342 #define CRYPT_ENCODE_NO_SIGNATURE_BYTE_REVERSAL_FLAG 0x8
   1343 #define CRYPT_ENCODE_ALLOC_FLAG 0x8000
   1344 #define CRYPT_UNICODE_NAME_ENCODE_ENABLE_T61_UNICODE_FLAG CERT_RDN_ENABLE_T61_UNICODE_FLAG
   1345 #define CRYPT_UNICODE_NAME_ENCODE_ENABLE_UTF8_UNICODE_FLAG CERT_RDN_ENABLE_UTF8_UNICODE_FLAG
   1346 #define CRYPT_UNICODE_NAME_ENCODE_FORCE_UTF8_UNICODE_FLAG CERT_RDN_FORCE_UTF8_UNICODE_FLAG
   1347 #define CRYPT_UNICODE_NAME_ENCODE_DISABLE_CHECK_TYPE_FLAG CERT_RDN_DISABLE_CHECK_TYPE_FLAG
   1348 #define CRYPT_SORTED_CTL_ENCODE_HASHED_SUBJECT_IDENTIFIER_FLAG 0x10000
   1349 #define CRYPT_ENCODE_ENABLE_PUNYCODE_FLAG 0x20000
   1350 #define CRYPT_ENCODE_ENABLE_UTF8PERCENT_FLAG 0x40000
   1351 #define CRYPT_ENCODE_ENABLE_IA5CONVERSION_FLAG (CRYPT_ENCODE_ENABLE_PUNYCODE_FLAG | CRYPT_ENCODE_ENABLE_UTF8PERCENT_FLAG)
   1352 
   1353   typedef struct _CRYPT_DECODE_PARA {
   1354     DWORD cbSize;
   1355     PFN_CRYPT_ALLOC pfnAlloc;
   1356     PFN_CRYPT_FREE pfnFree;
   1357   } CRYPT_DECODE_PARA,*PCRYPT_DECODE_PARA;
   1358 
   1359   WINIMPM WINBOOL WINAPI CryptDecodeObjectEx (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo);
   1360   WINIMPM WINBOOL WINAPI CryptDecodeObject (DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo);
   1361 
   1362 #define CRYPT_DECODE_NOCOPY_FLAG 0x1
   1363 #define CRYPT_DECODE_TO_BE_SIGNED_FLAG 0x2
   1364 #define CRYPT_DECODE_SHARE_OID_STRING_FLAG 0x4
   1365 #define CRYPT_DECODE_NO_SIGNATURE_BYTE_REVERSAL_FLAG 0x8
   1366 #define CRYPT_DECODE_ALLOC_FLAG 0x8000
   1367 #define CRYPT_UNICODE_NAME_DECODE_DISABLE_IE4_UTF8_FLAG CERT_RDN_DISABLE_IE4_UTF8_FLAG
   1368 #define CRYPT_DECODE_ENABLE_PUNYCODE_FLAG 0x2000000
   1369 #define CRYPT_DECODE_ENABLE_UTF8PERCENT_FLAG 0x4000000
   1370 #define CRYPT_DECODE_ENABLE_IA5CONVERSION_FLAG (CRYPT_DECODE_ENABLE_PUNYCODE_FLAG | CRYPT_DECODE_ENABLE_UTF8PERCENT_FLAG)
   1371 
   1372 #define CRYPT_ENCODE_DECODE_NONE 0
   1373 #define X509_CERT ((LPCSTR) 1)
   1374 #define X509_CERT_TO_BE_SIGNED ((LPCSTR) 2)
   1375 #define X509_CERT_CRL_TO_BE_SIGNED ((LPCSTR) 3)
   1376 #define X509_CERT_REQUEST_TO_BE_SIGNED ((LPCSTR) 4)
   1377 #define X509_EXTENSIONS ((LPCSTR) 5)
   1378 #define X509_NAME_VALUE ((LPCSTR) 6)
   1379 #define X509_NAME ((LPCSTR) 7)
   1380 #define X509_PUBLIC_KEY_INFO ((LPCSTR) 8)
   1381 #define X509_AUTHORITY_KEY_ID ((LPCSTR) 9)
   1382 #define X509_KEY_ATTRIBUTES ((LPCSTR) 10)
   1383 #define X509_KEY_USAGE_RESTRICTION ((LPCSTR) 11)
   1384 #define X509_ALTERNATE_NAME ((LPCSTR) 12)
   1385 #define X509_BASIC_CONSTRAINTS ((LPCSTR) 13)
   1386 #define X509_KEY_USAGE ((LPCSTR) 14)
   1387 #define X509_BASIC_CONSTRAINTS2 ((LPCSTR) 15)
   1388 #define X509_CERT_POLICIES ((LPCSTR) 16)
   1389 #define PKCS_UTC_TIME ((LPCSTR) 17)
   1390 #define PKCS_TIME_REQUEST ((LPCSTR) 18)
   1391 #define RSA_CSP_PUBLICKEYBLOB ((LPCSTR) 19)
   1392 #define X509_UNICODE_NAME ((LPCSTR) 20)
   1393 #define X509_KEYGEN_REQUEST_TO_BE_SIGNED ((LPCSTR) 21)
   1394 #define PKCS_ATTRIBUTE ((LPCSTR) 22)
   1395 #define PKCS_CONTENT_INFO_SEQUENCE_OF_ANY ((LPCSTR) 23)
   1396 #define X509_UNICODE_NAME_VALUE ((LPCSTR) 24)
   1397 #define X509_ANY_STRING X509_NAME_VALUE
   1398 #define X509_UNICODE_ANY_STRING X509_UNICODE_NAME_VALUE
   1399 #define X509_OCTET_STRING ((LPCSTR) 25)
   1400 #define X509_BITS ((LPCSTR) 26)
   1401 #define X509_INTEGER ((LPCSTR) 27)
   1402 #define X509_MULTI_BYTE_INTEGER ((LPCSTR) 28)
   1403 #define X509_ENUMERATED ((LPCSTR) 29)
   1404 #define X509_CHOICE_OF_TIME ((LPCSTR) 30)
   1405 #define X509_AUTHORITY_KEY_ID2 ((LPCSTR) 31)
   1406 #define X509_AUTHORITY_INFO_ACCESS ((LPCSTR) 32)
   1407 #define X509_SUBJECT_INFO_ACCESS X509_AUTHORITY_INFO_ACCESS
   1408 #define X509_CRL_REASON_CODE X509_ENUMERATED
   1409 #define PKCS_CONTENT_INFO ((LPCSTR) 33)
   1410 #define X509_SEQUENCE_OF_ANY ((LPCSTR) 34)
   1411 #define X509_CRL_DIST_POINTS ((LPCSTR) 35)
   1412 #define X509_ENHANCED_KEY_USAGE ((LPCSTR) 36)
   1413 #define PKCS_CTL ((LPCSTR) 37)
   1414 #define X509_MULTI_BYTE_UINT ((LPCSTR) 38)
   1415 #define X509_DSS_PUBLICKEY X509_MULTI_BYTE_UINT
   1416 #define X509_DSS_PARAMETERS ((LPCSTR) 39)
   1417 #define X509_DSS_SIGNATURE ((LPCSTR) 40)
   1418 #define PKCS_RC2_CBC_PARAMETERS ((LPCSTR) 41)
   1419 #define PKCS_SMIME_CAPABILITIES ((LPCSTR) 42)
   1420 #define X509_QC_STATEMENTS_EXT ((LPCSTR) 42)
   1421 #define PKCS_RSA_PRIVATE_KEY ((LPCSTR) 43)
   1422 #define PKCS_PRIVATE_KEY_INFO ((LPCSTR) 44)
   1423 #define PKCS_ENCRYPTED_PRIVATE_KEY_INFO ((LPCSTR) 45)
   1424 #define X509_PKIX_POLICY_QUALIFIER_USERNOTICE ((LPCSTR) 46)
   1425 #define X509_DH_PUBLICKEY X509_MULTI_BYTE_UINT
   1426 #define X509_DH_PARAMETERS ((LPCSTR) 47)
   1427 #define X509_ECC_SIGNATURE ((LPCSTR) 47)
   1428 #define PKCS_ATTRIBUTES ((LPCSTR) 48)
   1429 #define PKCS_SORTED_CTL ((LPCSTR) 49)
   1430 #define X942_DH_PARAMETERS ((LPCSTR) 50)
   1431 #define X509_BITS_WITHOUT_TRAILING_ZEROES ((LPCSTR) 51)
   1432 #define X942_OTHER_INFO ((LPCSTR) 52)
   1433 #define X509_CERT_PAIR ((LPCSTR) 53)
   1434 #define X509_ISSUING_DIST_POINT ((LPCSTR) 54)
   1435 #define X509_NAME_CONSTRAINTS ((LPCSTR) 55)
   1436 #define X509_POLICY_MAPPINGS ((LPCSTR) 56)
   1437 #define X509_POLICY_CONSTRAINTS ((LPCSTR) 57)
   1438 #define X509_CROSS_CERT_DIST_POINTS ((LPCSTR) 58)
   1439 #define CMC_DATA ((LPCSTR) 59)
   1440 #define CMC_RESPONSE ((LPCSTR) 60)
   1441 #define CMC_STATUS ((LPCSTR) 61)
   1442 #define CMC_ADD_EXTENSIONS ((LPCSTR) 62)
   1443 #define CMC_ADD_ATTRIBUTES ((LPCSTR) 63)
   1444 #define X509_CERTIFICATE_TEMPLATE ((LPCSTR) 64)
   1445 #define OCSP_SIGNED_REQUEST ((LPCSTR) 65)
   1446 #define OCSP_REQUEST ((LPCSTR) 66)
   1447 #define OCSP_RESPONSE ((LPCSTR) 67)
   1448 #define OCSP_BASIC_SIGNED_RESPONSE ((LPCSTR) 68)
   1449 #define OCSP_BASIC_RESPONSE ((LPCSTR) 69)
   1450 #define X509_LOGOTYPE_EXT ((LPCSTR) 70)
   1451 #define X509_BIOMETRIC_EXT ((LPCSTR) 71)
   1452 #define CNG_RSA_PUBLIC_KEY_BLOB ((LPCSTR) 72)
   1453 #define X509_OBJECT_IDENTIFIER ((LPCSTR) 73)
   1454 #define X509_ALGORITHM_IDENTIFIER ((LPCSTR) 74)
   1455 #define PKCS_RSA_SSA_PSS_PARAMETERS ((LPCSTR) 75)
   1456 #define PKCS_RSAES_OAEP_PARAMETERS ((LPCSTR) 76)
   1457 #define ECC_CMS_SHARED_INFO ((LPCSTR) 77)
   1458 #define TIMESTAMP_REQUEST ((LPCSTR) 78)
   1459 #define TIMESTAMP_RESPONSE ((LPCSTR) 79)
   1460 #define TIMESTAMP_INFO ((LPCSTR) 80)
   1461 #define X509_CERT_BUNDLE ((LPCSTR) 81)
   1462 #define X509_ECC_PRIVATE_KEY ((LPCSTR) 82)
   1463 #define CNG_RSA_PRIVATE_KEY_BLOB ((LPCSTR) 83)
   1464 
   1465 #define PKCS7_SIGNER_INFO ((LPCSTR) 500)
   1466 #define CMS_SIGNER_INFO ((LPCSTR) 501)
   1467 
   1468 #define szOID_AUTHORITY_KEY_IDENTIFIER "2.5.29.1"
   1469 #define szOID_KEY_ATTRIBUTES "2.5.29.2"
   1470 #define szOID_CERT_POLICIES_95 "2.5.29.3"
   1471 #define szOID_KEY_USAGE_RESTRICTION "2.5.29.4"
   1472 #define szOID_SUBJECT_ALT_NAME "2.5.29.7"
   1473 #define szOID_ISSUER_ALT_NAME "2.5.29.8"
   1474 #define szOID_BASIC_CONSTRAINTS "2.5.29.10"
   1475 /* szOID_KEY_USAGE is defined incorrectly in msdn as 2.5.29.4 --
   1476    http://www.oid-info.com/get/2.5.29.15 RFC3280 */
   1477 #define szOID_KEY_USAGE "2.5.29.15"
   1478 #define szOID_PRIVATEKEY_USAGE_PERIOD "2.5.29.16"
   1479 #define szOID_BASIC_CONSTRAINTS2 "2.5.29.19"
   1480 
   1481 #define szOID_CERT_POLICIES "2.5.29.32"
   1482 #define szOID_ANY_CERT_POLICY "2.5.29.32.0"
   1483 #define szOID_INHIBIT_ANY_POLICY "2.5.29.54"
   1484 
   1485 #define szOID_AUTHORITY_KEY_IDENTIFIER2 "2.5.29.35"
   1486 #define szOID_SUBJECT_KEY_IDENTIFIER "2.5.29.14"
   1487 #define szOID_SUBJECT_ALT_NAME2 "2.5.29.17"
   1488 #define szOID_ISSUER_ALT_NAME2 "2.5.29.18"
   1489 #define szOID_CRL_REASON_CODE "2.5.29.21"
   1490 #define szOID_REASON_CODE_HOLD "2.5.29.23"
   1491 #define szOID_CRL_DIST_POINTS "2.5.29.31"
   1492 #define szOID_ENHANCED_KEY_USAGE "2.5.29.37"
   1493 
   1494 #define szOID_ANY_ENHANCED_KEY_USAGE "2.5.29.37.0"
   1495 
   1496 #define szOID_CRL_NUMBER "2.5.29.20"
   1497 
   1498 #define szOID_DELTA_CRL_INDICATOR "2.5.29.27"
   1499 #define szOID_ISSUING_DIST_POINT "2.5.29.28"
   1500 
   1501 #define szOID_FRESHEST_CRL "2.5.29.46"
   1502 #define szOID_NAME_CONSTRAINTS "2.5.29.30"
   1503 
   1504 #define szOID_POLICY_MAPPINGS "2.5.29.33"
   1505 #define szOID_LEGACY_POLICY_MAPPINGS "2.5.29.5"
   1506 #define szOID_POLICY_CONSTRAINTS "2.5.29.36"
   1507 
   1508 #define szOID_RENEWAL_CERTIFICATE "1.3.6.1.4.1.311.13.1"
   1509 #define szOID_ENROLLMENT_NAME_VALUE_PAIR "1.3.6.1.4.1.311.13.2.1"
   1510 #define szOID_ENROLLMENT_CSP_PROVIDER "1.3.6.1.4.1.311.13.2.2"
   1511 #define szOID_OS_VERSION "1.3.6.1.4.1.311.13.2.3"
   1512 
   1513 #define szOID_ENROLLMENT_AGENT "1.3.6.1.4.1.311.20.2.1"
   1514 
   1515 #define szOID_PKIX "1.3.6.1.5.5.7"
   1516 #define szOID_PKIX_PE "1.3.6.1.5.5.7.1"
   1517 #define szOID_AUTHORITY_INFO_ACCESS "1.3.6.1.5.5.7.1.1"
   1518 #define szOID_SUBJECT_INFO_ACCESS "1.3.6.1.5.5.7.1.11"
   1519 #define szOID_BIOMETRIC_EXT "1.3.6.1.5.5.7.1.2"
   1520 #define szOID_QC_STATEMENTS_EXT "1.3.6.1.5.5.7.1.3"
   1521 #define szOID_LOGOTYPE_EXT "1.3.6.1.5.5.7.1.12"
   1522 
   1523 #define szOID_CERT_EXTENSIONS "1.3.6.1.4.1.311.2.1.14"
   1524 #define szOID_NEXT_UPDATE_LOCATION "1.3.6.1.4.1.311.10.2"
   1525 #define szOID_REMOVE_CERTIFICATE "1.3.6.1.4.1.311.10.8.1"
   1526 #define szOID_CROSS_CERT_DIST_POINTS "1.3.6.1.4.1.311.10.9.1"
   1527 
   1528 #define szOID_CTL "1.3.6.1.4.1.311.10.1"
   1529 
   1530 #define szOID_SORTED_CTL "1.3.6.1.4.1.311.10.1.1"
   1531 
   1532 #ifndef szOID_SERIALIZED
   1533 #define szOID_SERIALIZED "1.3.6.1.4.1.311.10.3.3.1"
   1534 #endif
   1535 
   1536 #ifndef szOID_NT_PRINCIPAL_NAME
   1537 #define szOID_NT_PRINCIPAL_NAME "1.3.6.1.4.1.311.20.2.3"
   1538 #endif
   1539 
   1540 #ifndef szOID_INTERNATIONALIZED_EMAIL_ADDRESS
   1541 #define szOID_INTERNATIONALIZED_EMAIL_ADDRESS "1.3.6.1.4.1.311.20.2.4"
   1542 #endif
   1543 
   1544 #ifndef szOID_PRODUCT_UPDATE
   1545 #define szOID_PRODUCT_UPDATE "1.3.6.1.4.1.311.31.1"
   1546 #endif
   1547 
   1548 #define szOID_ANY_APPLICATION_POLICY "1.3.6.1.4.1.311.10.12.1"
   1549 
   1550 #define szOID_AUTO_ENROLL_CTL_USAGE "1.3.6.1.4.1.311.20.1"
   1551 
   1552 #define szOID_ENROLL_CERTTYPE_EXTENSION "1.3.6.1.4.1.311.20.2"
   1553 
   1554 #define szOID_CERT_MANIFOLD "1.3.6.1.4.1.311.20.3"
   1555 
   1556 #ifndef szOID_CERTSRV_CA_VERSION
   1557 #define szOID_CERTSRV_CA_VERSION "1.3.6.1.4.1.311.21.1"
   1558 #endif
   1559 #define szOID_CERTSRV_PREVIOUS_CERT_HASH "1.3.6.1.4.1.311.21.2"
   1560 #define szOID_CRL_VIRTUAL_BASE "1.3.6.1.4.1.311.21.3"
   1561 #define szOID_CRL_NEXT_PUBLISH "1.3.6.1.4.1.311.21.4"
   1562 #define szOID_KP_CA_EXCHANGE "1.3.6.1.4.1.311.21.5"
   1563 #define szOID_KP_KEY_RECOVERY_AGENT "1.3.6.1.4.1.311.21.6"
   1564 #define szOID_CERTIFICATE_TEMPLATE "1.3.6.1.4.1.311.21.7"
   1565 #define szOID_ENTERPRISE_OID_ROOT "1.3.6.1.4.1.311.21.8"
   1566 #define szOID_RDN_DUMMY_SIGNER "1.3.6.1.4.1.311.21.9"
   1567 #define szOID_APPLICATION_CERT_POLICIES "1.3.6.1.4.1.311.21.10"
   1568 #define szOID_APPLICATION_POLICY_MAPPINGS "1.3.6.1.4.1.311.21.11"
   1569 #define szOID_APPLICATION_POLICY_CONSTRAINTS "1.3.6.1.4.1.311.21.12"
   1570 #define szOID_ARCHIVED_KEY_ATTR "1.3.6.1.4.1.311.21.13"
   1571 #define szOID_CRL_SELF_CDP "1.3.6.1.4.1.311.21.14"
   1572 #define szOID_REQUIRE_CERT_CHAIN_POLICY "1.3.6.1.4.1.311.21.15"
   1573 #define szOID_ARCHIVED_KEY_CERT_HASH "1.3.6.1.4.1.311.21.16"
   1574 #define szOID_ISSUED_CERT_HASH "1.3.6.1.4.1.311.21.17"
   1575 #define szOID_DS_EMAIL_REPLICATION "1.3.6.1.4.1.311.21.19"
   1576 #define szOID_REQUEST_CLIENT_INFO "1.3.6.1.4.1.311.21.20"
   1577 #define szOID_ENCRYPTED_KEY_HASH "1.3.6.1.4.1.311.21.21"
   1578 #define szOID_CERTSRV_CROSSCA_VERSION "1.3.6.1.4.1.311.21.22"
   1579 
   1580 #define szOID_NTDS_REPLICATION "1.3.6.1.4.1.311.25.1"
   1581 
   1582 #define szOID_SUBJECT_DIR_ATTRS "2.5.29.9"
   1583 
   1584 #define szOID_PKIX_KP "1.3.6.1.5.5.7.3"
   1585 
   1586 #define szOID_PKIX_KP_SERVER_AUTH "1.3.6.1.5.5.7.3.1"
   1587 #define szOID_PKIX_KP_CLIENT_AUTH "1.3.6.1.5.5.7.3.2"
   1588 #define szOID_PKIX_KP_CODE_SIGNING "1.3.6.1.5.5.7.3.3"
   1589 #define szOID_PKIX_KP_EMAIL_PROTECTION "1.3.6.1.5.5.7.3.4"
   1590 #define szOID_PKIX_KP_IPSEC_END_SYSTEM "1.3.6.1.5.5.7.3.5"
   1591 #define szOID_PKIX_KP_IPSEC_TUNNEL "1.3.6.1.5.5.7.3.6"
   1592 #define szOID_PKIX_KP_IPSEC_USER "1.3.6.1.5.5.7.3.7"
   1593 #define szOID_PKIX_KP_TIMESTAMP_SIGNING "1.3.6.1.5.5.7.3.8"
   1594 #define szOID_PKIX_KP_OCSP_SIGNING "1.3.6.1.5.5.7.3.9"
   1595 
   1596 #define szOID_PKIX_OCSP_NONCE "1.3.6.1.5.5.7.48.1.2"
   1597 #define szOID_PKIX_OCSP_NOCHECK "1.3.6.1.5.5.7.48.1.5"
   1598 
   1599 #define szOID_IPSEC_KP_IKE_INTERMEDIATE "1.3.6.1.5.5.8.2.2"
   1600 
   1601 #define szOID_PKINIT_KP_KDC "1.3.6.1.5.2.3.5"
   1602 
   1603 #define szOID_KP_CTL_USAGE_SIGNING "1.3.6.1.4.1.311.10.3.1"
   1604 
   1605 #define szOID_KP_TIME_STAMP_SIGNING "1.3.6.1.4.1.311.10.3.2"
   1606 
   1607 #ifndef szOID_SERVER_GATED_CRYPTO
   1608 #define szOID_SERVER_GATED_CRYPTO "1.3.6.1.4.1.311.10.3.3"
   1609 #endif
   1610 
   1611 #ifndef szOID_SGC_NETSCAPE
   1612 #define szOID_SGC_NETSCAPE "2.16.840.1.113730.4.1"
   1613 #endif
   1614 
   1615 #define szOID_KP_EFS "1.3.6.1.4.1.311.10.3.4"
   1616 #define szOID_EFS_RECOVERY "1.3.6.1.4.1.311.10.3.4.1"
   1617 
   1618 #define szOID_WHQL_CRYPTO "1.3.6.1.4.1.311.10.3.5"
   1619 #define szOID_NT5_CRYPTO "1.3.6.1.4.1.311.10.3.6"
   1620 #define szOID_OEM_WHQL_CRYPTO "1.3.6.1.4.1.311.10.3.7"
   1621 #define szOID_EMBEDDED_NT_CRYPTO "1.3.6.1.4.1.311.10.3.8"
   1622 #define szOID_ROOT_LIST_SIGNER "1.3.6.1.4.1.311.10.3.9"
   1623 #define szOID_KP_QUALIFIED_SUBORDINATION "1.3.6.1.4.1.311.10.3.10"
   1624 #define szOID_KP_KEY_RECOVERY "1.3.6.1.4.1.311.10.3.11"
   1625 #define szOID_KP_DOCUMENT_SIGNING "1.3.6.1.4.1.311.10.3.12"
   1626 #define szOID_KP_LIFETIME_SIGNING "1.3.6.1.4.1.311.10.3.13"
   1627 #define szOID_KP_MOBILE_DEVICE_SOFTWARE "1.3.6.1.4.1.311.10.3.14"
   1628 #define szOID_KP_SMART_DISPLAY "1.3.6.1.4.1.311.10.3.15"
   1629 #define szOID_KP_CSP_SIGNATURE "1.3.6.1.4.1.311.10.3.16"
   1630 
   1631 #ifndef szOID_DRM
   1632 #define szOID_DRM "1.3.6.1.4.1.311.10.5.1"
   1633 #endif
   1634 
   1635 #ifndef szOID_DRM_INDIVIDUALIZATION
   1636 #define szOID_DRM_INDIVIDUALIZATION "1.3.6.1.4.1.311.10.5.2"
   1637 #endif
   1638 
   1639 #ifndef szOID_LICENSES
   1640 #define szOID_LICENSES "1.3.6.1.4.1.311.10.6.1"
   1641 #endif
   1642 
   1643 #ifndef szOID_LICENSE_SERVER
   1644 #define szOID_LICENSE_SERVER "1.3.6.1.4.1.311.10.6.2"
   1645 #endif
   1646 
   1647 #ifndef szOID_KP_SMARTCARD_LOGON
   1648 #define szOID_KP_SMARTCARD_LOGON "1.3.6.1.4.1.311.20.2.2"
   1649 #endif
   1650 
   1651 #define szOID_KP_KERNEL_MODE_CODE_SIGNING "1.3.6.1.4.1.311.61.1.1"
   1652 #define szOID_KP_KERNEL_MODE_TRUSTED_BOOT_SIGNING "1.3.6.1.4.1.311.61.4.1"
   1653 #define szOID_REVOKED_LIST_SIGNER "1.3.6.1.4.1.311.10.3.19"
   1654 #define szOID_DISALLOWED_LIST "1.3.6.1.4.1.311.10.3.30"
   1655 #define szOID_KP_KERNEL_MODE_HAL_EXTENSION_SIGNING "1.3.6.1.4.1.311.61.5.1"
   1656 #define szOID_YESNO_TRUST_ATTR "1.3.6.1.4.1.311.10.4.1"
   1657 
   1658 #define szOID_PKIX_POLICY_QUALIFIER_CPS "1.3.6.1.5.5.7.2.1"
   1659 #define szOID_PKIX_POLICY_QUALIFIER_USERNOTICE "1.3.6.1.5.5.7.2.2"
   1660 
   1661 #define szOID_ROOT_PROGRAM_FLAGS "1.3.6.1.4.1.311.60.1.1"
   1662 #define CERT_ROOT_PROGRAM_FLAG_ORG 0x80
   1663 #define CERT_ROOT_PROGRAM_FLAG_LSC 0x40
   1664 #define CERT_ROOT_PROGRAM_FLAG_SUBJECT_LOGO 0x20
   1665 #define CERT_ROOT_PROGRAM_FLAG_OU 0x10
   1666 #define CERT_ROOT_PROGRAM_FLAG_ADDRESS 0x08
   1667 
   1668 #define szOID_CERT_POLICIES_95_QUALIFIER1 "2.16.840.1.113733.1.7.1.1"
   1669 
   1670   typedef struct _CERT_EXTENSIONS {
   1671     DWORD cExtension;
   1672     PCERT_EXTENSION rgExtension;
   1673   } CERT_EXTENSIONS,*PCERT_EXTENSIONS;
   1674 
   1675 #define CERT_UNICODE_RDN_ERR_INDEX_MASK 0x3ff
   1676 #define CERT_UNICODE_RDN_ERR_INDEX_SHIFT 22
   1677 #define CERT_UNICODE_ATTR_ERR_INDEX_MASK 0x3f
   1678 #define CERT_UNICODE_ATTR_ERR_INDEX_SHIFT 16
   1679 #define CERT_UNICODE_VALUE_ERR_INDEX_MASK 0xffff
   1680 #define CERT_UNICODE_VALUE_ERR_INDEX_SHIFT 0
   1681 
   1682 #define GET_CERT_UNICODE_RDN_ERR_INDEX(X) ((X >> CERT_UNICODE_RDN_ERR_INDEX_SHIFT) &CERT_UNICODE_RDN_ERR_INDEX_MASK)
   1683 #define GET_CERT_UNICODE_ATTR_ERR_INDEX(X) ((X >> CERT_UNICODE_ATTR_ERR_INDEX_SHIFT) &CERT_UNICODE_ATTR_ERR_INDEX_MASK)
   1684 #define GET_CERT_UNICODE_VALUE_ERR_INDEX(X) (X &CERT_UNICODE_VALUE_ERR_INDEX_MASK)
   1685 
   1686   typedef struct _CERT_AUTHORITY_KEY_ID_INFO {
   1687     CRYPT_DATA_BLOB KeyId;
   1688     CERT_NAME_BLOB CertIssuer;
   1689     CRYPT_INTEGER_BLOB CertSerialNumber;
   1690   } CERT_AUTHORITY_KEY_ID_INFO,*PCERT_AUTHORITY_KEY_ID_INFO;
   1691 
   1692   typedef struct _CERT_PRIVATE_KEY_VALIDITY {
   1693     FILETIME NotBefore;
   1694     FILETIME NotAfter;
   1695   } CERT_PRIVATE_KEY_VALIDITY,*PCERT_PRIVATE_KEY_VALIDITY;
   1696 
   1697   typedef struct _CERT_KEY_ATTRIBUTES_INFO {
   1698     CRYPT_DATA_BLOB KeyId;
   1699     CRYPT_BIT_BLOB IntendedKeyUsage;
   1700     PCERT_PRIVATE_KEY_VALIDITY pPrivateKeyUsagePeriod;
   1701   } CERT_KEY_ATTRIBUTES_INFO,*PCERT_KEY_ATTRIBUTES_INFO;
   1702 
   1703 #define CERT_ENCIPHER_ONLY_KEY_USAGE 0x01
   1704 #define CERT_OFFLINE_CRL_SIGN_KEY_USAGE 0x02
   1705 #define CERT_KEY_CERT_SIGN_KEY_USAGE 0x04
   1706 #define CERT_KEY_AGREEMENT_KEY_USAGE 0x08
   1707 #define CERT_DATA_ENCIPHERMENT_KEY_USAGE 0x10
   1708 #define CERT_KEY_ENCIPHERMENT_KEY_USAGE 0x20
   1709 #define CERT_NON_REPUDIATION_KEY_USAGE 0x40
   1710 #define CERT_DIGITAL_SIGNATURE_KEY_USAGE 0x80
   1711 
   1712 #define CERT_DECIPHER_ONLY_KEY_USAGE 0x80
   1713 
   1714   typedef struct _CERT_POLICY_ID {
   1715     DWORD cCertPolicyElementId;
   1716     LPSTR *rgpszCertPolicyElementId;
   1717   } CERT_POLICY_ID,*PCERT_POLICY_ID;
   1718 
   1719   typedef struct _CERT_KEY_USAGE_RESTRICTION_INFO {
   1720     DWORD cCertPolicyId;
   1721     PCERT_POLICY_ID rgCertPolicyId;
   1722     CRYPT_BIT_BLOB RestrictedKeyUsage;
   1723   } CERT_KEY_USAGE_RESTRICTION_INFO,*PCERT_KEY_USAGE_RESTRICTION_INFO;
   1724 
   1725   typedef struct _CERT_OTHER_NAME {
   1726     LPSTR pszObjId;
   1727     CRYPT_OBJID_BLOB Value;
   1728   } CERT_OTHER_NAME,*PCERT_OTHER_NAME;
   1729 
   1730   typedef struct _CERT_ALT_NAME_ENTRY {
   1731     DWORD dwAltNameChoice;
   1732     __C89_NAMELESS union {
   1733       PCERT_OTHER_NAME pOtherName;
   1734       LPWSTR pwszRfc822Name;
   1735       LPWSTR pwszDNSName;
   1736       /* CERT_DATA_BLOB is not documented, and x400Address is documented
   1737        * to be not implemented; commented out to prevent compile errors
   1738        * see http://msdn.microsoft.com/en-us/library/aa377173.aspx for
   1739        * CERT_ALT_NAME_ENTRY documentation where this is specified.
   1740       CERT_DATA_BLOB x400Address;
   1741        */
   1742       CERT_NAME_BLOB DirectoryName;
   1743       /* pEdiPartyName is not implemented, either. see:
   1744        * http://msdn.microsoft.com/en-us/library/aa924681.aspx or
   1745        * http://msdn.microsoft.com/en-us/library/aa377173.aspx
   1746       LPWSTR pEdiPartyName;
   1747        */
   1748       LPWSTR pwszURL;
   1749       CRYPT_DATA_BLOB IPAddress;
   1750       LPSTR pszRegisteredID;
   1751     };
   1752   } CERT_ALT_NAME_ENTRY,*PCERT_ALT_NAME_ENTRY;
   1753 
   1754 #define CERT_ALT_NAME_OTHER_NAME 1
   1755 #define CERT_ALT_NAME_RFC822_NAME 2
   1756 #define CERT_ALT_NAME_DNS_NAME 3
   1757 #define CERT_ALT_NAME_X400_ADDRESS 4
   1758 #define CERT_ALT_NAME_DIRECTORY_NAME 5
   1759 #define CERT_ALT_NAME_EDI_PARTY_NAME 6
   1760 #define CERT_ALT_NAME_URL 7
   1761 #define CERT_ALT_NAME_IP_ADDRESS 8
   1762 #define CERT_ALT_NAME_REGISTERED_ID 9
   1763 
   1764   typedef struct _CERT_ALT_NAME_INFO {
   1765     DWORD cAltEntry;
   1766     PCERT_ALT_NAME_ENTRY rgAltEntry;
   1767   } CERT_ALT_NAME_INFO,*PCERT_ALT_NAME_INFO;
   1768 #define CERT_ALT_NAME_ENTRY_ERR_INDEX_MASK 0xff
   1769 #define CERT_ALT_NAME_ENTRY_ERR_INDEX_SHIFT 16
   1770 #define CERT_ALT_NAME_VALUE_ERR_INDEX_MASK 0x0000ffff
   1771 #define CERT_ALT_NAME_VALUE_ERR_INDEX_SHIFT 0
   1772 
   1773 #define GET_CERT_ALT_NAME_ENTRY_ERR_INDEX(X) ((X >> CERT_ALT_NAME_ENTRY_ERR_INDEX_SHIFT) &CERT_ALT_NAME_ENTRY_ERR_INDEX_MASK)
   1774 #define GET_CERT_ALT_NAME_VALUE_ERR_INDEX(X) (X &CERT_ALT_NAME_VALUE_ERR_INDEX_MASK)
   1775 
   1776   typedef struct _CERT_BASIC_CONSTRAINTS_INFO {
   1777     CRYPT_BIT_BLOB SubjectType;
   1778     WINBOOL fPathLenConstraint;
   1779     DWORD dwPathLenConstraint;
   1780     DWORD cSubtreesConstraint;
   1781     CERT_NAME_BLOB *rgSubtreesConstraint;
   1782   } CERT_BASIC_CONSTRAINTS_INFO, *PCERT_BASIC_CONSTRAINTS_INFO;
   1783 
   1784 #define CERT_CA_SUBJECT_FLAG 0x80
   1785 #define CERT_END_ENTITY_SUBJECT_FLAG 0x40
   1786 
   1787   typedef struct _CERT_BASIC_CONSTRAINTS2_INFO {
   1788     WINBOOL fCA;
   1789     WINBOOL fPathLenConstraint;
   1790     DWORD dwPathLenConstraint;
   1791   } CERT_BASIC_CONSTRAINTS2_INFO,*PCERT_BASIC_CONSTRAINTS2_INFO;
   1792 
   1793   typedef struct _CERT_POLICY_QUALIFIER_INFO {
   1794     LPSTR pszPolicyQualifierId;
   1795     CRYPT_OBJID_BLOB Qualifier;
   1796   } CERT_POLICY_QUALIFIER_INFO,*PCERT_POLICY_QUALIFIER_INFO;
   1797 
   1798   typedef struct _CERT_POLICY_INFO {
   1799     LPSTR pszPolicyIdentifier;
   1800     DWORD cPolicyQualifier;
   1801     CERT_POLICY_QUALIFIER_INFO *rgPolicyQualifier;
   1802   } CERT_POLICY_INFO,*PCERT_POLICY_INFO;
   1803 
   1804   typedef struct _CERT_POLICIES_INFO {
   1805     DWORD cPolicyInfo;
   1806     CERT_POLICY_INFO *rgPolicyInfo;
   1807   } CERT_POLICIES_INFO,*PCERT_POLICIES_INFO;
   1808 
   1809   typedef struct _CERT_POLICY_QUALIFIER_NOTICE_REFERENCE {
   1810     LPSTR pszOrganization;
   1811     DWORD cNoticeNumbers;
   1812     int *rgNoticeNumbers;
   1813   } CERT_POLICY_QUALIFIER_NOTICE_REFERENCE,*PCERT_POLICY_QUALIFIER_NOTICE_REFERENCE;
   1814 
   1815   typedef struct _CERT_POLICY_QUALIFIER_USER_NOTICE {
   1816     CERT_POLICY_QUALIFIER_NOTICE_REFERENCE *pNoticeReference;
   1817     LPWSTR pszDisplayText;
   1818   } CERT_POLICY_QUALIFIER_USER_NOTICE,*PCERT_POLICY_QUALIFIER_USER_NOTICE;
   1819 
   1820   typedef struct _CPS_URLS {
   1821     LPWSTR pszURL;
   1822     CRYPT_ALGORITHM_IDENTIFIER *pAlgorithm;
   1823     CRYPT_DATA_BLOB *pDigest;
   1824   } CPS_URLS,*PCPS_URLS;
   1825 
   1826   typedef struct _CERT_POLICY95_QUALIFIER1 {
   1827     LPWSTR pszPracticesReference;
   1828     LPSTR pszNoticeIdentifier;
   1829     LPSTR pszNSINoticeIdentifier;
   1830     DWORD cCPSURLs;
   1831     CPS_URLS *rgCPSURLs;
   1832   } CERT_POLICY95_QUALIFIER1,*PCERT_POLICY95_QUALIFIER1;
   1833 
   1834   typedef struct _CERT_POLICY_MAPPING {
   1835     LPSTR pszIssuerDomainPolicy;
   1836     LPSTR pszSubjectDomainPolicy;
   1837   } CERT_POLICY_MAPPING,*PCERT_POLICY_MAPPING;
   1838 
   1839   typedef struct _CERT_POLICY_MAPPINGS_INFO {
   1840     DWORD cPolicyMapping;
   1841     PCERT_POLICY_MAPPING rgPolicyMapping;
   1842   } CERT_POLICY_MAPPINGS_INFO,*PCERT_POLICY_MAPPINGS_INFO;
   1843 
   1844   typedef struct _CERT_POLICY_CONSTRAINTS_INFO {
   1845     WINBOOL fRequireExplicitPolicy;
   1846     DWORD dwRequireExplicitPolicySkipCerts;
   1847     WINBOOL fInhibitPolicyMapping;
   1848     DWORD dwInhibitPolicyMappingSkipCerts;
   1849   } CERT_POLICY_CONSTRAINTS_INFO,*PCERT_POLICY_CONSTRAINTS_INFO;
   1850 
   1851   typedef struct _CRYPT_CONTENT_INFO_SEQUENCE_OF_ANY {
   1852     LPSTR pszObjId;
   1853     DWORD cValue;
   1854     PCRYPT_DER_BLOB rgValue;
   1855   } CRYPT_CONTENT_INFO_SEQUENCE_OF_ANY,*PCRYPT_CONTENT_INFO_SEQUENCE_OF_ANY;
   1856 
   1857   typedef struct _CRYPT_CONTENT_INFO {
   1858     LPSTR pszObjId;
   1859     CRYPT_DER_BLOB Content;
   1860   } CRYPT_CONTENT_INFO,*PCRYPT_CONTENT_INFO;
   1861 
   1862   typedef struct _CRYPT_SEQUENCE_OF_ANY {
   1863     DWORD cValue;
   1864     PCRYPT_DER_BLOB rgValue;
   1865   } CRYPT_SEQUENCE_OF_ANY,*PCRYPT_SEQUENCE_OF_ANY;
   1866 
   1867   typedef struct _CERT_AUTHORITY_KEY_ID2_INFO {
   1868     CRYPT_DATA_BLOB KeyId;
   1869     CERT_ALT_NAME_INFO AuthorityCertIssuer;
   1870     CRYPT_INTEGER_BLOB AuthorityCertSerialNumber;
   1871   } CERT_AUTHORITY_KEY_ID2_INFO,*PCERT_AUTHORITY_KEY_ID2_INFO;
   1872 
   1873   typedef struct _CERT_ACCESS_DESCRIPTION {
   1874     LPSTR pszAccessMethod;
   1875     CERT_ALT_NAME_ENTRY AccessLocation;
   1876   } CERT_ACCESS_DESCRIPTION,*PCERT_ACCESS_DESCRIPTION;
   1877 
   1878   typedef struct _CERT_AUTHORITY_INFO_ACCESS {
   1879     DWORD cAccDescr;
   1880     PCERT_ACCESS_DESCRIPTION rgAccDescr;
   1881   } CERT_AUTHORITY_INFO_ACCESS,*PCERT_AUTHORITY_INFO_ACCESS;
   1882 
   1883   typedef CERT_AUTHORITY_INFO_ACCESS CERT_SUBJECT_INFO_ACCESS,*PCERT_SUBJECT_INFO_ACCESS;
   1884 
   1885 #define szOID_PKIX_ACC_DESCR "1.3.6.1.5.5.7.48"
   1886 #define szOID_PKIX_OCSP "1.3.6.1.5.5.7.48.1"
   1887 #define szOID_PKIX_CA_ISSUERS "1.3.6.1.5.5.7.48.2"
   1888 #define szOID_PKIX_TIME_STAMPING "1.3.6.1.5.5.7.48.3"
   1889 #define szOID_PKIX_CA_REPOSITORY "1.3.6.1.5.5.7.48.5"
   1890 
   1891 #define CRL_REASON_UNSPECIFIED 0
   1892 #define CRL_REASON_KEY_COMPROMISE 1
   1893 #define CRL_REASON_CA_COMPROMISE 2
   1894 #define CRL_REASON_AFFILIATION_CHANGED 3
   1895 #define CRL_REASON_SUPERSEDED 4
   1896 #define CRL_REASON_CESSATION_OF_OPERATION 5
   1897 #define CRL_REASON_CERTIFICATE_HOLD 6
   1898 #define CRL_REASON_REMOVE_FROM_CRL 8
   1899 
   1900   typedef struct _CRL_DIST_POINT_NAME {
   1901     DWORD dwDistPointNameChoice;
   1902     __C89_NAMELESS union {
   1903       CERT_ALT_NAME_INFO FullName;
   1904     };
   1905   } CRL_DIST_POINT_NAME,*PCRL_DIST_POINT_NAME;
   1906 
   1907 #define CRL_DIST_POINT_NO_NAME 0
   1908 #define CRL_DIST_POINT_FULL_NAME 1
   1909 #define CRL_DIST_POINT_ISSUER_RDN_NAME 2
   1910 
   1911   typedef struct _CRL_DIST_POINT {
   1912     CRL_DIST_POINT_NAME DistPointName;
   1913     CRYPT_BIT_BLOB ReasonFlags;
   1914     CERT_ALT_NAME_INFO CRLIssuer;
   1915   } CRL_DIST_POINT,*PCRL_DIST_POINT;
   1916 
   1917 #define CRL_REASON_UNUSED_FLAG 0x80
   1918 #define CRL_REASON_KEY_COMPROMISE_FLAG 0x40
   1919 #define CRL_REASON_CA_COMPROMISE_FLAG 0x20
   1920 #define CRL_REASON_AFFILIATION_CHANGED_FLAG 0x10
   1921 #define CRL_REASON_SUPERSEDED_FLAG 0x08
   1922 #define CRL_REASON_CESSATION_OF_OPERATION_FLAG 0x04
   1923 #define CRL_REASON_CERTIFICATE_HOLD_FLAG 0x02
   1924 
   1925   typedef struct _CRL_DIST_POINTS_INFO {
   1926     DWORD cDistPoint;
   1927     PCRL_DIST_POINT rgDistPoint;
   1928   } CRL_DIST_POINTS_INFO,*PCRL_DIST_POINTS_INFO;
   1929 
   1930 #define CRL_DIST_POINT_ERR_INDEX_MASK 0x7f
   1931 #define CRL_DIST_POINT_ERR_INDEX_SHIFT 24
   1932 #define GET_CRL_DIST_POINT_ERR_INDEX(X) ((X >> CRL_DIST_POINT_ERR_INDEX_SHIFT) &CRL_DIST_POINT_ERR_INDEX_MASK)
   1933 
   1934 #define CRL_DIST_POINT_ERR_CRL_ISSUER_BIT __MSABI_LONG(0x80000000)
   1935 #define IS_CRL_DIST_POINT_ERR_CRL_ISSUER(X) (0 != (X & CRL_DIST_POINT_ERR_CRL_ISSUER_BIT))
   1936 
   1937   typedef struct _CROSS_CERT_DIST_POINTS_INFO {
   1938     DWORD dwSyncDeltaTime;
   1939     DWORD cDistPoint;
   1940     PCERT_ALT_NAME_INFO rgDistPoint;
   1941   } CROSS_CERT_DIST_POINTS_INFO,*PCROSS_CERT_DIST_POINTS_INFO;
   1942 
   1943 #define CROSS_CERT_DIST_POINT_ERR_INDEX_MASK 0xff
   1944 #define CROSS_CERT_DIST_POINT_ERR_INDEX_SHIFT 24
   1945 #define GET_CROSS_CERT_DIST_POINT_ERR_INDEX(X) ((X >> CROSS_CERT_DIST_POINT_ERR_INDEX_SHIFT) &CROSS_CERT_DIST_POINT_ERR_INDEX_MASK)
   1946 
   1947   typedef struct _CERT_PAIR {
   1948     CERT_BLOB Forward;
   1949     CERT_BLOB Reverse;
   1950   } CERT_PAIR,*PCERT_PAIR;
   1951 
   1952   typedef struct _CRL_ISSUING_DIST_POINT {
   1953     CRL_DIST_POINT_NAME DistPointName;
   1954     WINBOOL fOnlyContainsUserCerts;
   1955     WINBOOL fOnlyContainsCACerts;
   1956     CRYPT_BIT_BLOB OnlySomeReasonFlags;
   1957     WINBOOL fIndirectCRL;
   1958   } CRL_ISSUING_DIST_POINT,*PCRL_ISSUING_DIST_POINT;
   1959 
   1960   typedef struct _CERT_GENERAL_SUBTREE {
   1961     CERT_ALT_NAME_ENTRY Base;
   1962     DWORD dwMinimum;
   1963     WINBOOL fMaximum;
   1964     DWORD dwMaximum;
   1965   } CERT_GENERAL_SUBTREE,*PCERT_GENERAL_SUBTREE;
   1966 
   1967   typedef struct _CERT_NAME_CONSTRAINTS_INFO {
   1968     DWORD cPermittedSubtree;
   1969     PCERT_GENERAL_SUBTREE rgPermittedSubtree;
   1970     DWORD cExcludedSubtree;
   1971     PCERT_GENERAL_SUBTREE rgExcludedSubtree;
   1972   } CERT_NAME_CONSTRAINTS_INFO,*PCERT_NAME_CONSTRAINTS_INFO;
   1973 
   1974 #define CERT_EXCLUDED_SUBTREE_BIT __MSABI_LONG(0x80000000)
   1975 #define IS_CERT_EXCLUDED_SUBTREE(X) (0!=(X & CERT_EXCLUDED_SUBTREE_BIT))
   1976 
   1977 #define SORTED_CTL_EXT_FLAGS_OFFSET (0)
   1978 #define SORTED_CTL_EXT_COUNT_OFFSET (4)
   1979 #define SORTED_CTL_EXT_MAX_COLLISION_OFFSET (8)
   1980 #define SORTED_CTL_EXT_HASH_BUCKET_OFFSET (12)
   1981 
   1982 #define SORTED_CTL_EXT_HASHED_SUBJECT_IDENTIFIER_FLAG 0x1
   1983 
   1984   typedef struct _CERT_DSS_PARAMETERS {
   1985     CRYPT_UINT_BLOB p;
   1986     CRYPT_UINT_BLOB q;
   1987     CRYPT_UINT_BLOB g;
   1988   } CERT_DSS_PARAMETERS,*PCERT_DSS_PARAMETERS;
   1989 
   1990 #define CERT_DSS_R_LEN 20
   1991 #define CERT_DSS_S_LEN 20
   1992 #define CERT_DSS_SIGNATURE_LEN (CERT_DSS_R_LEN + CERT_DSS_S_LEN)
   1993 
   1994 #define CERT_MAX_ASN_ENCODED_DSS_SIGNATURE_LEN (48)
   1995 
   1996   typedef struct _CERT_DH_PARAMETERS {
   1997     CRYPT_UINT_BLOB p;
   1998     CRYPT_UINT_BLOB g;
   1999   } CERT_DH_PARAMETERS,*PCERT_DH_PARAMETERS;
   2000 
   2001   typedef struct _CERT_ECC_SIGNATURE {
   2002     CRYPT_UINT_BLOB r;
   2003     CRYPT_UINT_BLOB s;
   2004   } CERT_ECC_SIGNATURE,*PCERT_ECC_SIGNATURE;
   2005 
   2006   typedef struct _CERT_X942_DH_VALIDATION_PARAMS {
   2007     CRYPT_BIT_BLOB seed;
   2008     DWORD pgenCounter;
   2009   } CERT_X942_DH_VALIDATION_PARAMS,*PCERT_X942_DH_VALIDATION_PARAMS;
   2010 
   2011   typedef struct _CERT_X942_DH_PARAMETERS {
   2012     CRYPT_UINT_BLOB p;
   2013     CRYPT_UINT_BLOB g;
   2014     CRYPT_UINT_BLOB q;
   2015     CRYPT_UINT_BLOB j;
   2016     PCERT_X942_DH_VALIDATION_PARAMS pValidationParams;
   2017   } CERT_X942_DH_PARAMETERS,*PCERT_X942_DH_PARAMETERS;
   2018 
   2019 #define CRYPT_X942_COUNTER_BYTE_LENGTH 4
   2020 #define CRYPT_X942_KEY_LENGTH_BYTE_LENGTH 4
   2021 #define CRYPT_X942_PUB_INFO_BYTE_LENGTH (512/8)
   2022 
   2023   typedef struct _CRYPT_X942_OTHER_INFO {
   2024     LPSTR pszContentEncryptionObjId;
   2025     BYTE rgbCounter[CRYPT_X942_COUNTER_BYTE_LENGTH];
   2026     BYTE rgbKeyLength[CRYPT_X942_KEY_LENGTH_BYTE_LENGTH];
   2027     CRYPT_DATA_BLOB PubInfo;
   2028   } CRYPT_X942_OTHER_INFO,*PCRYPT_X942_OTHER_INFO;
   2029 
   2030 #define CRYPT_ECC_CMS_SHARED_INFO_SUPPPUBINFO_BYTE_LENGTH 4
   2031 
   2032   typedef struct _CRYPT_ECC_CMS_SHARED_INFO {
   2033     CRYPT_ALGORITHM_IDENTIFIER Algorithm;
   2034     CRYPT_DATA_BLOB EntityUInfo;
   2035     BYTE rgbSuppPubInfo[CRYPT_ECC_CMS_SHARED_INFO_SUPPPUBINFO_BYTE_LENGTH];
   2036   } CRYPT_ECC_CMS_SHARED_INFO,*PCRYPT_ECC_CMS_SHARED_INFO;
   2037 
   2038   typedef struct _CRYPT_RC2_CBC_PARAMETERS {
   2039     DWORD dwVersion;
   2040     WINBOOL fIV;
   2041     BYTE rgbIV[8];
   2042   } CRYPT_RC2_CBC_PARAMETERS,*PCRYPT_RC2_CBC_PARAMETERS;
   2043 
   2044 #define CRYPT_RC2_40BIT_VERSION 160
   2045 #define CRYPT_RC2_56BIT_VERSION 52
   2046 #define CRYPT_RC2_64BIT_VERSION 120
   2047 #define CRYPT_RC2_128BIT_VERSION 58
   2048 
   2049   typedef struct _CRYPT_SMIME_CAPABILITY {
   2050     LPSTR pszObjId;
   2051     CRYPT_OBJID_BLOB Parameters;
   2052   } CRYPT_SMIME_CAPABILITY,*PCRYPT_SMIME_CAPABILITY;
   2053 
   2054   typedef struct _CRYPT_SMIME_CAPABILITIES {
   2055     DWORD cCapability;
   2056     PCRYPT_SMIME_CAPABILITY rgCapability;
   2057   } CRYPT_SMIME_CAPABILITIES,*PCRYPT_SMIME_CAPABILITIES;
   2058 
   2059   typedef struct _CERT_QC_STATEMENT {
   2060     LPSTR pszStatementId;
   2061     CRYPT_OBJID_BLOB StatementInfo;
   2062   } CERT_QC_STATEMENT,*PCERT_QC_STATEMENT;
   2063 
   2064   typedef struct _CERT_QC_STATEMENTS_EXT_INFO {
   2065     DWORD cStatement;
   2066     PCERT_QC_STATEMENT rgStatement;
   2067   } CERT_QC_STATEMENTS_EXT_INFO,*PCERT_QC_STATEMENTS_EXT_INFO;
   2068 
   2069 #define szOID_QC_EU_COMPLIANCE "0.4.0.1862.1.1"
   2070 #define szOID_QC_SSCD "0.4.0.1862.1.4"
   2071 
   2072   typedef struct _CRYPT_MASK_GEN_ALGORITHM {
   2073     LPSTR pszObjId;
   2074     CRYPT_ALGORITHM_IDENTIFIER HashAlgorithm;
   2075   } CRYPT_MASK_GEN_ALGORITHM,*PCRYPT_MASK_GEN_ALGORITHM;
   2076 
   2077   typedef struct _CRYPT_RSA_SSA_PSS_PARAMETERS {
   2078     CRYPT_ALGORITHM_IDENTIFIER HashAlgorithm;
   2079     CRYPT_MASK_GEN_ALGORITHM MaskGenAlgorithm;
   2080     DWORD dwSaltLength;
   2081     DWORD dwTrailerField;
   2082   } CRYPT_RSA_SSA_PSS_PARAMETERS,*PCRYPT_RSA_SSA_PSS_PARAMETERS;
   2083 
   2084 #define PKCS_RSA_SSA_PSS_TRAILER_FIELD_BC 1
   2085 
   2086   typedef struct _CRYPT_PSOURCE_ALGORITHM {
   2087     LPSTR pszObjId;
   2088     CRYPT_DATA_BLOB EncodingParameters;
   2089   } CRYPT_PSOURCE_ALGORITHM,*PCRYPT_PSOURCE_ALGORITHM;
   2090 
   2091   typedef struct _CRYPT_RSAES_OAEP_PARAMETERS {
   2092     CRYPT_ALGORITHM_IDENTIFIER HashAlgorithm;
   2093     CRYPT_MASK_GEN_ALGORITHM MaskGenAlgorithm;
   2094     CRYPT_PSOURCE_ALGORITHM PSourceAlgorithm;
   2095   } CRYPT_RSAES_OAEP_PARAMETERS,*PCRYPT_RSAES_OAEP_PARAMETERS;
   2096 
   2097 #define szOID_VERISIGN_PRIVATE_6_9 "2.16.840.1.113733.1.6.9"
   2098 #define szOID_VERISIGN_ONSITE_JURISDICTION_HASH "2.16.840.1.113733.1.6.11"
   2099 #define szOID_VERISIGN_BITSTRING_6_13 "2.16.840.1.113733.1.6.13"
   2100 
   2101 #define szOID_VERISIGN_ISS_STRONG_CRYPTO "2.16.840.1.113733.1.8.1"
   2102 
   2103 #define szOID_NETSCAPE "2.16.840.1.113730"
   2104 #define szOID_NETSCAPE_CERT_EXTENSION "2.16.840.1.113730.1"
   2105 #define szOID_NETSCAPE_CERT_TYPE "2.16.840.1.113730.1.1"
   2106 #define szOID_NETSCAPE_BASE_URL "2.16.840.1.113730.1.2"
   2107 #define szOID_NETSCAPE_REVOCATION_URL "2.16.840.1.113730.1.3"
   2108 #define szOID_NETSCAPE_CA_REVOCATION_URL "2.16.840.1.113730.1.4"
   2109 #define szOID_NETSCAPE_CERT_RENEWAL_URL "2.16.840.1.113730.1.7"
   2110 #define szOID_NETSCAPE_CA_POLICY_URL "2.16.840.1.113730.1.8"
   2111 #define szOID_NETSCAPE_SSL_SERVER_NAME "2.16.840.1.113730.1.12"
   2112 #define szOID_NETSCAPE_COMMENT "2.16.840.1.113730.1.13"
   2113 
   2114 #define szOID_NETSCAPE_DATA_TYPE "2.16.840.1.113730.2"
   2115 #define szOID_NETSCAPE_CERT_SEQUENCE "2.16.840.1.113730.2.5"
   2116 
   2117 #define NETSCAPE_SIGN_CA_CERT_TYPE 0x01
   2118 #define NETSCAPE_SMIME_CA_CERT_TYPE 0x02
   2119 #define NETSCAPE_SSL_CA_CERT_TYPE 0x04
   2120 #define NETSCAPE_SIGN_CERT_TYPE 0x10
   2121 #define NETSCAPE_SMIME_CERT_TYPE 0x20
   2122 #define NETSCAPE_SSL_SERVER_AUTH_CERT_TYPE 0x40
   2123 #define NETSCAPE_SSL_CLIENT_AUTH_CERT_TYPE 0x80
   2124 
   2125 #define szOID_CT_PKI_DATA "1.3.6.1.5.5.7.12.2"
   2126 #define szOID_CT_PKI_RESPONSE "1.3.6.1.5.5.7.12.3"
   2127 
   2128 #define szOID_PKIX_NO_SIGNATURE "1.3.6.1.5.5.7.6.2"
   2129 
   2130 #define szOID_CMC "1.3.6.1.5.5.7.7"
   2131 #define szOID_CMC_STATUS_INFO "1.3.6.1.5.5.7.7.1"
   2132 #define szOID_CMC_IDENTIFICATION "1.3.6.1.5.5.7.7.2"
   2133 #define szOID_CMC_IDENTITY_PROOF "1.3.6.1.5.5.7.7.3"
   2134 #define szOID_CMC_DATA_RETURN "1.3.6.1.5.5.7.7.4"
   2135 #define szOID_CMC_TRANSACTION_ID "1.3.6.1.5.5.7.7.5"
   2136 #define szOID_CMC_SENDER_NONCE "1.3.6.1.5.5.7.7.6"
   2137 #define szOID_CMC_RECIPIENT_NONCE "1.3.6.1.5.5.7.7.7"
   2138 #define szOID_CMC_ADD_EXTENSIONS "1.3.6.1.5.5.7.7.8"
   2139 #define szOID_CMC_ENCRYPTED_POP "1.3.6.1.5.5.7.7.9"
   2140 #define szOID_CMC_DECRYPTED_POP "1.3.6.1.5.5.7.7.10"
   2141 #define szOID_CMC_LRA_POP_WITNESS "1.3.6.1.5.5.7.7.11"
   2142 #define szOID_CMC_GET_CERT "1.3.6.1.5.5.7.7.15"
   2143 #define szOID_CMC_GET_CRL "1.3.6.1.5.5.7.7.16"
   2144 #define szOID_CMC_REVOKE_REQUEST "1.3.6.1.5.5.7.7.17"
   2145 #define szOID_CMC_REG_INFO "1.3.6.1.5.5.7.7.18"
   2146 #define szOID_CMC_RESPONSE_INFO "1.3.6.1.5.5.7.7.19"
   2147 #define szOID_CMC_QUERY_PENDING "1.3.6.1.5.5.7.7.21"
   2148 #define szOID_CMC_ID_POP_LINK_RANDOM "1.3.6.1.5.5.7.7.22"
   2149 #define szOID_CMC_ID_POP_LINK_WITNESS "1.3.6.1.5.5.7.7.23"
   2150 #define szOID_CMC_ID_CONFIRM_CERT_ACCEPTANCE "1.3.6.1.5.5.7.7.24"
   2151 
   2152 #define szOID_CMC_ADD_ATTRIBUTES "1.3.6.1.4.1.311.10.10.1"
   2153 
   2154   typedef struct _CMC_TAGGED_ATTRIBUTE {
   2155     DWORD dwBodyPartID;
   2156     CRYPT_ATTRIBUTE Attribute;
   2157   } CMC_TAGGED_ATTRIBUTE,*PCMC_TAGGED_ATTRIBUTE;
   2158 
   2159   typedef struct _CMC_TAGGED_CERT_REQUEST {
   2160     DWORD dwBodyPartID;
   2161     CRYPT_DER_BLOB SignedCertRequest;
   2162   } CMC_TAGGED_CERT_REQUEST,*PCMC_TAGGED_CERT_REQUEST;
   2163 
   2164   typedef struct _CMC_TAGGED_REQUEST {
   2165     DWORD dwTaggedRequestChoice;
   2166     __C89_NAMELESS union {
   2167       PCMC_TAGGED_CERT_REQUEST pTaggedCertRequest;
   2168     };
   2169   } CMC_TAGGED_REQUEST,*PCMC_TAGGED_REQUEST;
   2170 
   2171 #define CMC_TAGGED_CERT_REQUEST_CHOICE 1
   2172 
   2173   typedef struct _CMC_TAGGED_CONTENT_INFO {
   2174     DWORD dwBodyPartID;
   2175     CRYPT_DER_BLOB EncodedContentInfo;
   2176   } CMC_TAGGED_CONTENT_INFO,*PCMC_TAGGED_CONTENT_INFO;
   2177 
   2178   typedef struct _CMC_TAGGED_OTHER_MSG {
   2179     DWORD dwBodyPartID;
   2180     LPSTR pszObjId;
   2181     CRYPT_OBJID_BLOB Value;
   2182   } CMC_TAGGED_OTHER_MSG,*PCMC_TAGGED_OTHER_MSG;
   2183 
   2184   typedef struct _CMC_DATA_INFO {
   2185     DWORD cTaggedAttribute;
   2186     PCMC_TAGGED_ATTRIBUTE rgTaggedAttribute;
   2187     DWORD cTaggedRequest;
   2188     PCMC_TAGGED_REQUEST rgTaggedRequest;
   2189     DWORD cTaggedContentInfo;
   2190     PCMC_TAGGED_CONTENT_INFO rgTaggedContentInfo;
   2191     DWORD cTaggedOtherMsg;
   2192     PCMC_TAGGED_OTHER_MSG rgTaggedOtherMsg;
   2193   } CMC_DATA_INFO,*PCMC_DATA_INFO;
   2194 
   2195   typedef struct _CMC_RESPONSE_INFO {
   2196     DWORD cTaggedAttribute;
   2197     PCMC_TAGGED_ATTRIBUTE rgTaggedAttribute;
   2198     DWORD cTaggedContentInfo;
   2199     PCMC_TAGGED_CONTENT_INFO rgTaggedContentInfo;
   2200     DWORD cTaggedOtherMsg;
   2201     PCMC_TAGGED_OTHER_MSG rgTaggedOtherMsg;
   2202   } CMC_RESPONSE_INFO,*PCMC_RESPONSE_INFO;
   2203 
   2204   typedef struct _CMC_PEND_INFO {
   2205     CRYPT_DATA_BLOB PendToken;
   2206     FILETIME PendTime;
   2207   } CMC_PEND_INFO,*PCMC_PEND_INFO;
   2208 
   2209   typedef struct _CMC_STATUS_INFO {
   2210     DWORD dwStatus;
   2211     DWORD cBodyList;
   2212     DWORD *rgdwBodyList;
   2213     LPWSTR pwszStatusString;
   2214     DWORD dwOtherInfoChoice;
   2215     __C89_NAMELESS union {
   2216       DWORD dwFailInfo;
   2217       PCMC_PEND_INFO pPendInfo;
   2218     };
   2219   } CMC_STATUS_INFO,*PCMC_STATUS_INFO;
   2220 
   2221 #define CMC_OTHER_INFO_NO_CHOICE 0
   2222 #define CMC_OTHER_INFO_FAIL_CHOICE 1
   2223 #define CMC_OTHER_INFO_PEND_CHOICE 2
   2224 
   2225 #define CMC_STATUS_SUCCESS 0
   2226 #define CMC_STATUS_FAILED 2
   2227 #define CMC_STATUS_PENDING 3
   2228 #define CMC_STATUS_NO_SUPPORT 4
   2229 #define CMC_STATUS_CONFIRM_REQUIRED 5
   2230 
   2231 #define CMC_FAIL_BAD_ALG 0
   2232 #define CMC_FAIL_BAD_MESSAGE_CHECK 1
   2233 #define CMC_FAIL_BAD_REQUEST 2
   2234 #define CMC_FAIL_BAD_TIME 3
   2235 #define CMC_FAIL_BAD_CERT_ID 4
   2236 #define CMC_FAIL_UNSUPORTED_EXT 5
   2237 #define CMC_FAIL_MUST_ARCHIVE_KEYS 6
   2238 #define CMC_FAIL_BAD_IDENTITY 7
   2239 #define CMC_FAIL_POP_REQUIRED 8
   2240 #define CMC_FAIL_POP_FAILED 9
   2241 #define CMC_FAIL_NO_KEY_REUSE 10
   2242 #define CMC_FAIL_INTERNAL_CA_ERROR 11
   2243 #define CMC_FAIL_TRY_LATER 12
   2244 
   2245   typedef struct _CMC_ADD_EXTENSIONS_INFO {
   2246     DWORD dwCmcDataReference;
   2247     DWORD cCertReference;
   2248     DWORD *rgdwCertReference;
   2249     DWORD cExtension;
   2250     PCERT_EXTENSION rgExtension;
   2251   } CMC_ADD_EXTENSIONS_INFO,*PCMC_ADD_EXTENSIONS_INFO;
   2252 
   2253   typedef struct _CMC_ADD_ATTRIBUTES_INFO {
   2254     DWORD dwCmcDataReference;
   2255     DWORD cCertReference;
   2256     DWORD *rgdwCertReference;
   2257     DWORD cAttribute;
   2258     PCRYPT_ATTRIBUTE rgAttribute;
   2259   } CMC_ADD_ATTRIBUTES_INFO,*PCMC_ADD_ATTRIBUTES_INFO;
   2260 
   2261   typedef struct _CERT_TEMPLATE_EXT {
   2262     LPSTR pszObjId;
   2263     DWORD dwMajorVersion;
   2264     WINBOOL fMinorVersion;
   2265     DWORD dwMinorVersion;
   2266   } CERT_TEMPLATE_EXT,*PCERT_TEMPLATE_EXT;
   2267 
   2268   typedef struct _CERT_HASHED_URL {
   2269     CRYPT_ALGORITHM_IDENTIFIER HashAlgorithm;
   2270     CRYPT_HASH_BLOB Hash;
   2271     LPWSTR pwszUrl;
   2272   } CERT_HASHED_URL,*PCERT_HASHED_URL;
   2273 
   2274   typedef struct _CERT_LOGOTYPE_DETAILS {
   2275     LPWSTR pwszMimeType;
   2276     DWORD cHashedUrl;
   2277     PCERT_HASHED_URL rgHashedUrl;
   2278   } CERT_LOGOTYPE_DETAILS,*PCERT_LOGOTYPE_DETAILS;
   2279 
   2280   typedef struct _CERT_LOGOTYPE_REFERENCE {
   2281     DWORD cHashedUrl;
   2282     PCERT_HASHED_URL rgHashedUrl;
   2283   } CERT_LOGOTYPE_REFERENCE,*PCERT_LOGOTYPE_REFERENCE;
   2284 
   2285   typedef struct _CERT_LOGOTYPE_IMAGE_INFO {
   2286     DWORD dwLogotypeImageInfoChoice;
   2287     DWORD dwFileSize;
   2288     DWORD dwXSize;
   2289     DWORD dwYSize;
   2290     DWORD dwLogotypeImageResolutionChoice;
   2291     __C89_NAMELESS union {
   2292       DWORD dwNumBits;
   2293       DWORD dwTableSize;
   2294     };
   2295     LPWSTR pwszLanguage;
   2296   } CERT_LOGOTYPE_IMAGE_INFO,*PCERT_LOGOTYPE_IMAGE_INFO;
   2297 
   2298 #define CERT_LOGOTYPE_GRAY_SCALE_IMAGE_INFO_CHOICE 1
   2299 #define CERT_LOGOTYPE_COLOR_IMAGE_INFO_CHOICE 2
   2300 
   2301 #define CERT_LOGOTYPE_NO_IMAGE_RESOLUTION_CHOICE 0
   2302 #define CERT_LOGOTYPE_BITS_IMAGE_RESOLUTION_CHOICE 1
   2303 #define CERT_LOGOTYPE_TABLE_SIZE_IMAGE_RESOLUTION_CHOICE 2
   2304 
   2305   typedef struct _CERT_LOGOTYPE_IMAGE {
   2306     CERT_LOGOTYPE_DETAILS LogotypeDetails;
   2307     PCERT_LOGOTYPE_IMAGE_INFO pLogotypeImageInfo;
   2308   } CERT_LOGOTYPE_IMAGE,*PCERT_LOGOTYPE_IMAGE;
   2309 
   2310   typedef struct _CERT_LOGOTYPE_AUDIO_INFO {
   2311     DWORD dwFileSize;
   2312     DWORD dwPlayTime;
   2313     DWORD dwChannels;
   2314     DWORD dwSampleRate;
   2315     LPWSTR pwszLanguage;
   2316   } CERT_LOGOTYPE_AUDIO_INFO,*PCERT_LOGOTYPE_AUDIO_INFO;
   2317 
   2318   typedef struct _CERT_LOGOTYPE_AUDIO {
   2319     CERT_LOGOTYPE_DETAILS LogotypeDetails;
   2320     PCERT_LOGOTYPE_AUDIO_INFO pLogotypeAudioInfo;
   2321   } CERT_LOGOTYPE_AUDIO,*PCERT_LOGOTYPE_AUDIO;
   2322 
   2323   typedef struct _CERT_LOGOTYPE_DATA {
   2324     DWORD cLogotypeImage;
   2325     PCERT_LOGOTYPE_IMAGE rgLogotypeImage;
   2326     DWORD cLogotypeAudio;
   2327     PCERT_LOGOTYPE_AUDIO rgLogotypeAudio;
   2328   } CERT_LOGOTYPE_DATA,*PCERT_LOGOTYPE_DATA;
   2329 
   2330   typedef struct _CERT_LOGOTYPE_INFO {
   2331     DWORD dwLogotypeInfoChoice;
   2332     __C89_NAMELESS union {
   2333       PCERT_LOGOTYPE_DATA pLogotypeDirectInfo;
   2334       PCERT_LOGOTYPE_REFERENCE pLogotypeIndirectInfo;
   2335     };
   2336   } CERT_LOGOTYPE_INFO,*PCERT_LOGOTYPE_INFO;
   2337 
   2338 #define CERT_LOGOTYPE_DIRECT_INFO_CHOICE 1
   2339 #define CERT_LOGOTYPE_INDIRECT_INFO_CHOICE 2
   2340 
   2341   typedef struct _CERT_OTHER_LOGOTYPE_INFO {
   2342     LPSTR pszObjId;
   2343     CERT_LOGOTYPE_INFO LogotypeInfo;
   2344   } CERT_OTHER_LOGOTYPE_INFO,*PCERT_OTHER_LOGOTYPE_INFO;
   2345 
   2346 #define szOID_LOYALTY_OTHER_LOGOTYPE "1.3.6.1.5.5.7.20.1"
   2347 #define szOID_BACKGROUND_OTHER_LOGOTYPE "1.3.6.1.5.5.7.20.2"
   2348 
   2349   typedef struct _CERT_LOGOTYPE_EXT_INFO {
   2350     DWORD cCommunityLogo;
   2351     PCERT_LOGOTYPE_INFO rgCommunityLogo;
   2352     PCERT_LOGOTYPE_INFO pIssuerLogo;
   2353     PCERT_LOGOTYPE_INFO pSubjectLogo;
   2354     DWORD cOtherLogo;
   2355     PCERT_OTHER_LOGOTYPE_INFO rgOtherLogo;
   2356   } CERT_LOGOTYPE_EXT_INFO,*PCERT_LOGOTYPE_EXT_INFO;
   2357 
   2358   typedef struct _CERT_BIOMETRIC_DATA {
   2359     DWORD dwTypeOfBiometricDataChoice;
   2360     __C89_NAMELESS union {
   2361       DWORD dwPredefined;
   2362       LPSTR pszObjId;
   2363     };
   2364     CERT_HASHED_URL HashedUrl;
   2365   } CERT_BIOMETRIC_DATA,*PCERT_BIOMETRIC_DATA;
   2366 
   2367 #define CERT_BIOMETRIC_PREDEFINED_DATA_CHOICE 1
   2368 #define CERT_BIOMETRIC_OID_DATA_CHOICE 2
   2369 
   2370 #define CERT_BIOMETRIC_PICTURE_TYPE 0
   2371 #define CERT_BIOMETRIC_SIGNATURE_TYPE 1
   2372 
   2373   typedef struct _CERT_BIOMETRIC_EXT_INFO {
   2374     DWORD cBiometricData;
   2375     PCERT_BIOMETRIC_DATA rgBiometricData;
   2376   } CERT_BIOMETRIC_EXT_INFO,*PCERT_BIOMETRIC_EXT_INFO;
   2377 
   2378   typedef struct _OCSP_SIGNATURE_INFO {
   2379     CRYPT_ALGORITHM_IDENTIFIER SignatureAlgorithm;
   2380     CRYPT_BIT_BLOB Signature;
   2381     DWORD cCertEncoded;
   2382     PCERT_BLOB rgCertEncoded;
   2383   } OCSP_SIGNATURE_INFO,*POCSP_SIGNATURE_INFO;
   2384 
   2385   typedef struct _OCSP_SIGNED_REQUEST_INFO {
   2386     CRYPT_DER_BLOB ToBeSigned;
   2387     POCSP_SIGNATURE_INFO pOptionalSignatureInfo;
   2388   } OCSP_SIGNED_REQUEST_INFO,*POCSP_SIGNED_REQUEST_INFO;
   2389 
   2390   typedef struct _OCSP_CERT_ID {
   2391     CRYPT_ALGORITHM_IDENTIFIER HashAlgorithm;
   2392     CRYPT_HASH_BLOB IssuerNameHash;
   2393     CRYPT_HASH_BLOB IssuerKeyHash;
   2394     CRYPT_INTEGER_BLOB SerialNumber;
   2395   } OCSP_CERT_ID,*POCSP_CERT_ID;
   2396 
   2397   typedef struct _OCSP_REQUEST_ENTRY {
   2398     OCSP_CERT_ID CertId;
   2399     DWORD cExtension;
   2400     PCERT_EXTENSION rgExtension;
   2401   } OCSP_REQUEST_ENTRY,*POCSP_REQUEST_ENTRY;
   2402 
   2403   typedef struct _OCSP_REQUEST_INFO {
   2404     DWORD dwVersion;
   2405     PCERT_ALT_NAME_ENTRY pRequestorName;
   2406     DWORD cRequestEntry;
   2407     POCSP_REQUEST_ENTRY rgRequestEntry;
   2408     DWORD cExtension;
   2409     PCERT_EXTENSION rgExtension;
   2410   } OCSP_REQUEST_INFO,*POCSP_REQUEST_INFO;
   2411 
   2412 #define OCSP_REQUEST_V1 0
   2413 
   2414   typedef struct _OCSP_RESPONSE_INFO {
   2415     DWORD dwStatus;
   2416     LPSTR pszObjId;
   2417     CRYPT_OBJID_BLOB Value;
   2418   } OCSP_RESPONSE_INFO,*POCSP_RESPONSE_INFO;
   2419 
   2420 #define OCSP_SUCCESSFUL_RESPONSE 0
   2421 #define OCSP_MALFORMED_REQUEST_RESPONSE 1
   2422 #define OCSP_INTERNAL_ERROR_RESPONSE 2
   2423 #define OCSP_TRY_LATER_RESPONSE 3
   2424 #define OCSP_SIG_REQUIRED_RESPONSE 5
   2425 #define OCSP_UNAUTHORIZED_RESPONSE 6
   2426 
   2427 #define szOID_PKIX_OCSP_BASIC_SIGNED_RESPONSE "1.3.6.1.5.5.7.48.1.1"
   2428 
   2429   typedef struct _OCSP_BASIC_SIGNED_RESPONSE_INFO {
   2430     CRYPT_DER_BLOB ToBeSigned;
   2431     OCSP_SIGNATURE_INFO SignatureInfo;
   2432   } OCSP_BASIC_SIGNED_RESPONSE_INFO,*POCSP_BASIC_SIGNED_RESPONSE_INFO;
   2433 
   2434   typedef struct _OCSP_BASIC_REVOKED_INFO {
   2435     FILETIME RevocationDate;
   2436     DWORD dwCrlReasonCode;
   2437   } OCSP_BASIC_REVOKED_INFO,*POCSP_BASIC_REVOKED_INFO;
   2438 
   2439   typedef struct _OCSP_BASIC_RESPONSE_ENTRY {
   2440     OCSP_CERT_ID CertId;
   2441     DWORD dwCertStatus;
   2442     __C89_NAMELESS union {
   2443       POCSP_BASIC_REVOKED_INFO pRevokedInfo;
   2444     };
   2445     FILETIME ThisUpdate;
   2446     FILETIME NextUpdate;
   2447     DWORD cExtension;
   2448     PCERT_EXTENSION rgExtension;
   2449   } OCSP_BASIC_RESPONSE_ENTRY,*POCSP_BASIC_RESPONSE_ENTRY;
   2450 
   2451 #define OCSP_BASIC_GOOD_CERT_STATUS 0
   2452 #define OCSP_BASIC_REVOKED_CERT_STATUS 1
   2453 #define OCSP_BASIC_UNKNOWN_CERT_STATUS 2
   2454 
   2455   typedef struct _OCSP_BASIC_RESPONSE_INFO {
   2456     DWORD dwVersion;
   2457     DWORD dwResponderIdChoice;
   2458     __C89_NAMELESS union {
   2459       CERT_NAME_BLOB ByNameResponderId;
   2460       CRYPT_HASH_BLOB ByKeyResponderId;
   2461     };
   2462     FILETIME ProducedAt;
   2463     DWORD cResponseEntry;
   2464     POCSP_BASIC_RESPONSE_ENTRY rgResponseEntry;
   2465     DWORD cExtension;
   2466     PCERT_EXTENSION rgExtension;
   2467   } OCSP_BASIC_RESPONSE_INFO,*POCSP_BASIC_RESPONSE_INFO;
   2468 
   2469 #define OCSP_BASIC_RESPONSE_V1 0
   2470 #define OCSP_BASIC_BY_NAME_RESPONDER_ID 1
   2471 #define OCSP_BASIC_BY_KEY_RESPONDER_ID 2
   2472 
   2473   typedef void *HCRYPTOIDFUNCSET;
   2474   typedef void *HCRYPTOIDFUNCADDR;
   2475 
   2476 #define CRYPT_OID_ENCODE_OBJECT_FUNC "CryptDllEncodeObject"
   2477 #define CRYPT_OID_DECODE_OBJECT_FUNC "CryptDllDecodeObject"
   2478 #define CRYPT_OID_ENCODE_OBJECT_EX_FUNC "CryptDllEncodeObjectEx"
   2479 #define CRYPT_OID_DECODE_OBJECT_EX_FUNC "CryptDllDecodeObjectEx"
   2480 #define CRYPT_OID_CREATE_COM_OBJECT_FUNC "CryptDllCreateCOMObject"
   2481 #define CRYPT_OID_VERIFY_REVOCATION_FUNC "CertDllVerifyRevocation"
   2482 #define CRYPT_OID_VERIFY_CTL_USAGE_FUNC "CertDllVerifyCTLUsage"
   2483 #define CRYPT_OID_FORMAT_OBJECT_FUNC "CryptDllFormatObject"
   2484 #define CRYPT_OID_FIND_OID_INFO_FUNC "CryptDllFindOIDInfo"
   2485 #define CRYPT_OID_FIND_LOCALIZED_NAME_FUNC "CryptDllFindLocalizedName"
   2486 
   2487 #define CRYPT_OID_REGPATH "Software\\Microsoft\\Cryptography\\OID"
   2488 #define CRYPT_OID_REG_ENCODING_TYPE_PREFIX "EncodingType "
   2489 #define CRYPT_OID_REG_DLL_VALUE_NAME L"Dll"
   2490 #define CRYPT_OID_REG_FUNC_NAME_VALUE_NAME L"FuncName"
   2491 #define CRYPT_OID_REG_FUNC_NAME_VALUE_NAME_A "FuncName"
   2492 
   2493 #define CRYPT_OID_REG_FLAGS_VALUE_NAME L"CryptFlags"
   2494 
   2495 #define CRYPT_DEFAULT_OID "DEFAULT"
   2496 
   2497   typedef struct _CRYPT_OID_FUNC_ENTRY {
   2498     LPCSTR pszOID;
   2499     void *pvFuncAddr;
   2500   } CRYPT_OID_FUNC_ENTRY,*PCRYPT_OID_FUNC_ENTRY;
   2501 
   2502 #define CRYPT_INSTALL_OID_FUNC_BEFORE_FLAG 1
   2503 #define CRYPT_GET_INSTALLED_OID_FUNC_FLAG 0x1
   2504 
   2505 #define CRYPT_REGISTER_FIRST_INDEX 0
   2506 #define CRYPT_REGISTER_LAST_INDEX 0xffffffff
   2507 
   2508   WINIMPM WINBOOL WINAPI CryptInstallOIDFunctionAddress (HMODULE hModule, DWORD dwEncodingType, LPCSTR pszFuncName, DWORD cFuncEntry, const CRYPT_OID_FUNC_ENTRY rgFuncEntry[], DWORD dwFlags);
   2509   WINIMPM HCRYPTOIDFUNCSET WINAPI CryptInitOIDFunctionSet (LPCSTR pszFuncName, DWORD dwFlags);
   2510   WINIMPM WINBOOL WINAPI CryptGetOIDFunctionAddress (HCRYPTOIDFUNCSET hFuncSet, DWORD dwEncodingType, LPCSTR pszOID, DWORD dwFlags, void **ppvFuncAddr, HCRYPTOIDFUNCADDR *phFuncAddr);
   2511   WINIMPM WINBOOL WINAPI CryptGetDefaultOIDDllList (HCRYPTOIDFUNCSET hFuncSet, DWORD dwEncodingType, WCHAR *pwszDllList, DWORD *pcchDllList);
   2512   WINIMPM WINBOOL WINAPI CryptGetDefaultOIDFunctionAddress (HCRYPTOIDFUNCSET hFuncSet, DWORD dwEncodingType, LPCWSTR pwszDll, DWORD dwFlags, void **ppvFuncAddr, HCRYPTOIDFUNCADDR *phFuncAddr);
   2513   WINIMPM WINBOOL WINAPI CryptFreeOIDFunctionAddress (HCRYPTOIDFUNCADDR hFuncAddr, DWORD dwFlags);
   2514   WINIMPM WINBOOL WINAPI CryptRegisterOIDFunction (DWORD dwEncodingType, LPCSTR pszFuncName, LPCSTR pszOID, LPCWSTR pwszDll, LPCSTR pszOverrideFuncName);
   2515   WINIMPM WINBOOL WINAPI CryptUnregisterOIDFunction (DWORD dwEncodingType, LPCSTR pszFuncName, LPCSTR pszOID);
   2516   WINIMPM WINBOOL WINAPI CryptRegisterDefaultOIDFunction (DWORD dwEncodingType, LPCSTR pszFuncName, DWORD dwIndex, LPCWSTR pwszDll);
   2517   WINIMPM WINBOOL WINAPI CryptUnregisterDefaultOIDFunction (DWORD dwEncodingType, LPCSTR pszFuncName, LPCWSTR pwszDll);
   2518   WINIMPM WINBOOL WINAPI CryptSetOIDFunctionValue (DWORD dwEncodingType, LPCSTR pszFuncName, LPCSTR pszOID, LPCWSTR pwszValueName, DWORD dwValueType, const BYTE *pbValueData, DWORD cbValueData);
   2519   WINIMPM WINBOOL WINAPI CryptGetOIDFunctionValue (DWORD dwEncodingType, LPCSTR pszFuncName, LPCSTR pszOID, LPCWSTR pwszValueName, DWORD *pdwValueType, BYTE *pbValueData, DWORD *pcbValueData);
   2520 
   2521   typedef WINBOOL (WINAPI *PFN_CRYPT_ENUM_OID_FUNC) (DWORD dwEncodingType, LPCSTR pszFuncName, LPCSTR pszOID, DWORD cValue, const DWORD rgdwValueType[], LPCWSTR const rgpwszValueName[], const BYTE *const rgpbValueData[], const DWORD rgcbValueData[], void *pvArg);
   2522 
   2523   WINIMPM WINBOOL WINAPI CryptEnumOIDFunction (DWORD dwEncodingType, LPCSTR pszFuncName, LPCSTR pszOID, DWORD dwFlags, void *pvArg, PFN_CRYPT_ENUM_OID_FUNC pfnEnumOIDFunc);
   2524 
   2525 #define CRYPT_MATCH_ANY_ENCODING_TYPE 0xffffffff
   2526 #define CALG_OID_INFO_CNG_ONLY 0xffffffff
   2527 #define CALG_OID_INFO_PARAMETERS 0xfffffffe
   2528 #define IS_SPECIAL_OID_INFO_ALGID(Algid) (Algid >= CALG_OID_INFO_PARAMETERS)
   2529 
   2530 #define CRYPT_OID_INFO_HASH_PARAMETERS_ALGORITHM L"CryptOIDInfoHashParameters"
   2531 #define CRYPT_OID_INFO_ECC_PARAMETERS_ALGORITHM L"CryptOIDInfoECCParameters"
   2532 #define CRYPT_OID_INFO_MGF1_PARAMETERS_ALGORITHM L"CryptOIDInfoMgf1Parameters"
   2533 #define CRYPT_OID_INFO_NO_SIGN_ALGORITHM L"CryptOIDInfoNoSign"
   2534 #define CRYPT_OID_INFO_OAEP_PARAMETERS_ALGORITHM L"CryptOIDInfoOAEPParameters"
   2535 #define CRYPT_OID_INFO_ECC_WRAP_PARAMETERS_ALGORITHM L"CryptOIDInfoECCWrapParameters"
   2536 #define CRYPT_OID_INFO_NO_PARAMETERS_ALGORITHM L"CryptOIDInfoNoParameters"
   2537 
   2538   typedef struct _CRYPT_OID_INFO {
   2539     DWORD cbSize;
   2540     LPCSTR pszOID;
   2541     LPCWSTR pwszName;
   2542     DWORD dwGroupId;
   2543     __C89_NAMELESS union {
   2544       DWORD dwValue;
   2545       ALG_ID Algid;
   2546       DWORD dwLength;
   2547     };
   2548     CRYPT_DATA_BLOB ExtraInfo;
   2549 #ifdef CRYPT_OID_INFO_HAS_EXTRA_FIELDS
   2550     LPCWSTR pwszCNGAlgid;
   2551     LPCWSTR pwszCNGExtraAlgid;
   2552 #endif
   2553   } CRYPT_OID_INFO,*PCRYPT_OID_INFO;
   2554 
   2555   typedef const CRYPT_OID_INFO CCRYPT_OID_INFO,*PCCRYPT_OID_INFO;
   2556 
   2557 #define CRYPT_HASH_ALG_OID_GROUP_ID 1
   2558 #define CRYPT_ENCRYPT_ALG_OID_GROUP_ID 2
   2559 #define CRYPT_PUBKEY_ALG_OID_GROUP_ID 3
   2560 #define CRYPT_SIGN_ALG_OID_GROUP_ID 4
   2561 #define CRYPT_RDN_ATTR_OID_GROUP_ID 5
   2562 #define CRYPT_EXT_OR_ATTR_OID_GROUP_ID 6
   2563 #define CRYPT_ENHKEY_USAGE_OID_GROUP_ID 7
   2564 #define CRYPT_POLICY_OID_GROUP_ID 8
   2565 #define CRYPT_TEMPLATE_OID_GROUP_ID 9
   2566 #define CRYPT_KDF_OID_GROUP_ID 10
   2567 #define CRYPT_LAST_OID_GROUP_ID 10
   2568 
   2569 #define CRYPT_FIRST_ALG_OID_GROUP_ID CRYPT_HASH_ALG_OID_GROUP_ID
   2570 #define CRYPT_LAST_ALG_OID_GROUP_ID CRYPT_SIGN_ALG_OID_GROUP_ID
   2571 
   2572 #define CRYPT_OID_INHIBIT_SIGNATURE_FORMAT_FLAG 0x1
   2573 #define CRYPT_OID_USE_PUBKEY_PARA_FOR_PKCS7_FLAG 0x2
   2574 #define CRYPT_OID_NO_NULL_ALGORITHM_PARA_FLAG 0x4
   2575 
   2576 #define CRYPT_OID_PUBKEY_ENCRYPT_ONLY_FLAG 0x40000000
   2577 #define CRYPT_OID_PUBKEY_SIGN_ONLY_FLAG 0x80000000
   2578 
   2579   WINIMPM PCCRYPT_OID_INFO WINAPI CryptFindOIDInfo (DWORD dwKeyType, void *pvKey, DWORD dwGroupId);
   2580 
   2581 #define CRYPT_OID_INFO_OID_KEY 1
   2582 #define CRYPT_OID_INFO_NAME_KEY 2
   2583 #define CRYPT_OID_INFO_ALGID_KEY 3
   2584 #define CRYPT_OID_INFO_SIGN_KEY 4
   2585 #define CRYPT_OID_INFO_CNG_ALGID_KEY 5
   2586 #define CRYPT_OID_INFO_CNG_SIGN_KEY 6
   2587 
   2588 #define CRYPT_OID_INFO_OID_KEY_FLAGS_MASK 0xffff0000
   2589 #define CRYPT_OID_INFO_PUBKEY_SIGN_KEY_FLAG 0x80000000
   2590 #define CRYPT_OID_INFO_PUBKEY_ENCRYPT_KEY_FLAG 0x40000000
   2591 
   2592 #define CRYPT_OID_DISABLE_SEARCH_DS_FLAG 0x80000000
   2593 
   2594 #ifdef CRYPT_OID_INFO_HAS_EXTRA_FIELDS
   2595 #define CRYPT_OID_PREFER_CNG_ALGID_FLAG 0x40000000
   2596 #endif
   2597 
   2598 #define CRYPT_OID_INFO_OID_GROUP_BIT_LEN_MASK 0x0fff0000
   2599 #define CRYPT_OID_INFO_OID_GROUP_BIT_LEN_SHIFT 16
   2600 
   2601 #define CRYPT_INSTALL_OID_INFO_BEFORE_FLAG 1
   2602 
   2603   typedef WINBOOL (WINAPI *PFN_CRYPT_ENUM_OID_INFO) (PCCRYPT_OID_INFO pInfo, void *pvArg);
   2604 
   2605   WINIMPM WINBOOL WINAPI CryptRegisterOIDInfo (PCCRYPT_OID_INFO pInfo, DWORD dwFlags);
   2606   WINIMPM WINBOOL WINAPI CryptUnregisterOIDInfo (PCCRYPT_OID_INFO pInfo);
   2607   WINIMPM WINBOOL WINAPI CryptEnumOIDInfo (DWORD dwGroupId, DWORD dwFlags, void *pvArg, PFN_CRYPT_ENUM_OID_INFO pfnEnumOIDInfo);
   2608   WINIMPM LPCWSTR WINAPI CryptFindLocalizedName (LPCWSTR pwszCryptName);
   2609 
   2610 #define CRYPT_LOCALIZED_NAME_ENCODING_TYPE 0
   2611 #define CRYPT_LOCALIZED_NAME_OID "LocalizedNames"
   2612 
   2613 #define CERT_STRONG_SIGN_ECDSA_ALGORITHM L"ECDSA"
   2614 
   2615   typedef struct _CERT_STRONG_SIGN_SERIALIZED_INFO {
   2616     DWORD dwFlags;
   2617     LPWSTR pwszCNGSignHashAlgids;
   2618     LPWSTR pwszCNGPubKeyMinBitLengths;
   2619   } CERT_STRONG_SIGN_SERIALIZED_INFO,*PCERT_STRONG_SIGN_SERIALIZED_INFO;
   2620 
   2621   typedef struct _CERT_STRONG_SIGN_PARA {
   2622     DWORD cbSize;
   2623     DWORD dwInfoChoice;
   2624     __C89_NAMELESS union {
   2625       void *pvInfo;
   2626       PCERT_STRONG_SIGN_SERIALIZED_INFO pSerializedInfo;
   2627       LPSTR pszOID;
   2628     };
   2629   } CERT_STRONG_SIGN_PARA,*PCERT_STRONG_SIGN_PARA;
   2630 
   2631   typedef const CERT_STRONG_SIGN_PARA *PCCERT_STRONG_SIGN_PARA;
   2632 
   2633 #define CERT_STRONG_SIGN_SERIALIZED_INFO_CHOICE 1
   2634 #define CERT_STRONG_SIGN_OID_INFO_CHOICE 2
   2635 
   2636 #define CERT_STRONG_SIGN_ENABLE_CRL_CHECK 0x1
   2637 #define CERT_STRONG_SIGN_ENABLE_OCSP_CHECK 0x2
   2638 
   2639 #define szOID_CERT_STRONG_SIGN_OS_PREFIX "1.3.6.1.4.1.311.72.1."
   2640 
   2641 #define szOID_CERT_STRONG_SIGN_OS_1 "1.3.6.1.4.1.311.72.1.1"
   2642 #define szOID_CERT_STRONG_SIGN_OS_CURRENT szOID_CERT_STRONG_SIGN_OS_1
   2643 
   2644 #define CERT_STRONG_SIGN_PARA_OS_1 { sizeof (CERT_STRONG_SIGN_PARA), CERT_STRONG_SIGN_OID_INFO_CHOICE, szOID_CERT_STRONG_SIGN_OS_1 }
   2645 #define CERT_STRONG_SIGN_PARA_OS_CURRENT { sizeof (CERT_STRONG_SIGN_PARA), CERT_STRONG_SIGN_OID_INFO_CHOICE, szOID_CERT_STRONG_SIGN_OS_CURRENT }
   2646 
   2647 #define szOID_CERT_STRONG_KEY_OS_PREFIX "1.3.6.1.4.1.311.72.2."
   2648 #define szOID_CERT_STRONG_KEY_OS_1 "1.3.6.1.4.1.311.72.2.1"
   2649 #define szOID_CERT_STRONG_KEY_OS_CURRENT szOID_CERT_STRONG_KEY_OS_1
   2650 
   2651 #define CERT_STRONG_KEY_PARA_OS_1 { sizeof (CERT_STRONG_SIGN_PARA), CERT_STRONG_SIGN_OID_INFO_CHOICE, szOID_CERT_STRONG_KEY_OS_1 }
   2652 #define CERT_STRONG_KEY_PARA_OS_CURRENT { sizeof (CERT_STRONG_SIGN_PARA), CERT_STRONG_SIGN_OID_INFO_CHOICE, szOID_CERT_STRONG_KEY_OS_CURRENT }
   2653 
   2654   typedef void *HCRYPTMSG;
   2655 
   2656 #define szOID_PKCS_7_DATA "1.2.840.113549.1.7.1"
   2657 #define szOID_PKCS_7_SIGNED "1.2.840.113549.1.7.2"
   2658 #define szOID_PKCS_7_ENVELOPED "1.2.840.113549.1.7.3"
   2659 #define szOID_PKCS_7_SIGNEDANDENVELOPED "1.2.840.113549.1.7.4"
   2660 #define szOID_PKCS_7_DIGESTED "1.2.840.113549.1.7.5"
   2661 #define szOID_PKCS_7_ENCRYPTED "1.2.840.113549.1.7.6"
   2662 
   2663 #define szOID_PKCS_9_CONTENT_TYPE "1.2.840.113549.1.9.3"
   2664 #define szOID_PKCS_9_MESSAGE_DIGEST "1.2.840.113549.1.9.4"
   2665 
   2666 #define CMSG_DATA 1
   2667 #define CMSG_SIGNED 2
   2668 #define CMSG_ENVELOPED 3
   2669 #define CMSG_SIGNED_AND_ENVELOPED 4
   2670 #define CMSG_HASHED 5
   2671 #define CMSG_ENCRYPTED 6
   2672 
   2673 #define CMSG_ALL_FLAGS (~__MSABI_LONG(0U))
   2674 #define CMSG_DATA_FLAG (1 << CMSG_DATA)
   2675 #define CMSG_SIGNED_FLAG (1 << CMSG_SIGNED)
   2676 #define CMSG_ENVELOPED_FLAG (1 << CMSG_ENVELOPED)
   2677 #define CMSG_SIGNED_AND_ENVELOPED_FLAG (1 << CMSG_SIGNED_AND_ENVELOPED)
   2678 #define CMSG_HASHED_FLAG (1 << CMSG_HASHED)
   2679 #define CMSG_ENCRYPTED_FLAG (1 << CMSG_ENCRYPTED)
   2680 
   2681   typedef struct _CERT_ISSUER_SERIAL_NUMBER {
   2682     CERT_NAME_BLOB Issuer;
   2683     CRYPT_INTEGER_BLOB SerialNumber;
   2684   } CERT_ISSUER_SERIAL_NUMBER,*PCERT_ISSUER_SERIAL_NUMBER;
   2685 
   2686   typedef struct _CERT_ID {
   2687     DWORD dwIdChoice;
   2688     __C89_NAMELESS union {
   2689       CERT_ISSUER_SERIAL_NUMBER IssuerSerialNumber;
   2690       CRYPT_HASH_BLOB KeyId;
   2691       CRYPT_HASH_BLOB HashId;
   2692     };
   2693   } CERT_ID,*PCERT_ID;
   2694 
   2695 #define CERT_ID_ISSUER_SERIAL_NUMBER 1
   2696 #define CERT_ID_KEY_IDENTIFIER 2
   2697 #define CERT_ID_SHA1_HASH 3
   2698 
   2699   typedef struct _CMSG_SIGNER_ENCODE_INFO {
   2700     DWORD cbSize;
   2701     PCERT_INFO pCertInfo;
   2702     __C89_NAMELESS union {
   2703       HCRYPTPROV hCryptProv;
   2704       NCRYPT_KEY_HANDLE hNCryptKey;
   2705     };
   2706     DWORD dwKeySpec;
   2707     CRYPT_ALGORITHM_IDENTIFIER HashAlgorithm;
   2708     void *pvHashAuxInfo;
   2709     DWORD cAuthAttr;
   2710     PCRYPT_ATTRIBUTE rgAuthAttr;
   2711     DWORD cUnauthAttr;
   2712     PCRYPT_ATTRIBUTE rgUnauthAttr;
   2713 #ifdef CMSG_SIGNER_ENCODE_INFO_HAS_CMS_FIELDS
   2714     CERT_ID SignerId;
   2715     CRYPT_ALGORITHM_IDENTIFIER HashEncryptionAlgorithm;
   2716     void *pvHashEncryptionAuxInfo;
   2717 #endif
   2718   } CMSG_SIGNER_ENCODE_INFO,*PCMSG_SIGNER_ENCODE_INFO;
   2719 
   2720   typedef struct _CMSG_SIGNED_ENCODE_INFO {
   2721     DWORD cbSize;
   2722     DWORD cSigners;
   2723     PCMSG_SIGNER_ENCODE_INFO rgSigners;
   2724     DWORD cCertEncoded;
   2725     PCERT_BLOB rgCertEncoded;
   2726     DWORD cCrlEncoded;
   2727     PCRL_BLOB rgCrlEncoded;
   2728 #ifdef CMSG_SIGNED_ENCODE_INFO_HAS_CMS_FIELDS
   2729     DWORD cAttrCertEncoded;
   2730     PCERT_BLOB rgAttrCertEncoded;
   2731 #endif
   2732   } CMSG_SIGNED_ENCODE_INFO,*PCMSG_SIGNED_ENCODE_INFO;
   2733 
   2734   typedef struct _CMSG_RECIPIENT_ENCODE_INFO CMSG_RECIPIENT_ENCODE_INFO,*PCMSG_RECIPIENT_ENCODE_INFO;
   2735 
   2736   typedef struct _CMSG_ENVELOPED_ENCODE_INFO {
   2737     DWORD cbSize;
   2738     HCRYPTPROV_LEGACY hCryptProv;
   2739     CRYPT_ALGORITHM_IDENTIFIER ContentEncryptionAlgorithm;
   2740     void *pvEncryptionAuxInfo;
   2741     DWORD cRecipients;
   2742     PCERT_INFO *rgpRecipients;
   2743 #ifdef CMSG_ENVELOPED_ENCODE_INFO_HAS_CMS_FIELDS
   2744     PCMSG_RECIPIENT_ENCODE_INFO rgCmsRecipients;
   2745     DWORD cCertEncoded;
   2746     PCERT_BLOB rgCertEncoded;
   2747     DWORD cCrlEncoded;
   2748     PCRL_BLOB rgCrlEncoded;
   2749     DWORD cAttrCertEncoded;
   2750     PCERT_BLOB rgAttrCertEncoded;
   2751     DWORD cUnprotectedAttr;
   2752     PCRYPT_ATTRIBUTE rgUnprotectedAttr;
   2753 #endif
   2754   } CMSG_ENVELOPED_ENCODE_INFO,*PCMSG_ENVELOPED_ENCODE_INFO;
   2755 
   2756   typedef struct _CMSG_KEY_TRANS_RECIPIENT_ENCODE_INFO {
   2757     DWORD cbSize;
   2758     CRYPT_ALGORITHM_IDENTIFIER KeyEncryptionAlgorithm;
   2759     void *pvKeyEncryptionAuxInfo;
   2760     HCRYPTPROV_LEGACY hCryptProv;
   2761     CRYPT_BIT_BLOB RecipientPublicKey;
   2762     CERT_ID RecipientId;
   2763   } CMSG_KEY_TRANS_RECIPIENT_ENCODE_INFO,*PCMSG_KEY_TRANS_RECIPIENT_ENCODE_INFO;
   2764 
   2765   typedef struct _CMSG_RECIPIENT_ENCRYPTED_KEY_ENCODE_INFO {
   2766     DWORD cbSize;
   2767     CRYPT_BIT_BLOB RecipientPublicKey;
   2768     CERT_ID RecipientId;
   2769     FILETIME Date;
   2770     PCRYPT_ATTRIBUTE_TYPE_VALUE pOtherAttr;
   2771   } CMSG_RECIPIENT_ENCRYPTED_KEY_ENCODE_INFO,*PCMSG_RECIPIENT_ENCRYPTED_KEY_ENCODE_INFO;
   2772 
   2773   typedef struct _CMSG_KEY_AGREE_RECIPIENT_ENCODE_INFO {
   2774     DWORD cbSize;
   2775     CRYPT_ALGORITHM_IDENTIFIER KeyEncryptionAlgorithm;
   2776     void *pvKeyEncryptionAuxInfo;
   2777     CRYPT_ALGORITHM_IDENTIFIER KeyWrapAlgorithm;
   2778     void *pvKeyWrapAuxInfo;
   2779     HCRYPTPROV_LEGACY hCryptProv;
   2780     DWORD dwKeySpec;
   2781     DWORD dwKeyChoice;
   2782     __C89_NAMELESS union {
   2783       PCRYPT_ALGORITHM_IDENTIFIER pEphemeralAlgorithm;
   2784       PCERT_ID pSenderId;
   2785     };
   2786     CRYPT_DATA_BLOB UserKeyingMaterial;
   2787     DWORD cRecipientEncryptedKeys;
   2788     PCMSG_RECIPIENT_ENCRYPTED_KEY_ENCODE_INFO *rgpRecipientEncryptedKeys;
   2789   } CMSG_KEY_AGREE_RECIPIENT_ENCODE_INFO,*PCMSG_KEY_AGREE_RECIPIENT_ENCODE_INFO;
   2790 
   2791 #define CMSG_KEY_AGREE_EPHEMERAL_KEY_CHOICE 1
   2792 #define CMSG_KEY_AGREE_STATIC_KEY_CHOICE 2
   2793 
   2794   typedef struct _CMSG_MAIL_LIST_RECIPIENT_ENCODE_INFO {
   2795     DWORD cbSize;
   2796     CRYPT_ALGORITHM_IDENTIFIER KeyEncryptionAlgorithm;
   2797     void *pvKeyEncryptionAuxInfo;
   2798     HCRYPTPROV hCryptProv;
   2799     DWORD dwKeyChoice;
   2800     __C89_NAMELESS union {
   2801       HCRYPTKEY hKeyEncryptionKey;
   2802       void *pvKeyEncryptionKey;
   2803     };
   2804     CRYPT_DATA_BLOB KeyId;
   2805     FILETIME Date;
   2806     PCRYPT_ATTRIBUTE_TYPE_VALUE pOtherAttr;
   2807   } CMSG_MAIL_LIST_RECIPIENT_ENCODE_INFO,*PCMSG_MAIL_LIST_RECIPIENT_ENCODE_INFO;
   2808 
   2809 #define CMSG_MAIL_LIST_HANDLE_KEY_CHOICE 1
   2810 
   2811 #define CMSG_KEY_TRANS_RECIPIENT 1
   2812 #define CMSG_KEY_AGREE_RECIPIENT 2
   2813 #define CMSG_MAIL_LIST_RECIPIENT 3
   2814 
   2815 #define CMSG_RC4_NO_SALT_FLAG 0x40000000
   2816 #define CMSG_SP3_COMPATIBLE_ENCRYPT_FLAG 0x80000000
   2817 
   2818   struct _CMSG_RECIPIENT_ENCODE_INFO {
   2819     DWORD dwRecipientChoice;
   2820     __C89_NAMELESS union {
   2821       PCMSG_KEY_TRANS_RECIPIENT_ENCODE_INFO pKeyTrans;
   2822       PCMSG_KEY_AGREE_RECIPIENT_ENCODE_INFO pKeyAgree;
   2823       PCMSG_MAIL_LIST_RECIPIENT_ENCODE_INFO pMailList;
   2824     };
   2825   };
   2826 
   2827   typedef struct _CMSG_RC2_AUX_INFO {
   2828     DWORD cbSize;
   2829     DWORD dwBitLen;
   2830   } CMSG_RC2_AUX_INFO,*PCMSG_RC2_AUX_INFO;
   2831 
   2832   typedef struct _CMSG_SP3_COMPATIBLE_AUX_INFO {
   2833     DWORD cbSize;
   2834     DWORD dwFlags;
   2835   } CMSG_SP3_COMPATIBLE_AUX_INFO,*PCMSG_SP3_COMPATIBLE_AUX_INFO;
   2836 
   2837   typedef struct _CMSG_RC4_AUX_INFO {
   2838     DWORD cbSize;
   2839     DWORD dwBitLen;
   2840   } CMSG_RC4_AUX_INFO,*PCMSG_RC4_AUX_INFO;
   2841 
   2842   typedef struct _CMSG_SIGNED_AND_ENVELOPED_ENCODE_INFO {
   2843     DWORD cbSize;
   2844     CMSG_SIGNED_ENCODE_INFO SignedInfo;
   2845     CMSG_ENVELOPED_ENCODE_INFO EnvelopedInfo;
   2846   } CMSG_SIGNED_AND_ENVELOPED_ENCODE_INFO,*PCMSG_SIGNED_AND_ENVELOPED_ENCODE_INFO;
   2847 
   2848   typedef struct _CMSG_HASHED_ENCODE_INFO {
   2849     DWORD cbSize;
   2850     HCRYPTPROV_LEGACY hCryptProv;
   2851     CRYPT_ALGORITHM_IDENTIFIER HashAlgorithm;
   2852     void *pvHashAuxInfo;
   2853   } CMSG_HASHED_ENCODE_INFO,*PCMSG_HASHED_ENCODE_INFO;
   2854 
   2855   typedef struct _CMSG_ENCRYPTED_ENCODE_INFO {
   2856     DWORD cbSize;
   2857     CRYPT_ALGORITHM_IDENTIFIER ContentEncryptionAlgorithm;
   2858     void *pvEncryptionAuxInfo;
   2859   } CMSG_ENCRYPTED_ENCODE_INFO,*PCMSG_ENCRYPTED_ENCODE_INFO;
   2860 
   2861   typedef WINBOOL (WINAPI *PFN_CMSG_STREAM_OUTPUT) (const void *pvArg, BYTE *pbData, DWORD cbData, WINBOOL fFinal);
   2862 
   2863 #define CMSG_INDEFINITE_LENGTH (0xffffffff)
   2864 
   2865   typedef struct _CMSG_STREAM_INFO {
   2866     DWORD cbContent;
   2867     PFN_CMSG_STREAM_OUTPUT pfnStreamOutput;
   2868     void *pvArg;
   2869   } CMSG_STREAM_INFO,*PCMSG_STREAM_INFO;
   2870 
   2871 #define CMSG_BARE_CONTENT_FLAG 0x1
   2872 #define CMSG_LENGTH_ONLY_FLAG 0x2
   2873 #define CMSG_DETACHED_FLAG 0x4
   2874 #define CMSG_AUTHENTICATED_ATTRIBUTES_FLAG 0x8
   2875 #define CMSG_CONTENTS_OCTETS_FLAG 0x10
   2876 #define CMSG_MAX_LENGTH_FLAG 0x20
   2877 #define CMSG_CMS_ENCAPSULATED_CONTENT_FLAG 0x40
   2878 #define CMSG_CRYPT_RELEASE_CONTEXT_FLAG 0x8000
   2879 
   2880   WINIMPM HCRYPTMSG WINAPI CryptMsgOpenToEncode (DWORD dwMsgEncodingType, DWORD dwFlags, DWORD dwMsgType, void const *pvMsgEncodeInfo, LPSTR pszInnerContentObjID, PCMSG_STREAM_INFO pStreamInfo);
   2881   WINIMPM DWORD WINAPI CryptMsgCalculateEncodedLength (DWORD dwMsgEncodingType, DWORD dwFlags, DWORD dwMsgType, void const *pvMsgEncodeInfo, LPSTR pszInnerContentObjID, DWORD cbData);
   2882   WINIMPM HCRYPTMSG WINAPI CryptMsgOpenToDecode (DWORD dwMsgEncodingType, DWORD dwFlags, DWORD dwMsgType, HCRYPTPROV_LEGACY hCryptProv, PCERT_INFO pRecipientInfo, PCMSG_STREAM_INFO pStreamInfo);
   2883   WINIMPM HCRYPTMSG WINAPI CryptMsgDuplicate (HCRYPTMSG hCryptMsg);
   2884   WINIMPM WINBOOL WINAPI CryptMsgClose (HCRYPTMSG hCryptMsg);
   2885   WINIMPM WINBOOL WINAPI CryptMsgUpdate (HCRYPTMSG hCryptMsg, const BYTE *pbData, DWORD cbData, WINBOOL fFinal);
   2886   WINIMPM WINBOOL WINAPI CryptMsgGetParam (HCRYPTMSG hCryptMsg, DWORD dwParamType, DWORD dwIndex, void *pvData, DWORD *pcbData);
   2887 
   2888 #define CMSG_TYPE_PARAM 1
   2889 #define CMSG_CONTENT_PARAM 2
   2890 #define CMSG_BARE_CONTENT_PARAM 3
   2891 #define CMSG_INNER_CONTENT_TYPE_PARAM 4
   2892 #define CMSG_SIGNER_COUNT_PARAM 5
   2893 #define CMSG_SIGNER_INFO_PARAM 6
   2894 #define CMSG_SIGNER_CERT_INFO_PARAM 7
   2895 #define CMSG_SIGNER_HASH_ALGORITHM_PARAM 8
   2896 #define CMSG_SIGNER_AUTH_ATTR_PARAM 9
   2897 #define CMSG_SIGNER_UNAUTH_ATTR_PARAM 10
   2898 #define CMSG_CERT_COUNT_PARAM 11
   2899 #define CMSG_CERT_PARAM 12
   2900 #define CMSG_CRL_COUNT_PARAM 13
   2901 #define CMSG_CRL_PARAM 14
   2902 #define CMSG_ENVELOPE_ALGORITHM_PARAM 15
   2903 #define CMSG_RECIPIENT_COUNT_PARAM 17
   2904 #define CMSG_RECIPIENT_INDEX_PARAM 18
   2905 #define CMSG_RECIPIENT_INFO_PARAM 19
   2906 #define CMSG_HASH_ALGORITHM_PARAM 20
   2907 #define CMSG_HASH_DATA_PARAM 21
   2908 #define CMSG_COMPUTED_HASH_PARAM 22
   2909 #define CMSG_ENCRYPT_PARAM 26
   2910 #define CMSG_ENCRYPTED_DIGEST 27
   2911 #define CMSG_ENCODED_SIGNER 28
   2912 #define CMSG_ENCODED_MESSAGE 29
   2913 #define CMSG_VERSION_PARAM 30
   2914 #define CMSG_ATTR_CERT_COUNT_PARAM 31
   2915 #define CMSG_ATTR_CERT_PARAM 32
   2916 #define CMSG_CMS_RECIPIENT_COUNT_PARAM 33
   2917 #define CMSG_CMS_RECIPIENT_INDEX_PARAM 34
   2918 #define CMSG_CMS_RECIPIENT_ENCRYPTED_KEY_INDEX_PARAM 35
   2919 #define CMSG_CMS_RECIPIENT_INFO_PARAM 36
   2920 #define CMSG_UNPROTECTED_ATTR_PARAM 37
   2921 #define CMSG_SIGNER_CERT_ID_PARAM 38
   2922 #define CMSG_CMS_SIGNER_INFO_PARAM 39
   2923 
   2924   typedef struct _CMSG_SIGNER_INFO {
   2925     DWORD dwVersion;
   2926     CERT_NAME_BLOB Issuer;
   2927     CRYPT_INTEGER_BLOB SerialNumber;
   2928     CRYPT_ALGORITHM_IDENTIFIER HashAlgorithm;
   2929     CRYPT_ALGORITHM_IDENTIFIER HashEncryptionAlgorithm;
   2930     CRYPT_DATA_BLOB EncryptedHash;
   2931     CRYPT_ATTRIBUTES AuthAttrs;
   2932     CRYPT_ATTRIBUTES UnauthAttrs;
   2933   } CMSG_SIGNER_INFO,*PCMSG_SIGNER_INFO;
   2934 
   2935   typedef struct _CMSG_CMS_SIGNER_INFO {
   2936     DWORD dwVersion;
   2937     CERT_ID SignerId;
   2938     CRYPT_ALGORITHM_IDENTIFIER HashAlgorithm;
   2939     CRYPT_ALGORITHM_IDENTIFIER HashEncryptionAlgorithm;
   2940     CRYPT_DATA_BLOB EncryptedHash;
   2941     CRYPT_ATTRIBUTES AuthAttrs;
   2942     CRYPT_ATTRIBUTES UnauthAttrs;
   2943   } CMSG_CMS_SIGNER_INFO,*PCMSG_CMS_SIGNER_INFO;
   2944 
   2945   typedef CRYPT_ATTRIBUTES CMSG_ATTR;
   2946   typedef CRYPT_ATTRIBUTES *PCMSG_ATTR;
   2947 
   2948 #define CMSG_SIGNED_DATA_V1 1
   2949 #define CMSG_SIGNED_DATA_V3 3
   2950 #define CMSG_SIGNED_DATA_PKCS_1_5_VERSION CMSG_SIGNED_DATA_V1
   2951 #define CMSG_SIGNED_DATA_CMS_VERSION CMSG_SIGNED_DATA_V3
   2952 
   2953 #define CMSG_SIGNER_INFO_V1 1
   2954 #define CMSG_SIGNER_INFO_V3 3
   2955 #define CMSG_SIGNER_INFO_PKCS_1_5_VERSION CMSG_SIGNER_INFO_V1
   2956 #define CMSG_SIGNER_INFO_CMS_VERSION CMSG_SIGNER_INFO_V3
   2957 
   2958 #define CMSG_HASHED_DATA_V0 0
   2959 #define CMSG_HASHED_DATA_V2 2
   2960 #define CMSG_HASHED_DATA_PKCS_1_5_VERSION CMSG_HASHED_DATA_V0
   2961 #define CMSG_HASHED_DATA_CMS_VERSION CMSG_HASHED_DATA_V2
   2962 
   2963 #define CMSG_ENVELOPED_DATA_V0 0
   2964 #define CMSG_ENVELOPED_DATA_V2 2
   2965 #define CMSG_ENVELOPED_DATA_PKCS_1_5_VERSION CMSG_ENVELOPED_DATA_V0
   2966 #define CMSG_ENVELOPED_DATA_CMS_VERSION CMSG_ENVELOPED_DATA_V2
   2967 
   2968   typedef struct _CMSG_KEY_TRANS_RECIPIENT_INFO {
   2969     DWORD dwVersion;
   2970     CERT_ID RecipientId;
   2971     CRYPT_ALGORITHM_IDENTIFIER KeyEncryptionAlgorithm;
   2972     CRYPT_DATA_BLOB EncryptedKey;
   2973   } CMSG_KEY_TRANS_RECIPIENT_INFO,*PCMSG_KEY_TRANS_RECIPIENT_INFO;
   2974 
   2975   typedef struct _CMSG_RECIPIENT_ENCRYPTED_KEY_INFO {
   2976     CERT_ID RecipientId;
   2977     CRYPT_DATA_BLOB EncryptedKey;
   2978     FILETIME Date;
   2979     PCRYPT_ATTRIBUTE_TYPE_VALUE pOtherAttr;
   2980   } CMSG_RECIPIENT_ENCRYPTED_KEY_INFO,*PCMSG_RECIPIENT_ENCRYPTED_KEY_INFO;
   2981 
   2982   typedef struct _CMSG_KEY_AGREE_RECIPIENT_INFO {
   2983     DWORD dwVersion;
   2984     DWORD dwOriginatorChoice;
   2985     __C89_NAMELESS union {
   2986       CERT_ID OriginatorCertId;
   2987       CERT_PUBLIC_KEY_INFO OriginatorPublicKeyInfo;
   2988     };
   2989     CRYPT_DATA_BLOB UserKeyingMaterial;
   2990     CRYPT_ALGORITHM_IDENTIFIER KeyEncryptionAlgorithm;
   2991     DWORD cRecipientEncryptedKeys;
   2992     PCMSG_RECIPIENT_ENCRYPTED_KEY_INFO *rgpRecipientEncryptedKeys;
   2993   } CMSG_KEY_AGREE_RECIPIENT_INFO,*PCMSG_KEY_AGREE_RECIPIENT_INFO;
   2994 
   2995 #define CMSG_KEY_AGREE_ORIGINATOR_CERT 1
   2996 #define CMSG_KEY_AGREE_ORIGINATOR_PUBLIC_KEY 2
   2997 
   2998   typedef struct _CMSG_MAIL_LIST_RECIPIENT_INFO {
   2999     DWORD dwVersion;
   3000     CRYPT_DATA_BLOB KeyId;
   3001     CRYPT_ALGORITHM_IDENTIFIER KeyEncryptionAlgorithm;
   3002     CRYPT_DATA_BLOB EncryptedKey;
   3003     FILETIME Date;
   3004     PCRYPT_ATTRIBUTE_TYPE_VALUE pOtherAttr;
   3005   } CMSG_MAIL_LIST_RECIPIENT_INFO,*PCMSG_MAIL_LIST_RECIPIENT_INFO;
   3006 
   3007   typedef struct _CMSG_CMS_RECIPIENT_INFO {
   3008     DWORD dwRecipientChoice;
   3009     __C89_NAMELESS union {
   3010       PCMSG_KEY_TRANS_RECIPIENT_INFO pKeyTrans;
   3011       PCMSG_KEY_AGREE_RECIPIENT_INFO pKeyAgree;
   3012       PCMSG_MAIL_LIST_RECIPIENT_INFO pMailList;
   3013     };
   3014   } CMSG_CMS_RECIPIENT_INFO,*PCMSG_CMS_RECIPIENT_INFO;
   3015 
   3016 #define CMSG_ENVELOPED_RECIPIENT_V0 0
   3017 #define CMSG_ENVELOPED_RECIPIENT_V2 2
   3018 #define CMSG_ENVELOPED_RECIPIENT_V3 3
   3019 #define CMSG_ENVELOPED_RECIPIENT_V4 4
   3020 #define CMSG_KEY_TRANS_PKCS_1_5_VERSION CMSG_ENVELOPED_RECIPIENT_V0
   3021 #define CMSG_KEY_TRANS_CMS_VERSION CMSG_ENVELOPED_RECIPIENT_V2
   3022 #define CMSG_KEY_AGREE_VERSION CMSG_ENVELOPED_RECIPIENT_V3
   3023 #define CMSG_MAIL_LIST_VERSION CMSG_ENVELOPED_RECIPIENT_V4
   3024 
   3025   WINIMPM WINBOOL WINAPI CryptMsgControl (HCRYPTMSG hCryptMsg, DWORD dwFlags, DWORD dwCtrlType, void const *pvCtrlPara);
   3026 
   3027 #define CMSG_CTRL_VERIFY_SIGNATURE 1
   3028 #define CMSG_CTRL_DECRYPT 2
   3029 #define CMSG_CTRL_VERIFY_HASH 5
   3030 #define CMSG_CTRL_ADD_SIGNER 6
   3031 #define CMSG_CTRL_DEL_SIGNER 7
   3032 #define CMSG_CTRL_ADD_SIGNER_UNAUTH_ATTR 8
   3033 #define CMSG_CTRL_DEL_SIGNER_UNAUTH_ATTR 9
   3034 #define CMSG_CTRL_ADD_CERT 10
   3035 #define CMSG_CTRL_DEL_CERT 11
   3036 #define CMSG_CTRL_ADD_CRL 12
   3037 #define CMSG_CTRL_DEL_CRL 13
   3038 #define CMSG_CTRL_ADD_ATTR_CERT 14
   3039 #define CMSG_CTRL_DEL_ATTR_CERT 15
   3040 #define CMSG_CTRL_KEY_TRANS_DECRYPT 16
   3041 #define CMSG_CTRL_KEY_AGREE_DECRYPT 17
   3042 #define CMSG_CTRL_MAIL_LIST_DECRYPT 18
   3043 #define CMSG_CTRL_VERIFY_SIGNATURE_EX 19
   3044 #define CMSG_CTRL_ADD_CMS_SIGNER_INFO 20
   3045 #define CMSG_CTRL_ENABLE_STRONG_SIGNATURE 21
   3046 
   3047   typedef struct _CMSG_CTRL_VERIFY_SIGNATURE_EX_PARA {
   3048     DWORD cbSize;
   3049     HCRYPTPROV_LEGACY hCryptProv;
   3050     DWORD dwSignerIndex;
   3051     DWORD dwSignerType;
   3052     void *pvSigner;
   3053   } CMSG_CTRL_VERIFY_SIGNATURE_EX_PARA,*PCMSG_CTRL_VERIFY_SIGNATURE_EX_PARA;
   3054 
   3055 #define CMSG_VERIFY_SIGNER_PUBKEY 1
   3056 #define CMSG_VERIFY_SIGNER_CERT 2
   3057 #define CMSG_VERIFY_SIGNER_CHAIN 3
   3058 #define CMSG_VERIFY_SIGNER_NULL 4
   3059 
   3060   typedef struct _CMSG_CTRL_DECRYPT_PARA {
   3061     DWORD cbSize;
   3062     __C89_NAMELESS union {
   3063       HCRYPTPROV hCryptProv;
   3064       NCRYPT_KEY_HANDLE hNCryptKey;
   3065     };
   3066     DWORD dwKeySpec;
   3067     DWORD dwRecipientIndex;
   3068   } CMSG_CTRL_DECRYPT_PARA,*PCMSG_CTRL_DECRYPT_PARA;
   3069 
   3070   typedef struct _CMSG_CTRL_KEY_TRANS_DECRYPT_PARA {
   3071     DWORD cbSize;
   3072     __C89_NAMELESS union {
   3073       HCRYPTPROV hCryptProv;
   3074       NCRYPT_KEY_HANDLE hNCryptKey;
   3075     };
   3076     DWORD dwKeySpec;
   3077     PCMSG_KEY_TRANS_RECIPIENT_INFO pKeyTrans;
   3078     DWORD dwRecipientIndex;
   3079   } CMSG_CTRL_KEY_TRANS_DECRYPT_PARA,*PCMSG_CTRL_KEY_TRANS_DECRYPT_PARA;
   3080 
   3081   typedef struct _CMSG_CTRL_KEY_AGREE_DECRYPT_PARA {
   3082     DWORD cbSize;
   3083     __C89_NAMELESS union {
   3084       HCRYPTPROV hCryptProv;
   3085       NCRYPT_KEY_HANDLE hNCryptKey;
   3086     };
   3087     DWORD dwKeySpec;
   3088     PCMSG_KEY_AGREE_RECIPIENT_INFO pKeyAgree;
   3089     DWORD dwRecipientIndex;
   3090     DWORD dwRecipientEncryptedKeyIndex;
   3091     CRYPT_BIT_BLOB OriginatorPublicKey;
   3092   } CMSG_CTRL_KEY_AGREE_DECRYPT_PARA,*PCMSG_CTRL_KEY_AGREE_DECRYPT_PARA;
   3093 
   3094   typedef struct _CMSG_CTRL_MAIL_LIST_DECRYPT_PARA {
   3095     DWORD cbSize;
   3096     HCRYPTPROV hCryptProv;
   3097     PCMSG_MAIL_LIST_RECIPIENT_INFO pMailList;
   3098     DWORD dwRecipientIndex;
   3099     DWORD dwKeyChoice;
   3100     __C89_NAMELESS union {
   3101       HCRYPTKEY hKeyEncryptionKey;
   3102       void *pvKeyEncryptionKey;
   3103     };
   3104   } CMSG_CTRL_MAIL_LIST_DECRYPT_PARA,*PCMSG_CTRL_MAIL_LIST_DECRYPT_PARA;
   3105 
   3106   typedef struct _CMSG_CTRL_ADD_SIGNER_UNAUTH_ATTR_PARA {
   3107     DWORD cbSize;
   3108     DWORD dwSignerIndex;
   3109     CRYPT_DATA_BLOB blob;
   3110   } CMSG_CTRL_ADD_SIGNER_UNAUTH_ATTR_PARA,*PCMSG_CTRL_ADD_SIGNER_UNAUTH_ATTR_PARA;
   3111 
   3112   typedef struct _CMSG_CTRL_DEL_SIGNER_UNAUTH_ATTR_PARA {
   3113     DWORD cbSize;
   3114     DWORD dwSignerIndex;
   3115     DWORD dwUnauthAttrIndex;
   3116   } CMSG_CTRL_DEL_SIGNER_UNAUTH_ATTR_PARA,*PCMSG_CTRL_DEL_SIGNER_UNAUTH_ATTR_PARA;
   3117 
   3118 #define CMSG_VERIFY_COUNTER_SIGN_ENABLE_STRONG_FLAG 0x1
   3119 
   3120   WINBOOL WINAPI CryptMsgVerifyCountersignatureEncoded (HCRYPTPROV_LEGACY hCryptProv, DWORD dwEncodingType, PBYTE pbSignerInfo, DWORD cbSignerInfo, PBYTE pbSignerInfoCountersignature, DWORD cbSignerInfoCountersignature, PCERT_INFO pciCountersigner);
   3121   WINBOOL WINAPI CryptMsgVerifyCountersignatureEncodedEx (HCRYPTPROV_LEGACY hCryptProv, DWORD dwEncodingType, PBYTE pbSignerInfo, DWORD cbSignerInfo, PBYTE pbSignerInfoCountersignature, DWORD cbSignerInfoCountersignature, DWORD dwSignerType, void *pvSigner, DWORD dwFlags, void *pvExtra);
   3122   WINBOOL WINAPI CryptMsgCountersign (HCRYPTMSG hCryptMsg, DWORD dwIndex, DWORD cCountersigners, PCMSG_SIGNER_ENCODE_INFO rgCountersigners);
   3123   WINBOOL WINAPI CryptMsgCountersignEncoded (DWORD dwEncodingType, PBYTE pbSignerInfo, DWORD cbSignerInfo, DWORD cCountersigners, PCMSG_SIGNER_ENCODE_INFO rgCountersigners, PBYTE pbCountersignature, PDWORD pcbCountersignature);
   3124 
   3125   typedef void *(WINAPI *PFN_CMSG_ALLOC) (size_t cb);
   3126   typedef void (WINAPI *PFN_CMSG_FREE) (void *pv);
   3127 
   3128 #define CMSG_OID_GEN_ENCRYPT_KEY_FUNC "CryptMsgDllGenEncryptKey"
   3129 #define CMSG_OID_EXPORT_ENCRYPT_KEY_FUNC "CryptMsgDllExportEncryptKey"
   3130 #define CMSG_OID_IMPORT_ENCRYPT_KEY_FUNC "CryptMsgDllImportEncryptKey"
   3131 
   3132   typedef WINBOOL (WINAPI *PFN_CMSG_GEN_ENCRYPT_KEY) (HCRYPTPROV *phCryptProv, PCRYPT_ALGORITHM_IDENTIFIER paiEncrypt, PVOID pvEncryptAuxInfo, PCERT_PUBLIC_KEY_INFO pPublicKeyInfo, PFN_CMSG_ALLOC pfnAlloc, HCRYPTKEY *phEncryptKey, PBYTE *ppbEncryptParameters, PDWORD pcbEncryptParameters);
   3133   typedef WINBOOL (WINAPI *PFN_CMSG_EXPORT_ENCRYPT_KEY) (HCRYPTPROV hCryptProv, HCRYPTKEY hEncryptKey, PCERT_PUBLIC_KEY_INFO pPublicKeyInfo, PBYTE pbData, PDWORD pcbData);
   3134   typedef WINBOOL (WINAPI *PFN_CMSG_IMPORT_ENCRYPT_KEY) (HCRYPTPROV hCryptProv, DWORD dwKeySpec, PCRYPT_ALGORITHM_IDENTIFIER paiEncrypt, PCRYPT_ALGORITHM_IDENTIFIER paiPubKey, PBYTE pbEncodedKey, DWORD cbEncodedKey, HCRYPTKEY *phEncryptKey);
   3135 
   3136 #define CMSG_DEFAULT_INSTALLABLE_FUNC_OID ((LPCSTR) 1)
   3137 
   3138   typedef struct _CMSG_CONTENT_ENCRYPT_INFO {
   3139     DWORD cbSize;
   3140     HCRYPTPROV_LEGACY hCryptProv;
   3141     CRYPT_ALGORITHM_IDENTIFIER ContentEncryptionAlgorithm;
   3142     void *pvEncryptionAuxInfo;
   3143     DWORD cRecipients;
   3144     PCMSG_RECIPIENT_ENCODE_INFO rgCmsRecipients;
   3145     PFN_CMSG_ALLOC pfnAlloc;
   3146     PFN_CMSG_FREE pfnFree;
   3147     DWORD dwEncryptFlags;
   3148     __C89_NAMELESS union {
   3149       HCRYPTKEY hContentEncryptKey;
   3150       BCRYPT_KEY_HANDLE hCNGContentEncryptKey;
   3151     };
   3152     DWORD dwFlags;
   3153     WINBOOL fCNG;
   3154     BYTE *pbCNGContentEncryptKeyObject;
   3155     BYTE *pbContentEncryptKey;
   3156     DWORD cbContentEncryptKey;
   3157   } CMSG_CONTENT_ENCRYPT_INFO,*PCMSG_CONTENT_ENCRYPT_INFO;
   3158 
   3159 #define CMSG_CONTENT_ENCRYPT_PAD_ENCODED_LEN_FLAG 0x1
   3160 
   3161 #define CMSG_CONTENT_ENCRYPT_FREE_PARA_FLAG 0x1
   3162 #define CMSG_CONTENT_ENCRYPT_FREE_OBJID_FLAG 0x2
   3163 #define CMSG_CONTENT_ENCRYPT_RELEASE_CONTEXT_FLAG 0x8000
   3164 
   3165 #define CMSG_OID_GEN_CONTENT_ENCRYPT_KEY_FUNC "CryptMsgDllGenContentEncryptKey"
   3166 #define CMSG_OID_CAPI1_GEN_CONTENT_ENCRYPT_KEY_FUNC CMSG_OID_GEN_CONTENT_ENCRYPT_KEY_FUNC
   3167 #define CMSG_OID_CNG_GEN_CONTENT_ENCRYPT_KEY_FUNC "CryptMsgDllCNGGenContentEncryptKey"
   3168 
   3169   typedef WINBOOL (WINAPI *PFN_CMSG_GEN_CONTENT_ENCRYPT_KEY) (PCMSG_CONTENT_ENCRYPT_INFO pContentEncryptInfo, DWORD dwFlags, void *pvReserved);
   3170 
   3171   typedef struct _CMSG_KEY_TRANS_ENCRYPT_INFO {
   3172     DWORD cbSize;
   3173     DWORD dwRecipientIndex;
   3174     CRYPT_ALGORITHM_IDENTIFIER KeyEncryptionAlgorithm;
   3175     CRYPT_DATA_BLOB EncryptedKey;
   3176     DWORD dwFlags;
   3177   } CMSG_KEY_TRANS_ENCRYPT_INFO,*PCMSG_KEY_TRANS_ENCRYPT_INFO;
   3178 
   3179 #define CMSG_KEY_TRANS_ENCRYPT_FREE_PARA_FLAG 0x1
   3180 #define CMSG_KEY_TRANS_ENCRYPT_FREE_OBJID_FLAG 0x2
   3181 
   3182 #define CMSG_OID_EXPORT_KEY_TRANS_FUNC "CryptMsgDllExportKeyTrans"
   3183 #define CMSG_OID_CAPI1_EXPORT_KEY_TRANS_FUNC CMSG_OID_EXPORT_KEY_TRANS_FUNC
   3184 #define CMSG_OID_CNG_EXPORT_KEY_TRANS_FUNC "CryptMsgDllCNGExportKeyTrans"
   3185 
   3186   typedef WINBOOL (WINAPI *PFN_CMSG_EXPORT_KEY_TRANS) (PCMSG_CONTENT_ENCRYPT_INFO pContentEncryptInfo, PCMSG_KEY_TRANS_RECIPIENT_ENCODE_INFO pKeyTransEncodeInfo, PCMSG_KEY_TRANS_ENCRYPT_INFO pKeyTransEncryptInfo, DWORD dwFlags, void *pvReserved);
   3187 
   3188   typedef struct _CMSG_KEY_AGREE_KEY_ENCRYPT_INFO {
   3189     DWORD cbSize;
   3190     CRYPT_DATA_BLOB EncryptedKey;
   3191   } CMSG_KEY_AGREE_KEY_ENCRYPT_INFO,*PCMSG_KEY_AGREE_KEY_ENCRYPT_INFO;
   3192 
   3193   typedef struct _CMSG_KEY_AGREE_ENCRYPT_INFO {
   3194     DWORD cbSize;
   3195     DWORD dwRecipientIndex;
   3196     CRYPT_ALGORITHM_IDENTIFIER KeyEncryptionAlgorithm;
   3197     CRYPT_DATA_BLOB UserKeyingMaterial;
   3198     DWORD dwOriginatorChoice;
   3199     __C89_NAMELESS union {
   3200       CERT_ID OriginatorCertId;
   3201       CERT_PUBLIC_KEY_INFO OriginatorPublicKeyInfo;
   3202     };
   3203     DWORD cKeyAgreeKeyEncryptInfo;
   3204     PCMSG_KEY_AGREE_KEY_ENCRYPT_INFO *rgpKeyAgreeKeyEncryptInfo;
   3205     DWORD dwFlags;
   3206   } CMSG_KEY_AGREE_ENCRYPT_INFO,*PCMSG_KEY_AGREE_ENCRYPT_INFO;
   3207 
   3208 #define CMSG_KEY_AGREE_ENCRYPT_FREE_PARA_FLAG 0x1
   3209 #define CMSG_KEY_AGREE_ENCRYPT_FREE_MATERIAL_FLAG 0x2
   3210 #define CMSG_KEY_AGREE_ENCRYPT_FREE_PUBKEY_ALG_FLAG 0x4
   3211 #define CMSG_KEY_AGREE_ENCRYPT_FREE_PUBKEY_PARA_FLAG 0x8
   3212 #define CMSG_KEY_AGREE_ENCRYPT_FREE_PUBKEY_BITS_FLAG 0x10
   3213 #define CMSG_KEY_AGREE_ENCRYPT_FREE_OBJID_FLAG 0x20
   3214 
   3215 #define CMSG_OID_EXPORT_KEY_AGREE_FUNC "CryptMsgDllExportKeyAgree"
   3216 #define CMSG_OID_CAPI1_EXPORT_KEY_AGREE_FUNC CMSG_OID_EXPORT_KEY_AGREE_FUNC
   3217 #define CMSG_OID_CNG_EXPORT_KEY_AGREE_FUNC "CryptMsgDllCNGExportKeyAgree"
   3218 
   3219   typedef WINBOOL (WINAPI *PFN_CMSG_EXPORT_KEY_AGREE) (PCMSG_CONTENT_ENCRYPT_INFO pContentEncryptInfo, PCMSG_KEY_AGREE_RECIPIENT_ENCODE_INFO pKeyAgreeEncodeInfo, PCMSG_KEY_AGREE_ENCRYPT_INFO pKeyAgreeEncryptInfo, DWORD dwFlags, void *pvReserved);
   3220 
   3221   typedef struct _CMSG_MAIL_LIST_ENCRYPT_INFO {
   3222     DWORD cbSize;
   3223     DWORD dwRecipientIndex;
   3224     CRYPT_ALGORITHM_IDENTIFIER KeyEncryptionAlgorithm;
   3225     CRYPT_DATA_BLOB EncryptedKey;
   3226     DWORD dwFlags;
   3227   } CMSG_MAIL_LIST_ENCRYPT_INFO,*PCMSG_MAIL_LIST_ENCRYPT_INFO;
   3228 
   3229 #define CMSG_MAIL_LIST_ENCRYPT_FREE_PARA_FLAG 0x1
   3230 #define CMSG_MAIL_LIST_ENCRYPT_FREE_OBJID_FLAG 0x2
   3231 
   3232 #define CMSG_OID_EXPORT_MAIL_LIST_FUNC "CryptMsgDllExportMailList"
   3233 #define CMSG_OID_CAPI1_EXPORT_MAIL_LIST_FUNC CMSG_OID_EXPORT_MAIL_LIST_FUNC
   3234 #define CMSG_OID_IMPORT_KEY_TRANS_FUNC "CryptMsgDllImportKeyTrans"
   3235 #define CMSG_OID_CAPI1_IMPORT_KEY_TRANS_FUNC CMSG_OID_IMPORT_KEY_TRANS_FUNC
   3236 #define CMSG_OID_IMPORT_KEY_AGREE_FUNC "CryptMsgDllImportKeyAgree"
   3237 #define CMSG_OID_CAPI1_IMPORT_KEY_AGREE_FUNC CMSG_OID_IMPORT_KEY_AGREE_FUNC
   3238 #define CMSG_OID_IMPORT_MAIL_LIST_FUNC "CryptMsgDllImportMailList"
   3239 #define CMSG_OID_CAPI1_IMPORT_MAIL_LIST_FUNC CMSG_OID_IMPORT_MAIL_LIST_FUNC
   3240 
   3241   typedef WINBOOL (WINAPI *PFN_CMSG_EXPORT_MAIL_LIST) (PCMSG_CONTENT_ENCRYPT_INFO pContentEncryptInfo, PCMSG_MAIL_LIST_RECIPIENT_ENCODE_INFO pMailListEncodeInfo, PCMSG_MAIL_LIST_ENCRYPT_INFO pMailListEncryptInfo, DWORD dwFlags, void *pvReserved);
   3242   typedef WINBOOL (WINAPI *PFN_CMSG_IMPORT_KEY_TRANS) (PCRYPT_ALGORITHM_IDENTIFIER pContentEncryptionAlgorithm, PCMSG_CTRL_KEY_TRANS_DECRYPT_PARA pKeyTransDecryptPara, DWORD dwFlags, void *pvReserved, HCRYPTKEY *phContentEncryptKey);
   3243   typedef WINBOOL (WINAPI *PFN_CMSG_IMPORT_KEY_AGREE) (PCRYPT_ALGORITHM_IDENTIFIER pContentEncryptionAlgorithm, PCMSG_CTRL_KEY_AGREE_DECRYPT_PARA pKeyAgreeDecryptPara, DWORD dwFlags, void *pvReserved, HCRYPTKEY *phContentEncryptKey);
   3244   typedef WINBOOL (WINAPI *PFN_CMSG_IMPORT_MAIL_LIST) (PCRYPT_ALGORITHM_IDENTIFIER pContentEncryptionAlgorithm, PCMSG_CTRL_MAIL_LIST_DECRYPT_PARA pMailListDecryptPara, DWORD dwFlags, void *pvReserved, HCRYPTKEY *phContentEncryptKey);
   3245 
   3246   typedef struct _CMSG_CNG_CONTENT_DECRYPT_INFO {
   3247     DWORD cbSize;
   3248     CRYPT_ALGORITHM_IDENTIFIER ContentEncryptionAlgorithm;
   3249     PFN_CMSG_ALLOC pfnAlloc;
   3250     PFN_CMSG_FREE pfnFree;
   3251     NCRYPT_KEY_HANDLE hNCryptKey;
   3252     BYTE *pbContentEncryptKey;
   3253     DWORD cbContentEncryptKey;
   3254     BCRYPT_KEY_HANDLE hCNGContentEncryptKey;
   3255     BYTE *pbCNGContentEncryptKeyObject;
   3256   } CMSG_CNG_CONTENT_DECRYPT_INFO,*PCMSG_CNG_CONTENT_DECRYPT_INFO;
   3257 
   3258 #define CMSG_OID_CNG_IMPORT_KEY_TRANS_FUNC "CryptMsgDllCNGImportKeyTrans"
   3259 #define CMSG_OID_CNG_IMPORT_KEY_AGREE_FUNC "CryptMsgDllCNGImportKeyAgree"
   3260 #define CMSG_OID_CNG_IMPORT_CONTENT_ENCRYPT_KEY_FUNC "CryptMsgDllCNGImportContentEncryptKey"
   3261 
   3262   typedef WINBOOL (WINAPI *PFN_CMSG_CNG_IMPORT_KEY_TRANS) (PCMSG_CNG_CONTENT_DECRYPT_INFO pCNGContentDecryptInfo, PCMSG_CTRL_KEY_TRANS_DECRYPT_PARA pKeyTransDecryptPara, DWORD dwFlags, void *pvReserved);
   3263   typedef WINBOOL (WINAPI *PFN_CMSG_CNG_IMPORT_KEY_AGREE) (PCMSG_CNG_CONTENT_DECRYPT_INFO pCNGContentDecryptInfo, PCMSG_CTRL_KEY_AGREE_DECRYPT_PARA pKeyAgreeDecryptPara, DWORD dwFlags, void *pvReserved);
   3264   typedef WINBOOL (WINAPI *PFN_CMSG_CNG_IMPORT_CONTENT_ENCRYPT_KEY) (PCMSG_CNG_CONTENT_DECRYPT_INFO pCNGContentDecryptInfo, DWORD dwFlags, void *pvReserved);
   3265 #endif
   3266 
   3267 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_APP)
   3268   typedef void *HCERTSTORE;
   3269 
   3270   typedef struct _CERT_CONTEXT {
   3271     DWORD dwCertEncodingType;
   3272     BYTE *pbCertEncoded;
   3273     DWORD cbCertEncoded;
   3274     PCERT_INFO pCertInfo;
   3275     HCERTSTORE hCertStore;
   3276   } CERT_CONTEXT,*PCERT_CONTEXT;
   3277 
   3278   typedef const CERT_CONTEXT *PCCERT_CONTEXT;
   3279 #endif
   3280 
   3281 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
   3282   typedef struct _CRL_CONTEXT {
   3283     DWORD dwCertEncodingType;
   3284     BYTE *pbCrlEncoded;
   3285     DWORD cbCrlEncoded;
   3286     PCRL_INFO pCrlInfo;
   3287     HCERTSTORE hCertStore;
   3288   } CRL_CONTEXT,*PCRL_CONTEXT;
   3289 
   3290   typedef const CRL_CONTEXT *PCCRL_CONTEXT;
   3291 
   3292   typedef struct _CTL_CONTEXT {
   3293     DWORD dwMsgAndCertEncodingType;
   3294     BYTE *pbCtlEncoded;
   3295     DWORD cbCtlEncoded;
   3296     PCTL_INFO pCtlInfo;
   3297     HCERTSTORE hCertStore;
   3298     HCRYPTMSG hCryptMsg;
   3299     BYTE *pbCtlContent;
   3300     DWORD cbCtlContent;
   3301   } CTL_CONTEXT,*PCTL_CONTEXT;
   3302 
   3303   typedef const CTL_CONTEXT *PCCTL_CONTEXT;
   3304 
   3305 #define CERT_KEY_PROV_HANDLE_PROP_ID 1
   3306 #define CERT_KEY_PROV_INFO_PROP_ID 2
   3307 #define CERT_SHA1_HASH_PROP_ID 3
   3308 #define CERT_MD5_HASH_PROP_ID 4
   3309 #define CERT_HASH_PROP_ID CERT_SHA1_HASH_PROP_ID
   3310 #define CERT_KEY_CONTEXT_PROP_ID 5
   3311 #define CERT_KEY_SPEC_PROP_ID 6
   3312 #define CERT_IE30_RESERVED_PROP_ID 7
   3313 #define CERT_PUBKEY_HASH_RESERVED_PROP_ID 8
   3314 #define CERT_ENHKEY_USAGE_PROP_ID 9
   3315 #define CERT_CTL_USAGE_PROP_ID CERT_ENHKEY_USAGE_PROP_ID
   3316 #define CERT_NEXT_UPDATE_LOCATION_PROP_ID 10
   3317 #define CERT_FRIENDLY_NAME_PROP_ID 11
   3318 #define CERT_PVK_FILE_PROP_ID 12
   3319 #define CERT_DESCRIPTION_PROP_ID 13
   3320 #define CERT_ACCESS_STATE_PROP_ID 14
   3321 #define CERT_SIGNATURE_HASH_PROP_ID 15
   3322 #define CERT_SMART_CARD_DATA_PROP_ID 16
   3323 #define CERT_EFS_PROP_ID 17
   3324 #define CERT_FORTEZZA_DATA_PROP_ID 18
   3325 #define CERT_ARCHIVED_PROP_ID 19
   3326 #define CERT_KEY_IDENTIFIER_PROP_ID 20
   3327 #define CERT_AUTO_ENROLL_PROP_ID 21
   3328 #define CERT_PUBKEY_ALG_PARA_PROP_ID 22
   3329 #define CERT_CROSS_CERT_DIST_POINTS_PROP_ID 23
   3330 #define CERT_ISSUER_PUBLIC_KEY_MD5_HASH_PROP_ID 24
   3331 #define CERT_SUBJECT_PUBLIC_KEY_MD5_HASH_PROP_ID 25
   3332 #define CERT_ENROLLMENT_PROP_ID 26
   3333 #define CERT_DATE_STAMP_PROP_ID 27
   3334 #define CERT_ISSUER_SERIAL_NUMBER_MD5_HASH_PROP_ID 28
   3335 #define CERT_SUBJECT_NAME_MD5_HASH_PROP_ID 29
   3336 #define CERT_EXTENDED_ERROR_INFO_PROP_ID 30
   3337 #define CERT_RENEWAL_PROP_ID 64
   3338 #define CERT_ARCHIVED_KEY_HASH_PROP_ID 65
   3339 #define CERT_AUTO_ENROLL_RETRY_PROP_ID 66
   3340 #define CERT_AIA_URL_RETRIEVED_PROP_ID 67
   3341 #define CERT_AUTHORITY_INFO_ACCESS_PROP_ID 68
   3342 #define CERT_BACKED_UP_PROP_ID 69
   3343 #define CERT_OCSP_RESPONSE_PROP_ID 70
   3344 #define CERT_REQUEST_ORIGINATOR_PROP_ID 71
   3345 #define CERT_SOURCE_LOCATION_PROP_ID 72
   3346 #define CERT_SOURCE_URL_PROP_ID 73
   3347 #define CERT_NEW_KEY_PROP_ID 74
   3348 #define CERT_OCSP_CACHE_PREFIX_PROP_ID 75
   3349 #define CERT_SMART_CARD_ROOT_INFO_PROP_ID 76
   3350 #define CERT_NO_AUTO_EXPIRE_CHECK_PROP_ID 77
   3351 #define CERT_NCRYPT_KEY_HANDLE_PROP_ID 78
   3352 #define CERT_HCRYPTPROV_OR_NCRYPT_KEY_HANDLE_PROP_ID 79
   3353 #define CERT_SUBJECT_INFO_ACCESS_PROP_ID 80
   3354 #define CERT_CA_OCSP_AUTHORITY_INFO_ACCESS_PROP_ID 81
   3355 #define CERT_CA_DISABLE_CRL_PROP_ID 82
   3356 #define CERT_ROOT_PROGRAM_CERT_POLICIES_PROP_ID 83
   3357 #define CERT_ROOT_PROGRAM_NAME_CONSTRAINTS_PROP_ID 84
   3358 #define CERT_SUBJECT_OCSP_AUTHORITY_INFO_ACCESS_PROP_ID 85
   3359 #define CERT_SUBJECT_DISABLE_CRL_PROP_ID 86
   3360 #define CERT_CEP_PROP_ID 87
   3361 #define CERT_SIGN_HASH_CNG_ALG_PROP_ID 89
   3362 #define CERT_SCARD_PIN_ID_PROP_ID 90
   3363 #define CERT_SCARD_PIN_INFO_PROP_ID 91
   3364 #define CERT_SUBJECT_PUB_KEY_BIT_LENGTH_PROP_ID 92
   3365 #define CERT_PUB_KEY_CNG_ALG_BIT_LENGTH_PROP_ID 93
   3366 #define CERT_ISSUER_PUB_KEY_BIT_LENGTH_PROP_ID 94
   3367 #define CERT_ISSUER_CHAIN_SIGN_HASH_CNG_ALG_PROP_ID 95
   3368 #define CERT_ISSUER_CHAIN_PUB_KEY_CNG_ALG_BIT_LENGTH_PROP_ID 96
   3369 #define CERT_NO_EXPIRE_NOTIFICATION_PROP_ID 97
   3370 #define CERT_AUTH_ROOT_SHA256_HASH_PROP_ID 98
   3371 #define CERT_NCRYPT_KEY_HANDLE_TRANSFER_PROP_ID 99
   3372 #define CERT_HCRYPTPROV_TRANSFER_PROP_ID 100
   3373 #define CERT_SMART_CARD_READER_PROP_ID 101
   3374 #define CERT_SEND_AS_TRUSTED_ISSUER_PROP_ID 102
   3375 #define CERT_KEY_REPAIR_ATTEMPTED_PROP_ID 103
   3376 #define CERT_DISALLOWED_FILETIME_PROP_ID 104
   3377 #define CERT_ROOT_PROGRAM_CHAIN_POLICIES_PROP_ID 105
   3378 #define CERT_SMART_CARD_READER_NON_REMOVABLE_PROP_ID 106
   3379 
   3380 #define CERT_FIRST_RESERVED_PROP_ID 107
   3381 #define CERT_LAST_RESERVED_PROP_ID 0x00007fff
   3382 #define CERT_FIRST_USER_PROP_ID 0x8000
   3383 #define CERT_LAST_USER_PROP_ID 0x0000ffff
   3384 
   3385 #define IS_CERT_HASH_PROP_ID(X) (CERT_SHA1_HASH_PROP_ID == (X) || CERT_MD5_HASH_PROP_ID == (X) || CERT_SIGNATURE_HASH_PROP_ID == (X))
   3386 #define IS_PUBKEY_HASH_PROP_ID(X) (CERT_ISSUER_PUBLIC_KEY_MD5_HASH_PROP_ID == (X) || CERT_SUBJECT_PUBLIC_KEY_MD5_HASH_PROP_ID == (X))
   3387 #define IS_CHAIN_HASH_PROP_ID(X) (CERT_ISSUER_PUBLIC_KEY_MD5_HASH_PROP_ID == (X) || CERT_SUBJECT_PUBLIC_KEY_MD5_HASH_PROP_ID == (X) || CERT_ISSUER_SERIAL_NUMBER_MD5_HASH_PROP_ID == (X) || CERT_SUBJECT_NAME_MD5_HASH_PROP_ID == (X))
   3388 #define IS_STRONG_SIGN_PROP_ID(X) (CERT_SIGN_HASH_CNG_ALG_PROP_ID == (X) || CERT_SUBJECT_PUB_KEY_BIT_LENGTH_PROP_ID == (X) || CERT_PUB_KEY_CNG_ALG_BIT_LENGTH_PROP_ID == (X))
   3389 
   3390 #define szOID_CERT_PROP_ID_PREFIX "1.3.6.1.4.1.311.10.11."
   3391 #define _szPROP_ID(PropId) #PropId
   3392 #define szOID_CERT_PROP_ID(PropId) szOID_CERT_PROP_ID_PREFIX _szPROP_ID (PropId)
   3393 
   3394 #define __CRYPT32WTEXT(quote) L##quote
   3395 #define _CRYPT32WTEXT(quote) __CRYPT32WTEXT (quote)
   3396 #define wszOID_CERT_PROP_ID(PropId) _CRYPT32WTEXT (szOID_CERT_PROP_ID_PREFIX) _CRYPT32WTEXT (_szPROP_ID (PropId))
   3397 
   3398 #define szOID_CERT_KEY_IDENTIFIER_PROP_ID "1.3.6.1.4.1.311.10.11.20"
   3399 #define szOID_CERT_ISSUER_SERIAL_NUMBER_MD5_HASH_PROP_ID "1.3.6.1.4.1.311.10.11.28"
   3400 #define szOID_CERT_SUBJECT_NAME_MD5_HASH_PROP_ID "1.3.6.1.4.1.311.10.11.29"
   3401 #define szOID_CERT_MD5_HASH_PROP_ID "1.3.6.1.4.1.311.10.11.4"
   3402 #define szOID_CERT_SIGNATURE_HASH_PROP_ID "1.3.6.1.4.1.311.10.11.15"
   3403 #define szOID_DISALLOWED_HASH szOID_CERT_SIGNATURE_HASH_PROP_ID
   3404 #define szOID_CERT_DISALLOWED_FILETIME_PROP_ID "1.3.6.1.4.1.311.10.11.104"
   3405 
   3406 #define CERT_ACCESS_STATE_WRITE_PERSIST_FLAG 0x1
   3407 #define CERT_ACCESS_STATE_SYSTEM_STORE_FLAG 0x2
   3408 #define CERT_ACCESS_STATE_LM_SYSTEM_STORE_FLAG 0x4
   3409 #define CERT_ACCESS_STATE_GP_SYSTEM_STORE_FLAG 0x8
   3410 #define CERT_ACCESS_STATE_SHARED_USER_FLAG 0x10
   3411 
   3412 #define szOID_ROOT_PROGRAM_AUTO_UPDATE_CA_REVOCATION "1.3.6.1.4.1.311.60.3.1"
   3413 #define szOID_ROOT_PROGRAM_AUTO_UPDATE_END_REVOCATION "1.3.6.1.4.1.311.60.3.2"
   3414 #define szOID_ROOT_PROGRAM_NO_OCSP_FAILOVER_TO_CRL "1.3.6.1.4.1.311.60.3.3"
   3415 
   3416   typedef struct _CRYPT_KEY_PROV_PARAM {
   3417     DWORD dwParam;
   3418     BYTE *pbData;
   3419     DWORD cbData;
   3420     DWORD dwFlags;
   3421   } CRYPT_KEY_PROV_PARAM,*PCRYPT_KEY_PROV_PARAM;
   3422 
   3423   typedef struct _CRYPT_KEY_PROV_INFO {
   3424     LPWSTR pwszContainerName;
   3425     LPWSTR pwszProvName;
   3426     DWORD dwProvType;
   3427     DWORD dwFlags;
   3428     DWORD cProvParam;
   3429     PCRYPT_KEY_PROV_PARAM rgProvParam;
   3430     DWORD dwKeySpec;
   3431   } CRYPT_KEY_PROV_INFO,*PCRYPT_KEY_PROV_INFO;
   3432 
   3433 #define CERT_SET_KEY_PROV_HANDLE_PROP_ID 0x1
   3434 #define CERT_SET_KEY_CONTEXT_PROP_ID 0x1
   3435 
   3436 #define CERT_NCRYPT_KEY_SPEC 0xffffffff
   3437 
   3438   typedef struct _CERT_KEY_CONTEXT {
   3439     DWORD cbSize;
   3440     __C89_NAMELESS union {
   3441       HCRYPTPROV hCryptProv;
   3442       NCRYPT_KEY_HANDLE hNCryptKey;
   3443     };
   3444     DWORD dwKeySpec;
   3445   } CERT_KEY_CONTEXT,*PCERT_KEY_CONTEXT;
   3446 
   3447   typedef struct _ROOT_INFO_LUID {
   3448     DWORD LowPart;
   3449     LONG HighPart;
   3450   } ROOT_INFO_LUID,*PROOT_INFO_LUID;
   3451 
   3452   typedef struct _CRYPT_SMART_CARD_ROOT_INFO {
   3453     BYTE rgbCardID [16];
   3454     ROOT_INFO_LUID luid;
   3455   } CRYPT_SMART_CARD_ROOT_INFO,*PCRYPT_SMART_CARD_ROOT_INFO;
   3456 
   3457 #define CERT_STORE_PROV_MSG ((LPCSTR) 1)
   3458 #define CERT_STORE_PROV_MEMORY ((LPCSTR) 2)
   3459 #define CERT_STORE_PROV_FILE ((LPCSTR) 3)
   3460 #define CERT_STORE_PROV_REG ((LPCSTR) 4)
   3461 #define CERT_STORE_PROV_PKCS7 ((LPCSTR) 5)
   3462 #define CERT_STORE_PROV_SERIALIZED ((LPCSTR) 6)
   3463 #define CERT_STORE_PROV_FILENAME_A ((LPCSTR) 7)
   3464 #define CERT_STORE_PROV_FILENAME_W ((LPCSTR) 8)
   3465 #define CERT_STORE_PROV_FILENAME CERT_STORE_PROV_FILENAME_W
   3466 #define CERT_STORE_PROV_SYSTEM_A ((LPCSTR) 9)
   3467 #define CERT_STORE_PROV_SYSTEM_W ((LPCSTR) 10)
   3468 #define CERT_STORE_PROV_SYSTEM CERT_STORE_PROV_SYSTEM_W
   3469 #define CERT_STORE_PROV_COLLECTION ((LPCSTR) 11)
   3470 #define CERT_STORE_PROV_SYSTEM_REGISTRY_A ((LPCSTR) 12)
   3471 #define CERT_STORE_PROV_SYSTEM_REGISTRY_W ((LPCSTR) 13)
   3472 #define CERT_STORE_PROV_SYSTEM_REGISTRY CERT_STORE_PROV_SYSTEM_REGISTRY_W
   3473 #define CERT_STORE_PROV_PHYSICAL_W ((LPCSTR) 14)
   3474 #define CERT_STORE_PROV_PHYSICAL CERT_STORE_PROV_PHYSICAL_W
   3475 #define CERT_STORE_PROV_SMART_CARD_W ((LPCSTR) 15)
   3476 #define CERT_STORE_PROV_SMART_CARD CERT_STORE_PROV_SMART_CARD_W
   3477 #define CERT_STORE_PROV_LDAP_W ((LPCSTR) 16)
   3478 #define CERT_STORE_PROV_LDAP CERT_STORE_PROV_LDAP_W
   3479 #define CERT_STORE_PROV_PKCS12 ((LPCSTR) 17)
   3480 
   3481 #define sz_CERT_STORE_PROV_MEMORY "Memory"
   3482 #define sz_CERT_STORE_PROV_FILENAME_W "File"
   3483 #define sz_CERT_STORE_PROV_FILENAME sz_CERT_STORE_PROV_FILENAME_W
   3484 #define sz_CERT_STORE_PROV_SYSTEM_W "System"
   3485 #define sz_CERT_STORE_PROV_SYSTEM sz_CERT_STORE_PROV_SYSTEM_W
   3486 #define sz_CERT_STORE_PROV_PKCS7 "PKCS7"
   3487 #define sz_CERT_STORE_PROV_PKCS12 "PKCS12"
   3488 #define sz_CERT_STORE_PROV_SERIALIZED "Serialized"
   3489 
   3490 #define sz_CERT_STORE_PROV_COLLECTION "Collection"
   3491 #define sz_CERT_STORE_PROV_SYSTEM_REGISTRY_W "SystemRegistry"
   3492 #define sz_CERT_STORE_PROV_SYSTEM_REGISTRY sz_CERT_STORE_PROV_SYSTEM_REGISTRY_W
   3493 #define sz_CERT_STORE_PROV_PHYSICAL_W "Physical"
   3494 #define sz_CERT_STORE_PROV_PHYSICAL sz_CERT_STORE_PROV_PHYSICAL_W
   3495 
   3496 #define sz_CERT_STORE_PROV_SMART_CARD_W "SmartCard"
   3497 #define sz_CERT_STORE_PROV_SMART_CARD sz_CERT_STORE_PROV_SMART_CARD_W
   3498 
   3499 #define sz_CERT_STORE_PROV_LDAP_W "Ldap"
   3500 #define sz_CERT_STORE_PROV_LDAP sz_CERT_STORE_PROV_LDAP_W
   3501 
   3502 #define CERT_STORE_SIGNATURE_FLAG 0x1
   3503 #define CERT_STORE_TIME_VALIDITY_FLAG 0x2
   3504 #define CERT_STORE_REVOCATION_FLAG 0x4
   3505 #define CERT_STORE_NO_CRL_FLAG 0x10000
   3506 #define CERT_STORE_NO_ISSUER_FLAG 0x20000
   3507 
   3508 #define CERT_STORE_BASE_CRL_FLAG 0x100
   3509 #define CERT_STORE_DELTA_CRL_FLAG 0x200
   3510 
   3511 #define CERT_STORE_NO_CRYPT_RELEASE_FLAG 0x1
   3512 #define CERT_STORE_SET_LOCALIZED_NAME_FLAG 0x2
   3513 #define CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG 0x4
   3514 #define CERT_STORE_DELETE_FLAG 0x10
   3515 #define CERT_STORE_UNSAFE_PHYSICAL_FLAG 0x20
   3516 #define CERT_STORE_SHARE_STORE_FLAG 0x40
   3517 #define CERT_STORE_SHARE_CONTEXT_FLAG 0x80
   3518 #define CERT_STORE_MANIFOLD_FLAG 0x100
   3519 #define CERT_STORE_ENUM_ARCHIVED_FLAG 0x200
   3520 #define CERT_STORE_UPDATE_KEYID_FLAG 0x400
   3521 #define CERT_STORE_BACKUP_RESTORE_FLAG 0x800
   3522 #define CERT_STORE_READONLY_FLAG 0x8000
   3523 #define CERT_STORE_OPEN_EXISTING_FLAG 0x4000
   3524 #define CERT_STORE_CREATE_NEW_FLAG 0x2000
   3525 #define CERT_STORE_MAXIMUM_ALLOWED_FLAG 0x1000
   3526 
   3527 #define CERT_SYSTEM_STORE_MASK 0xffff0000
   3528 
   3529 #define CERT_SYSTEM_STORE_RELOCATE_FLAG 0x80000000
   3530 
   3531   typedef struct _CERT_SYSTEM_STORE_RELOCATE_PARA {
   3532     __C89_NAMELESS union {
   3533       HKEY hKeyBase;
   3534       void *pvBase;
   3535     };
   3536     __C89_NAMELESS union {
   3537       void *pvSystemStore;
   3538       LPCSTR pszSystemStore;
   3539       LPCWSTR pwszSystemStore;
   3540     };
   3541   } CERT_SYSTEM_STORE_RELOCATE_PARA,*PCERT_SYSTEM_STORE_RELOCATE_PARA;
   3542 
   3543 #define CERT_SYSTEM_STORE_DEFER_READ_FLAG 0x20000000
   3544 #define CERT_SYSTEM_STORE_UNPROTECTED_FLAG 0x40000000
   3545 
   3546 #define CERT_SYSTEM_STORE_LOCATION_MASK 0x00ff0000
   3547 #define CERT_SYSTEM_STORE_LOCATION_SHIFT 16
   3548 
   3549 #define CERT_SYSTEM_STORE_CURRENT_USER_ID 1
   3550 #define CERT_SYSTEM_STORE_LOCAL_MACHINE_ID 2
   3551 #define CERT_SYSTEM_STORE_CURRENT_SERVICE_ID 4
   3552 #define CERT_SYSTEM_STORE_SERVICES_ID 5
   3553 #define CERT_SYSTEM_STORE_USERS_ID 6
   3554 #define CERT_SYSTEM_STORE_CURRENT_USER_GROUP_POLICY_ID 7
   3555 #define CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY_ID 8
   3556 #define CERT_SYSTEM_STORE_LOCAL_MACHINE_ENTERPRISE_ID 9
   3557 
   3558 #define CERT_SYSTEM_STORE_CURRENT_USER (CERT_SYSTEM_STORE_CURRENT_USER_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
   3559 #define CERT_SYSTEM_STORE_LOCAL_MACHINE (CERT_SYSTEM_STORE_LOCAL_MACHINE_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
   3560 #define CERT_SYSTEM_STORE_CURRENT_SERVICE (CERT_SYSTEM_STORE_CURRENT_SERVICE_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
   3561 #define CERT_SYSTEM_STORE_SERVICES (CERT_SYSTEM_STORE_SERVICES_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
   3562 #define CERT_SYSTEM_STORE_USERS (CERT_SYSTEM_STORE_USERS_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
   3563 #define CERT_SYSTEM_STORE_CURRENT_USER_GROUP_POLICY (CERT_SYSTEM_STORE_CURRENT_USER_GROUP_POLICY_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
   3564 #define CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY (CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
   3565 #define CERT_SYSTEM_STORE_LOCAL_MACHINE_ENTERPRISE (CERT_SYSTEM_STORE_LOCAL_MACHINE_ENTERPRISE_ID << CERT_SYSTEM_STORE_LOCATION_SHIFT)
   3566 
   3567 #define CERT_GROUP_POLICY_SYSTEM_STORE_REGPATH L"Software\\Policies\\Microsoft\\SystemCertificates"
   3568 
   3569 #define CERT_EFSBLOB_REGPATH CERT_GROUP_POLICY_SYSTEM_STORE_REGPATH L"\\EFS"
   3570 #define CERT_EFSBLOB_VALUE_NAME L"EFSBlob"
   3571 
   3572 #define CERT_PROT_ROOT_FLAGS_REGPATH CERT_GROUP_POLICY_SYSTEM_STORE_REGPATH L"\\Root\\ProtectedRoots"
   3573 #define CERT_PROT_ROOT_FLAGS_VALUE_NAME L"Flags"
   3574 #define CERT_PROT_ROOT_DISABLE_CURRENT_USER_FLAG 0x1
   3575 #define CERT_PROT_ROOT_INHIBIT_ADD_AT_INIT_FLAG 0x2
   3576 #define CERT_PROT_ROOT_INHIBIT_PURGE_LM_FLAG 0x4
   3577 #define CERT_PROT_ROOT_DISABLE_LM_AUTH_FLAG 0x8
   3578 #define CERT_PROT_ROOT_ONLY_LM_GPT_FLAG 0x8
   3579 #define CERT_PROT_ROOT_DISABLE_NT_AUTH_REQUIRED_FLAG 0x10
   3580 #define CERT_PROT_ROOT_DISABLE_NOT_DEFINED_NAME_CONSTRAINT_FLAG 0x20
   3581 #define CERT_PROT_ROOT_DISABLE_PEER_TRUST 0x10000
   3582 #define CERT_PROT_ROOT_PEER_USAGES_VALUE_NAME L"PeerUsages"
   3583 #define CERT_PROT_ROOT_PEER_USAGES_VALUE_NAME_A "PeerUsages"
   3584 #define CERT_PROT_ROOT_PEER_USAGES_DEFAULT_A szOID_PKIX_KP_CLIENT_AUTH "\0" szOID_PKIX_KP_EMAIL_PROTECTION "\0" szOID_KP_EFS "\0"
   3585 
   3586 #define CERT_TRUST_PUB_SAFER_GROUP_POLICY_REGPATH CERT_GROUP_POLICY_SYSTEM_STORE_REGPATH L"\\TrustedPublisher\\Safer"
   3587 #define CERT_LOCAL_MACHINE_SYSTEM_STORE_REGPATH L"Software\\Microsoft\\SystemCertificates"
   3588 #define CERT_TRUST_PUB_SAFER_LOCAL_MACHINE_REGPATH CERT_LOCAL_MACHINE_SYSTEM_STORE_REGPATH L"\\TrustedPublisher\\Safer"
   3589 #define CERT_TRUST_PUB_AUTHENTICODE_FLAGS_VALUE_NAME L"AuthenticodeFlags"
   3590 
   3591 #define CERT_TRUST_PUB_ALLOW_TRUST_MASK 0x3
   3592 #define CERT_TRUST_PUB_ALLOW_END_USER_TRUST 0x0
   3593 #define CERT_TRUST_PUB_ALLOW_MACHINE_ADMIN_TRUST 0x1
   3594 #define CERT_TRUST_PUB_ALLOW_ENTERPRISE_ADMIN_TRUST 0x2
   3595 #define CERT_TRUST_PUB_CHECK_PUBLISHER_REV_FLAG 0x100
   3596 #define CERT_TRUST_PUB_CHECK_TIMESTAMP_REV_FLAG 0x200
   3597 
   3598 #define CERT_OCM_SUBCOMPONENTS_LOCAL_MACHINE_REGPATH L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\OC Manager\\Subcomponents"
   3599 #define CERT_OCM_SUBCOMPONENTS_ROOT_AUTO_UPDATE_VALUE_NAME L"RootAutoUpdate"
   3600 
   3601 #define CERT_DISABLE_ROOT_AUTO_UPDATE_REGPATH CERT_GROUP_POLICY_SYSTEM_STORE_REGPATH L"\\AuthRoot"
   3602 #define CERT_DISABLE_ROOT_AUTO_UPDATE_VALUE_NAME L"DisableRootAutoUpdate"
   3603 
   3604 #define CERT_AUTO_UPDATE_LOCAL_MACHINE_REGPATH CERT_LOCAL_MACHINE_SYSTEM_STORE_REGPATH L"\\AuthRoot\\AutoUpdate"
   3605 #define CERT_AUTO_UPDATE_ROOT_DIR_URL_VALUE_NAME L"RootDirUrl"
   3606 
   3607 #define CERT_AUTH_ROOT_AUTO_UPDATE_LOCAL_MACHINE_REGPATH CERT_AUTO_UPDATE_LOCAL_MACHINE_REGPATH
   3608 #define CERT_AUTH_ROOT_AUTO_UPDATE_ROOT_DIR_URL_VALUE_NAME CERT_AUTO_UPDATE_ROOT_DIR_URL_VALUE_NAME
   3609 #define CERT_AUTH_ROOT_AUTO_UPDATE_SYNC_DELTA_TIME_VALUE_NAME L"SyncDeltaTime"
   3610 #define CERT_AUTH_ROOT_AUTO_UPDATE_FLAGS_VALUE_NAME L"Flags"
   3611 #define CERT_AUTH_ROOT_AUTO_UPDATE_DISABLE_UNTRUSTED_ROOT_LOGGING_FLAG 0x1
   3612 #define CERT_AUTH_ROOT_AUTO_UPDATE_DISABLE_PARTIAL_CHAIN_LOGGING_FLAG 0x2
   3613 #define CERT_AUTO_UPDATE_DISABLE_RANDOM_QUERY_STRING_FLAG 0x4
   3614 #define CERT_AUTH_ROOT_AUTO_UPDATE_LAST_SYNC_TIME_VALUE_NAME L"LastSyncTime"
   3615 #define CERT_AUTH_ROOT_AUTO_UPDATE_ENCODED_CTL_VALUE_NAME L"EncodedCtl"
   3616 #define CERT_AUTH_ROOT_CTL_FILENAME L"authroot.stl"
   3617 #define CERT_AUTH_ROOT_CTL_FILENAME_A "authroot.stl"
   3618 #define CERT_AUTH_ROOT_CAB_FILENAME L"authrootstl.cab"
   3619 #define CERT_AUTH_ROOT_SEQ_FILENAME L"authrootseq.txt"
   3620 #define CERT_AUTH_ROOT_CERT_EXT L".crt"
   3621 
   3622 #define CERT_DISALLOWED_CERT_AUTO_UPDATE_SYNC_DELTA_TIME_VALUE_NAME L"DisallowedCertSyncDeltaTime"
   3623 #define CERT_DISALLOWED_CERT_AUTO_UPDATE_LAST_SYNC_TIME_VALUE_NAME L"DisallowedCertLastSyncTime"
   3624 #define CERT_DISALLOWED_CERT_AUTO_UPDATE_ENCODED_CTL_VALUE_NAME L"DisallowedCertEncodedCtl"
   3625 #define CERT_DISALLOWED_CERT_CTL_FILENAME L"disallowedcert.stl"
   3626 #define CERT_DISALLOWED_CERT_CTL_FILENAME_A "disallowedcert.stl"
   3627 #define CERT_DISALLOWED_CERT_CAB_FILENAME L"disallowedcertstl.cab"
   3628 #define CERT_DISALLOWED_CERT_AUTO_UPDATE_LIST_IDENTIFIER L"DisallowedCert_AutoUpdate_1"
   3629 
   3630 #define CERT_REGISTRY_STORE_REMOTE_FLAG 0x10000
   3631 #define CERT_REGISTRY_STORE_SERIALIZED_FLAG 0x20000
   3632 #define CERT_REGISTRY_STORE_CLIENT_GPT_FLAG 0x80000000
   3633 #define CERT_REGISTRY_STORE_LM_GPT_FLAG 0x1000000
   3634 
   3635   typedef struct _CERT_REGISTRY_STORE_CLIENT_GPT_PARA {
   3636     HKEY hKeyBase;
   3637     LPWSTR pwszRegPath;
   3638   } CERT_REGISTRY_STORE_CLIENT_GPT_PARA,*PCERT_REGISTRY_STORE_CLIENT_GPT_PARA;
   3639 
   3640 #define CERT_REGISTRY_STORE_ROAMING_FLAG 0x40000
   3641 
   3642   typedef struct _CERT_REGISTRY_STORE_ROAMING_PARA {
   3643     HKEY hKey;
   3644     LPWSTR pwszStoreDirectory;
   3645   } CERT_REGISTRY_STORE_ROAMING_PARA,*PCERT_REGISTRY_STORE_ROAMING_PARA;
   3646 
   3647 #define CERT_REGISTRY_STORE_MY_IE_DIRTY_FLAG 0x80000
   3648 #define CERT_REGISTRY_STORE_EXTERNAL_FLAG 0x100000
   3649 
   3650 #define CERT_IE_DIRTY_FLAGS_REGPATH L"Software\\Microsoft\\Cryptography\\IEDirtyFlags"
   3651 
   3652 #define CERT_FILE_STORE_COMMIT_ENABLE_FLAG 0x10000
   3653 #define CERT_LDAP_STORE_SIGN_FLAG 0x10000
   3654 #define CERT_LDAP_STORE_AREC_EXCLUSIVE_FLAG 0x20000
   3655 #define CERT_LDAP_STORE_OPENED_FLAG 0x40000
   3656 
   3657   typedef struct _CERT_LDAP_STORE_OPENED_PARA {
   3658     void *pvLdapSessionHandle;
   3659     LPCWSTR pwszLdapUrl;
   3660   } CERT_LDAP_STORE_OPENED_PARA,*PCERT_LDAP_STORE_OPENED_PARA;
   3661 
   3662 #define CERT_LDAP_STORE_UNBIND_FLAG 0x80000
   3663 
   3664   WINIMPM HCERTSTORE WINAPI CertOpenStore (LPCSTR lpszStoreProvider, DWORD dwEncodingType, HCRYPTPROV_LEGACY hCryptProv, DWORD dwFlags, const void *pvPara);
   3665 
   3666   typedef void *HCERTSTOREPROV;
   3667 
   3668 #define CRYPT_OID_OPEN_STORE_PROV_FUNC "CertDllOpenStoreProv"
   3669 
   3670   typedef struct _CERT_STORE_PROV_INFO {
   3671     DWORD cbSize;
   3672     DWORD cStoreProvFunc;
   3673     void **rgpvStoreProvFunc;
   3674     HCERTSTOREPROV hStoreProv;
   3675     DWORD dwStoreProvFlags;
   3676     HCRYPTOIDFUNCADDR hStoreProvFuncAddr2;
   3677   } CERT_STORE_PROV_INFO,*PCERT_STORE_PROV_INFO;
   3678 
   3679   typedef WINBOOL (WINAPI *PFN_CERT_DLL_OPEN_STORE_PROV_FUNC) (LPCSTR lpszStoreProvider, DWORD dwEncodingType, HCRYPTPROV_LEGACY hCryptProv, DWORD dwFlags, const void *pvPara, HCERTSTORE hCertStore, PCERT_STORE_PROV_INFO pStoreProvInfo);
   3680 
   3681 #define CERT_STORE_PROV_EXTERNAL_FLAG 0x1
   3682 #define CERT_STORE_PROV_DELETED_FLAG 0x2
   3683 #define CERT_STORE_PROV_NO_PERSIST_FLAG 0x4
   3684 #define CERT_STORE_PROV_SYSTEM_STORE_FLAG 0x8
   3685 #define CERT_STORE_PROV_LM_SYSTEM_STORE_FLAG 0x10
   3686 #define CERT_STORE_PROV_GP_SYSTEM_STORE_FLAG 0x20
   3687 #define CERT_STORE_PROV_SHARED_USER_FLAG 0x40
   3688 
   3689 #define CERT_STORE_PROV_CLOSE_FUNC 0
   3690 #define CERT_STORE_PROV_READ_CERT_FUNC 1
   3691 #define CERT_STORE_PROV_WRITE_CERT_FUNC 2
   3692 #define CERT_STORE_PROV_DELETE_CERT_FUNC 3
   3693 #define CERT_STORE_PROV_SET_CERT_PROPERTY_FUNC 4
   3694 #define CERT_STORE_PROV_READ_CRL_FUNC 5
   3695 #define CERT_STORE_PROV_WRITE_CRL_FUNC 6
   3696 #define CERT_STORE_PROV_DELETE_CRL_FUNC 7
   3697 #define CERT_STORE_PROV_SET_CRL_PROPERTY_FUNC 8
   3698 #define CERT_STORE_PROV_READ_CTL_FUNC 9
   3699 #define CERT_STORE_PROV_WRITE_CTL_FUNC 10
   3700 #define CERT_STORE_PROV_DELETE_CTL_FUNC 11
   3701 #define CERT_STORE_PROV_SET_CTL_PROPERTY_FUNC 12
   3702 #define CERT_STORE_PROV_CONTROL_FUNC 13
   3703 #define CERT_STORE_PROV_FIND_CERT_FUNC 14
   3704 #define CERT_STORE_PROV_FREE_FIND_CERT_FUNC 15
   3705 #define CERT_STORE_PROV_GET_CERT_PROPERTY_FUNC 16
   3706 #define CERT_STORE_PROV_FIND_CRL_FUNC 17
   3707 #define CERT_STORE_PROV_FREE_FIND_CRL_FUNC 18
   3708 #define CERT_STORE_PROV_GET_CRL_PROPERTY_FUNC 19
   3709 #define CERT_STORE_PROV_FIND_CTL_FUNC 20
   3710 #define CERT_STORE_PROV_FREE_FIND_CTL_FUNC 21
   3711 #define CERT_STORE_PROV_GET_CTL_PROPERTY_FUNC 22
   3712 
   3713 #define CERT_STORE_PROV_WRITE_ADD_FLAG 0x1
   3714 
   3715   typedef void (WINAPI *PFN_CERT_STORE_PROV_CLOSE) (HCERTSTOREPROV hStoreProv, DWORD dwFlags);
   3716   typedef WINBOOL (WINAPI *PFN_CERT_STORE_PROV_READ_CERT) (HCERTSTOREPROV hStoreProv, PCCERT_CONTEXT pStoreCertContext, DWORD dwFlags, PCCERT_CONTEXT *ppProvCertContext);
   3717   typedef WINBOOL (WINAPI *PFN_CERT_STORE_PROV_WRITE_CERT) (HCERTSTOREPROV hStoreProv, PCCERT_CONTEXT pCertContext, DWORD dwFlags);
   3718   typedef WINBOOL (WINAPI *PFN_CERT_STORE_PROV_DELETE_CERT) (HCERTSTOREPROV hStoreProv, PCCERT_CONTEXT pCertContext, DWORD dwFlags);
   3719   typedef WINBOOL (WINAPI *PFN_CERT_STORE_PROV_SET_CERT_PROPERTY) (HCERTSTOREPROV hStoreProv, PCCERT_CONTEXT pCertContext, DWORD dwPropId, DWORD dwFlags, const void *pvData);
   3720   typedef WINBOOL (WINAPI *PFN_CERT_STORE_PROV_READ_CRL) (HCERTSTOREPROV hStoreProv, PCCRL_CONTEXT pStoreCrlContext, DWORD dwFlags, PCCRL_CONTEXT *ppProvCrlContext);
   3721   typedef WINBOOL (WINAPI *PFN_CERT_STORE_PROV_WRITE_CRL) (HCERTSTOREPROV hStoreProv, PCCRL_CONTEXT pCrlContext, DWORD dwFlags);
   3722   typedef WINBOOL (WINAPI *PFN_CERT_STORE_PROV_DELETE_CRL) (HCERTSTOREPROV hStoreProv, PCCRL_CONTEXT pCrlContext, DWORD dwFlags);
   3723   typedef WINBOOL (WINAPI *PFN_CERT_STORE_PROV_SET_CRL_PROPERTY) (HCERTSTOREPROV hStoreProv, PCCRL_CONTEXT pCrlContext, DWORD dwPropId, DWORD dwFlags, const void *pvData);
   3724   typedef WINBOOL (WINAPI *PFN_CERT_STORE_PROV_READ_CTL) (HCERTSTOREPROV hStoreProv, PCCTL_CONTEXT pStoreCtlContext, DWORD dwFlags, PCCTL_CONTEXT *ppProvCtlContext);
   3725   typedef WINBOOL (WINAPI *PFN_CERT_STORE_PROV_WRITE_CTL) (HCERTSTOREPROV hStoreProv, PCCTL_CONTEXT pCtlContext, DWORD dwFlags);
   3726   typedef WINBOOL (WINAPI *PFN_CERT_STORE_PROV_DELETE_CTL) (HCERTSTOREPROV hStoreProv, PCCTL_CONTEXT pCtlContext, DWORD dwFlags);
   3727   typedef WINBOOL (WINAPI *PFN_CERT_STORE_PROV_SET_CTL_PROPERTY) (HCERTSTOREPROV hStoreProv, PCCTL_CONTEXT pCtlContext, DWORD dwPropId, DWORD dwFlags, const void *pvData);
   3728   typedef WINBOOL (WINAPI *PFN_CERT_STORE_PROV_CONTROL) (HCERTSTOREPROV hStoreProv, DWORD dwFlags, DWORD dwCtrlType, void const *pvCtrlPara);
   3729 
   3730   typedef struct _CERT_STORE_PROV_FIND_INFO {
   3731     DWORD cbSize;
   3732     DWORD dwMsgAndCertEncodingType;
   3733     DWORD dwFindFlags;
   3734     DWORD dwFindType;
   3735     const void *pvFindPara;
   3736   } CERT_STORE_PROV_FIND_INFO,*PCERT_STORE_PROV_FIND_INFO;
   3737 
   3738   typedef const CERT_STORE_PROV_FIND_INFO CCERT_STORE_PROV_FIND_INFO,*PCCERT_STORE_PROV_FIND_INFO;
   3739 
   3740   typedef WINBOOL (WINAPI *PFN_CERT_STORE_PROV_FIND_CERT) (HCERTSTOREPROV hStoreProv, PCCERT_STORE_PROV_FIND_INFO pFindInfo, PCCERT_CONTEXT pPrevCertContext, DWORD dwFlags, void **ppvStoreProvFindInfo, PCCERT_CONTEXT *ppProvCertContext);
   3741   typedef WINBOOL (WINAPI *PFN_CERT_STORE_PROV_FREE_FIND_CERT) (HCERTSTOREPROV hStoreProv, PCCERT_CONTEXT pCertContext, void *pvStoreProvFindInfo, DWORD dwFlags);
   3742   typedef WINBOOL (WINAPI *PFN_CERT_STORE_PROV_GET_CERT_PROPERTY) (HCERTSTOREPROV hStoreProv, PCCERT_CONTEXT pCertContext, DWORD dwPropId, DWORD dwFlags, void *pvData, DWORD *pcbData);
   3743   typedef WINBOOL (WINAPI *PFN_CERT_STORE_PROV_FIND_CRL) (HCERTSTOREPROV hStoreProv, PCCERT_STORE_PROV_FIND_INFO pFindInfo, PCCRL_CONTEXT pPrevCrlContext, DWORD dwFlags, void **ppvStoreProvFindInfo, PCCRL_CONTEXT *ppProvCrlContext);
   3744   typedef WINBOOL (WINAPI *PFN_CERT_STORE_PROV_FREE_FIND_CRL) (HCERTSTOREPROV hStoreProv, PCCRL_CONTEXT pCrlContext, void *pvStoreProvFindInfo, DWORD dwFlags);
   3745   typedef WINBOOL (WINAPI *PFN_CERT_STORE_PROV_GET_CRL_PROPERTY) (HCERTSTOREPROV hStoreProv, PCCRL_CONTEXT pCrlContext, DWORD dwPropId, DWORD dwFlags, void *pvData, DWORD *pcbData);
   3746   typedef WINBOOL (WINAPI *PFN_CERT_STORE_PROV_FIND_CTL) (HCERTSTOREPROV hStoreProv, PCCERT_STORE_PROV_FIND_INFO pFindInfo, PCCTL_CONTEXT pPrevCtlContext, DWORD dwFlags, void **ppvStoreProvFindInfo, PCCTL_CONTEXT *ppProvCtlContext);
   3747   typedef WINBOOL (WINAPI *PFN_CERT_STORE_PROV_FREE_FIND_CTL) (HCERTSTOREPROV hStoreProv, PCCTL_CONTEXT pCtlContext, void *pvStoreProvFindInfo, DWORD dwFlags);
   3748   typedef WINBOOL (WINAPI *PFN_CERT_STORE_PROV_GET_CTL_PROPERTY) (HCERTSTOREPROV hStoreProv, PCCTL_CONTEXT pCtlContext, DWORD dwPropId, DWORD dwFlags, void *pvData, DWORD *pcbData);
   3749 
   3750   WINIMPM HCERTSTORE WINAPI CertDuplicateStore (HCERTSTORE hCertStore);
   3751 
   3752 #define CERT_STORE_SAVE_AS_STORE 1
   3753 #define CERT_STORE_SAVE_AS_PKCS7 2
   3754 #define CERT_STORE_SAVE_AS_PKCS12 3
   3755 
   3756 #define CERT_STORE_SAVE_TO_FILE 1
   3757 #define CERT_STORE_SAVE_TO_MEMORY 2
   3758 #define CERT_STORE_SAVE_TO_FILENAME_A 3
   3759 #define CERT_STORE_SAVE_TO_FILENAME_W 4
   3760 #define CERT_STORE_SAVE_TO_FILENAME CERT_STORE_SAVE_TO_FILENAME_W
   3761 
   3762 #define CERT_CLOSE_STORE_FORCE_FLAG 0x1
   3763 #define CERT_CLOSE_STORE_CHECK_FLAG 0x2
   3764 
   3765   WINIMPM WINBOOL WINAPI CertSaveStore (HCERTSTORE hCertStore, DWORD dwEncodingType, DWORD dwSaveAs, DWORD dwSaveTo, void *pvSaveToPara, DWORD dwFlags);
   3766   WINIMPM WINBOOL WINAPI CertCloseStore (HCERTSTORE hCertStore, DWORD dwFlags);
   3767   WINIMPM PCCERT_CONTEXT WINAPI CertGetSubjectCertificateFromStore (HCERTSTORE hCertStore, DWORD dwCertEncodingType, PCERT_INFO pCertId);
   3768   WINIMPM PCCERT_CONTEXT WINAPI CertEnumCertificatesInStore (HCERTSTORE hCertStore, PCCERT_CONTEXT pPrevCertContext);
   3769   WINIMPM PCCERT_CONTEXT WINAPI CertFindCertificateInStore (HCERTSTORE hCertStore, DWORD dwCertEncodingType, DWORD dwFindFlags, DWORD dwFindType, const void *pvFindPara, PCCERT_CONTEXT pPrevCertContext);
   3770 
   3771 #define CERT_COMPARE_MASK 0xffff
   3772 #define CERT_COMPARE_SHIFT 16
   3773 #define CERT_COMPARE_ANY 0
   3774 #define CERT_COMPARE_SHA1_HASH 1
   3775 #define CERT_COMPARE_NAME 2
   3776 #define CERT_COMPARE_ATTR 3
   3777 #define CERT_COMPARE_MD5_HASH 4
   3778 #define CERT_COMPARE_PROPERTY 5
   3779 #define CERT_COMPARE_PUBLIC_KEY 6
   3780 #define CERT_COMPARE_HASH CERT_COMPARE_SHA1_HASH
   3781 #define CERT_COMPARE_NAME_STR_A 7
   3782 #define CERT_COMPARE_NAME_STR_W 8
   3783 #define CERT_COMPARE_KEY_SPEC 9
   3784 #define CERT_COMPARE_ENHKEY_USAGE 10
   3785 #define CERT_COMPARE_CTL_USAGE CERT_COMPARE_ENHKEY_USAGE
   3786 #define CERT_COMPARE_SUBJECT_CERT 11
   3787 #define CERT_COMPARE_ISSUER_OF 12
   3788 #define CERT_COMPARE_EXISTING 13
   3789 #define CERT_COMPARE_SIGNATURE_HASH 14
   3790 #define CERT_COMPARE_KEY_IDENTIFIER 15
   3791 #define CERT_COMPARE_CERT_ID 16
   3792 #define CERT_COMPARE_CROSS_CERT_DIST_POINTS 17
   3793 #define CERT_COMPARE_PUBKEY_MD5_HASH 18
   3794 #define CERT_COMPARE_SUBJECT_INFO_ACCESS 19
   3795 #define CERT_COMPARE_HASH_STR 20
   3796 #define CERT_COMPARE_HAS_PRIVATE_KEY 21
   3797 
   3798 #define CERT_FIND_ANY (CERT_COMPARE_ANY << CERT_COMPARE_SHIFT)
   3799 #define CERT_FIND_SHA1_HASH (CERT_COMPARE_SHA1_HASH << CERT_COMPARE_SHIFT)
   3800 #define CERT_FIND_MD5_HASH (CERT_COMPARE_MD5_HASH << CERT_COMPARE_SHIFT)
   3801 #define CERT_FIND_SIGNATURE_HASH (CERT_COMPARE_SIGNATURE_HASH << CERT_COMPARE_SHIFT)
   3802 #define CERT_FIND_KEY_IDENTIFIER (CERT_COMPARE_KEY_IDENTIFIER << CERT_COMPARE_SHIFT)
   3803 #define CERT_FIND_HASH CERT_FIND_SHA1_HASH
   3804 #define CERT_FIND_PROPERTY (CERT_COMPARE_PROPERTY << CERT_COMPARE_SHIFT)
   3805 #define CERT_FIND_PUBLIC_KEY (CERT_COMPARE_PUBLIC_KEY << CERT_COMPARE_SHIFT)
   3806 #define CERT_FIND_SUBJECT_NAME (CERT_COMPARE_NAME << CERT_COMPARE_SHIFT | CERT_INFO_SUBJECT_FLAG)
   3807 #define CERT_FIND_SUBJECT_ATTR (CERT_COMPARE_ATTR << CERT_COMPARE_SHIFT | CERT_INFO_SUBJECT_FLAG)
   3808 #define CERT_FIND_ISSUER_NAME (CERT_COMPARE_NAME << CERT_COMPARE_SHIFT | CERT_INFO_ISSUER_FLAG)
   3809 #define CERT_FIND_ISSUER_ATTR (CERT_COMPARE_ATTR << CERT_COMPARE_SHIFT | CERT_INFO_ISSUER_FLAG)
   3810 #define CERT_FIND_SUBJECT_STR_A (CERT_COMPARE_NAME_STR_A << CERT_COMPARE_SHIFT | CERT_INFO_SUBJECT_FLAG)
   3811 #define CERT_FIND_SUBJECT_STR_W (CERT_COMPARE_NAME_STR_W << CERT_COMPARE_SHIFT | CERT_INFO_SUBJECT_FLAG)
   3812 #define CERT_FIND_SUBJECT_STR CERT_FIND_SUBJECT_STR_W
   3813 #define CERT_FIND_ISSUER_STR_A (CERT_COMPARE_NAME_STR_A << CERT_COMPARE_SHIFT | CERT_INFO_ISSUER_FLAG)
   3814 #define CERT_FIND_ISSUER_STR_W (CERT_COMPARE_NAME_STR_W << CERT_COMPARE_SHIFT | CERT_INFO_ISSUER_FLAG)
   3815 #define CERT_FIND_ISSUER_STR CERT_FIND_ISSUER_STR_W
   3816 #define CERT_FIND_KEY_SPEC (CERT_COMPARE_KEY_SPEC << CERT_COMPARE_SHIFT)
   3817 #define CERT_FIND_ENHKEY_USAGE (CERT_COMPARE_ENHKEY_USAGE << CERT_COMPARE_SHIFT)
   3818 #define CERT_FIND_CTL_USAGE CERT_FIND_ENHKEY_USAGE
   3819 #define CERT_FIND_SUBJECT_CERT (CERT_COMPARE_SUBJECT_CERT << CERT_COMPARE_SHIFT)
   3820 #define CERT_FIND_ISSUER_OF (CERT_COMPARE_ISSUER_OF << CERT_COMPARE_SHIFT)
   3821 #define CERT_FIND_EXISTING (CERT_COMPARE_EXISTING << CERT_COMPARE_SHIFT)
   3822 #define CERT_FIND_CERT_ID (CERT_COMPARE_CERT_ID << CERT_COMPARE_SHIFT)
   3823 #define CERT_FIND_CROSS_CERT_DIST_POINTS (CERT_COMPARE_CROSS_CERT_DIST_POINTS << CERT_COMPARE_SHIFT)
   3824 #define CERT_FIND_PUBKEY_MD5_HASH (CERT_COMPARE_PUBKEY_MD5_HASH << CERT_COMPARE_SHIFT)
   3825 #define CERT_FIND_SUBJECT_INFO_ACCESS (CERT_COMPARE_SUBJECT_INFO_ACCESS << CERT_COMPARE_SHIFT)
   3826 #define CERT_FIND_HASH_STR (CERT_COMPARE_HASH_STR << CERT_COMPARE_SHIFT)
   3827 #define CERT_FIND_HAS_PRIVATE_KEY (CERT_COMPARE_HAS_PRIVATE_KEY << CERT_COMPARE_SHIFT)
   3828 
   3829 #define CERT_FIND_OPTIONAL_ENHKEY_USAGE_FLAG 0x1
   3830 #define CERT_FIND_EXT_ONLY_ENHKEY_USAGE_FLAG 0x2
   3831 #define CERT_FIND_PROP_ONLY_ENHKEY_USAGE_FLAG 0x4
   3832 #define CERT_FIND_NO_ENHKEY_USAGE_FLAG 0x8
   3833 #define CERT_FIND_OR_ENHKEY_USAGE_FLAG 0x10
   3834 #define CERT_FIND_VALID_ENHKEY_USAGE_FLAG 0x20
   3835 
   3836 #define CERT_FIND_OPTIONAL_CTL_USAGE_FLAG CERT_FIND_OPTIONAL_ENHKEY_USAGE_FLAG
   3837 #define CERT_FIND_EXT_ONLY_CTL_USAGE_FLAG CERT_FIND_EXT_ONLY_ENHKEY_USAGE_FLAG
   3838 #define CERT_FIND_PROP_ONLY_CTL_USAGE_FLAG CERT_FIND_PROP_ONLY_ENHKEY_USAGE_FLAG
   3839 #define CERT_FIND_NO_CTL_USAGE_FLAG CERT_FIND_NO_ENHKEY_USAGE_FLAG
   3840 #define CERT_FIND_OR_CTL_USAGE_FLAG CERT_FIND_OR_ENHKEY_USAGE_FLAG
   3841 #define CERT_FIND_VALID_CTL_USAGE_FLAG CERT_FIND_VALID_ENHKEY_USAGE_FLAG
   3842 
   3843   WINIMPM PCCERT_CONTEXT WINAPI CertGetIssuerCertificateFromStore (HCERTSTORE hCertStore, PCCERT_CONTEXT pSubjectContext, PCCERT_CONTEXT pPrevIssuerContext, DWORD *pdwFlags);
   3844   WINIMPM WINBOOL WINAPI CertVerifySubjectCertificateContext (PCCERT_CONTEXT pSubject, PCCERT_CONTEXT pIssuer, DWORD *pdwFlags);
   3845   WINIMPM PCCERT_CONTEXT WINAPI CertDuplicateCertificateContext (PCCERT_CONTEXT pCertContext);
   3846   WINIMPM PCCERT_CONTEXT WINAPI CertCreateCertificateContext (DWORD dwCertEncodingType, const BYTE *pbCertEncoded, DWORD cbCertEncoded);
   3847   WINIMPM WINBOOL WINAPI CertFreeCertificateContext (PCCERT_CONTEXT pCertContext);
   3848   WINIMPM WINBOOL WINAPI CertSetCertificateContextProperty (PCCERT_CONTEXT pCertContext, DWORD dwPropId, DWORD dwFlags, const void *pvData);
   3849 
   3850   typedef struct _CRL_FIND_ISSUED_FOR_PARA {
   3851     PCCERT_CONTEXT pSubjectCert;
   3852     PCCERT_CONTEXT pIssuerCert;
   3853   } CRL_FIND_ISSUED_FOR_PARA,*PCRL_FIND_ISSUED_FOR_PARA;
   3854 
   3855   typedef struct _CTL_ANY_SUBJECT_INFO {
   3856     CRYPT_ALGORITHM_IDENTIFIER SubjectAlgorithm;
   3857     CRYPT_DATA_BLOB SubjectIdentifier;
   3858   } CTL_ANY_SUBJECT_INFO,*PCTL_ANY_SUBJECT_INFO;
   3859 
   3860 #define CERT_SET_PROPERTY_INHIBIT_PERSIST_FLAG 0x40000000
   3861 #define CERT_SET_PROPERTY_IGNORE_PERSIST_ERROR_FLAG 0x80000000
   3862 
   3863 #define CTL_ENTRY_FROM_PROP_CHAIN_FLAG 0x1
   3864 
   3865 #define CRL_FIND_ANY 0
   3866 #define CRL_FIND_ISSUED_BY 1
   3867 #define CRL_FIND_EXISTING 2
   3868 #define CRL_FIND_ISSUED_FOR 3
   3869 
   3870 #define CRL_FIND_ISSUED_BY_AKI_FLAG 0x1
   3871 #define CRL_FIND_ISSUED_BY_SIGNATURE_FLAG 0x2
   3872 #define CRL_FIND_ISSUED_BY_DELTA_FLAG 0x4
   3873 #define CRL_FIND_ISSUED_BY_BASE_FLAG 0x8
   3874 #define CRL_FIND_ISSUED_FOR_SET_STRONG_PROPERTIES_FLAG 0x10
   3875 
   3876 #define CERT_STORE_ADD_NEW 1
   3877 #define CERT_STORE_ADD_USE_EXISTING 2
   3878 #define CERT_STORE_ADD_REPLACE_EXISTING 3
   3879 #define CERT_STORE_ADD_ALWAYS 4
   3880 #define CERT_STORE_ADD_REPLACE_EXISTING_INHERIT_PROPERTIES 5
   3881 #define CERT_STORE_ADD_NEWER 6
   3882 #define CERT_STORE_ADD_NEWER_INHERIT_PROPERTIES 7
   3883 
   3884 #define CERT_STORE_CERTIFICATE_CONTEXT 1
   3885 #define CERT_STORE_CRL_CONTEXT 2
   3886 #define CERT_STORE_CTL_CONTEXT 3
   3887 
   3888 #define CERT_STORE_ALL_CONTEXT_FLAG (~__MSABI_LONG(0U))
   3889 #define CERT_STORE_CERTIFICATE_CONTEXT_FLAG (1 << CERT_STORE_CERTIFICATE_CONTEXT)
   3890 #define CERT_STORE_CRL_CONTEXT_FLAG (1 << CERT_STORE_CRL_CONTEXT)
   3891 #define CERT_STORE_CTL_CONTEXT_FLAG (1 << CERT_STORE_CTL_CONTEXT)
   3892 
   3893 #define CTL_ANY_SUBJECT_TYPE 1
   3894 #define CTL_CERT_SUBJECT_TYPE 2
   3895 
   3896   WINIMPM WINBOOL WINAPI CertGetCertificateContextProperty (PCCERT_CONTEXT pCertContext, DWORD dwPropId, void *pvData, DWORD *pcbData);
   3897   WINIMPM DWORD WINAPI CertEnumCertificateContextProperties (PCCERT_CONTEXT pCertContext, DWORD dwPropId);
   3898   WINIMPM WINBOOL WINAPI CertCreateCTLEntryFromCertificateContextProperties (PCCERT_CONTEXT pCertContext, DWORD cOptAttr, PCRYPT_ATTRIBUTE rgOptAttr, DWORD dwFlags, void *pvReserved, PCTL_ENTRY pCtlEntry, DWORD *pcbCtlEntry);
   3899   WINIMPM WINBOOL WINAPI CertSetCertificateContextPropertiesFromCTLEntry (PCCERT_CONTEXT pCertContext, PCTL_ENTRY pCtlEntry, DWORD dwFlags);
   3900   WINIMPM PCCRL_CONTEXT WINAPI CertGetCRLFromStore (HCERTSTORE hCertStore, PCCERT_CONTEXT pIssuerContext, PCCRL_CONTEXT pPrevCrlContext, DWORD *pdwFlags);
   3901   WINIMPM PCCRL_CONTEXT WINAPI CertEnumCRLsInStore (HCERTSTORE hCertStore, PCCRL_CONTEXT pPrevCrlContext);
   3902   WINIMPM PCCRL_CONTEXT WINAPI CertFindCRLInStore (HCERTSTORE hCertStore, DWORD dwCertEncodingType, DWORD dwFindFlags, DWORD dwFindType, const void *pvFindPara, PCCRL_CONTEXT pPrevCrlContext);
   3903   WINIMPM PCCRL_CONTEXT WINAPI CertDuplicateCRLContext (PCCRL_CONTEXT pCrlContext);
   3904   WINIMPM PCCRL_CONTEXT WINAPI CertCreateCRLContext (DWORD dwCertEncodingType, const BYTE *pbCrlEncoded, DWORD cbCrlEncoded);
   3905   WINIMPM WINBOOL WINAPI CertFreeCRLContext (PCCRL_CONTEXT pCrlContext);
   3906   WINIMPM WINBOOL WINAPI CertSetCRLContextProperty (PCCRL_CONTEXT pCrlContext, DWORD dwPropId, DWORD dwFlags, const void *pvData);
   3907   WINIMPM WINBOOL WINAPI CertGetCRLContextProperty (PCCRL_CONTEXT pCrlContext, DWORD dwPropId, void *pvData, DWORD *pcbData);
   3908   WINIMPM DWORD WINAPI CertEnumCRLContextProperties (PCCRL_CONTEXT pCrlContext, DWORD dwPropId);
   3909   WINIMPM WINBOOL WINAPI CertFindCertificateInCRL (PCCERT_CONTEXT pCert, PCCRL_CONTEXT pCrlContext, DWORD dwFlags, void *pvReserved, PCRL_ENTRY *ppCrlEntry);
   3910   WINIMPM WINBOOL WINAPI CertIsValidCRLForCertificate (PCCERT_CONTEXT pCert, PCCRL_CONTEXT pCrl, DWORD dwFlags, void *pvReserved);
   3911   WINIMPM WINBOOL WINAPI CertAddEncodedCertificateToStore (HCERTSTORE hCertStore, DWORD dwCertEncodingType, const BYTE *pbCertEncoded, DWORD cbCertEncoded, DWORD dwAddDisposition, PCCERT_CONTEXT *ppCertContext);
   3912   WINIMPM WINBOOL WINAPI CertAddCertificateContextToStore (HCERTSTORE hCertStore, PCCERT_CONTEXT pCertContext, DWORD dwAddDisposition, PCCERT_CONTEXT *ppStoreContext);
   3913   WINIMPM WINBOOL WINAPI CertAddSerializedElementToStore (HCERTSTORE hCertStore, const BYTE *pbElement, DWORD cbElement, DWORD dwAddDisposition, DWORD dwFlags, DWORD dwContextTypeFlags, DWORD *pdwContextType, const void **ppvContext);
   3914   WINIMPM WINBOOL WINAPI CertDeleteCertificateFromStore (PCCERT_CONTEXT pCertContext);
   3915   WINIMPM WINBOOL WINAPI CertAddEncodedCRLToStore (HCERTSTORE hCertStore, DWORD dwCertEncodingType, const BYTE *pbCrlEncoded, DWORD cbCrlEncoded, DWORD dwAddDisposition, PCCRL_CONTEXT *ppCrlContext);
   3916   WINIMPM WINBOOL WINAPI CertAddCRLContextToStore (HCERTSTORE hCertStore, PCCRL_CONTEXT pCrlContext, DWORD dwAddDisposition, PCCRL_CONTEXT *ppStoreContext);
   3917   WINIMPM WINBOOL WINAPI CertDeleteCRLFromStore (PCCRL_CONTEXT pCrlContext);
   3918   WINIMPM WINBOOL WINAPI CertSerializeCertificateStoreElement (PCCERT_CONTEXT pCertContext, DWORD dwFlags, BYTE *pbElement, DWORD *pcbElement);
   3919   WINIMPM WINBOOL WINAPI CertSerializeCRLStoreElement (PCCRL_CONTEXT pCrlContext, DWORD dwFlags, BYTE *pbElement, DWORD *pcbElement);
   3920   WINIMPM PCCTL_CONTEXT WINAPI CertDuplicateCTLContext (PCCTL_CONTEXT pCtlContext);
   3921   WINIMPM PCCTL_CONTEXT WINAPI CertCreateCTLContext (DWORD dwMsgAndCertEncodingType, const BYTE *pbCtlEncoded, DWORD cbCtlEncoded);
   3922   WINIMPM WINBOOL WINAPI CertFreeCTLContext (PCCTL_CONTEXT pCtlContext);
   3923   WINIMPM WINBOOL WINAPI CertSetCTLContextProperty (PCCTL_CONTEXT pCtlContext, DWORD dwPropId, DWORD dwFlags, const void *pvData);
   3924   WINIMPM WINBOOL WINAPI CertGetCTLContextProperty (PCCTL_CONTEXT pCtlContext, DWORD dwPropId, void *pvData, DWORD *pcbData);
   3925   WINIMPM DWORD WINAPI CertEnumCTLContextProperties (PCCTL_CONTEXT pCtlContext, DWORD dwPropId);
   3926   WINIMPM PCCTL_CONTEXT WINAPI CertEnumCTLsInStore (HCERTSTORE hCertStore, PCCTL_CONTEXT pPrevCtlContext);
   3927   WINIMPM PCTL_ENTRY WINAPI CertFindSubjectInCTL (DWORD dwEncodingType, DWORD dwSubjectType, void *pvSubject, PCCTL_CONTEXT pCtlContext, DWORD dwFlags);
   3928   WINIMPM PCCTL_CONTEXT WINAPI CertFindCTLInStore (HCERTSTORE hCertStore, DWORD dwMsgAndCertEncodingType, DWORD dwFindFlags, DWORD dwFindType, const void *pvFindPara, PCCTL_CONTEXT pPrevCtlContext);
   3929 
   3930 #define CTL_FIND_ANY 0
   3931 #define CTL_FIND_SHA1_HASH 1
   3932 #define CTL_FIND_MD5_HASH 2
   3933 #define CTL_FIND_USAGE 3
   3934 #define CTL_FIND_SUBJECT 4
   3935 #define CTL_FIND_EXISTING 5
   3936 
   3937 #define CTL_FIND_SAME_USAGE_FLAG 0x1
   3938 
   3939 #define CTL_FIND_NO_LIST_ID_CBDATA 0xffffffff
   3940 #define CTL_FIND_NO_SIGNER_PTR ((PCERT_INFO) -1)
   3941 
   3942 #define CERT_STORE_CTRL_RESYNC 1
   3943 #define CERT_STORE_CTRL_NOTIFY_CHANGE 2
   3944 #define CERT_STORE_CTRL_COMMIT 3
   3945 #define CERT_STORE_CTRL_AUTO_RESYNC 4
   3946 #define CERT_STORE_CTRL_CANCEL_NOTIFY 5
   3947 
   3948 #define CERT_STORE_CTRL_INHIBIT_DUPLICATE_HANDLE_FLAG 0x1
   3949 
   3950 #define CERT_STORE_CTRL_COMMIT_FORCE_FLAG 0x1
   3951 #define CERT_STORE_CTRL_COMMIT_CLEAR_FLAG 0x2
   3952 
   3953 #define CERT_STORE_LOCALIZED_NAME_PROP_ID 0x1000
   3954 
   3955 #define CERT_CREATE_CONTEXT_NOCOPY_FLAG 0x1
   3956 #define CERT_CREATE_CONTEXT_SORTED_FLAG 0x2
   3957 #define CERT_CREATE_CONTEXT_NO_HCRYPTMSG_FLAG 0x4
   3958 #define CERT_CREATE_CONTEXT_NO_ENTRY_FLAG 0x8
   3959 
   3960 #define CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG 0x1
   3961 #define CERT_PHYSICAL_STORE_OPEN_DISABLE_FLAG 0x2
   3962 #define CERT_PHYSICAL_STORE_REMOTE_OPEN_DISABLE_FLAG 0x4
   3963 #define CERT_PHYSICAL_STORE_INSERT_COMPUTER_NAME_ENABLE_FLAG 0x8
   3964 
   3965   typedef struct _CTL_FIND_USAGE_PARA {
   3966     DWORD cbSize;
   3967     CTL_USAGE SubjectUsage;
   3968     CRYPT_DATA_BLOB ListIdentifier;
   3969     PCERT_INFO pSigner;
   3970   } CTL_FIND_USAGE_PARA,*PCTL_FIND_USAGE_PARA;
   3971 
   3972   typedef struct _CTL_FIND_SUBJECT_PARA {
   3973     DWORD cbSize;
   3974     PCTL_FIND_USAGE_PARA pUsagePara;
   3975     DWORD dwSubjectType;
   3976     void *pvSubject;
   3977   } CTL_FIND_SUBJECT_PARA,*PCTL_FIND_SUBJECT_PARA;
   3978 
   3979   typedef WINBOOL (WINAPI *PFN_CERT_CREATE_CONTEXT_SORT_FUNC) (DWORD cbTotalEncoded, DWORD cbRemainEncoded, DWORD cEntry, void *pvSort);
   3980 
   3981   typedef struct _CERT_CREATE_CONTEXT_PARA {
   3982     DWORD cbSize;
   3983     PFN_CRYPT_FREE pfnFree;
   3984     void *pvFree;
   3985     PFN_CERT_CREATE_CONTEXT_SORT_FUNC pfnSort;
   3986     void *pvSort;
   3987   } CERT_CREATE_CONTEXT_PARA,*PCERT_CREATE_CONTEXT_PARA;
   3988 
   3989   typedef struct _CERT_SYSTEM_STORE_INFO {
   3990     DWORD cbSize;
   3991   } CERT_SYSTEM_STORE_INFO,*PCERT_SYSTEM_STORE_INFO;
   3992 
   3993   typedef struct _CERT_PHYSICAL_STORE_INFO {
   3994     DWORD cbSize;
   3995     LPSTR pszOpenStoreProvider;
   3996     DWORD dwOpenEncodingType;
   3997     DWORD dwOpenFlags;
   3998     CRYPT_DATA_BLOB OpenParameters;
   3999     DWORD dwFlags;
   4000     DWORD dwPriority;
   4001   } CERT_PHYSICAL_STORE_INFO,*PCERT_PHYSICAL_STORE_INFO;
   4002 
   4003   WINIMPM WINBOOL WINAPI CertAddEncodedCTLToStore (HCERTSTORE hCertStore, DWORD dwMsgAndCertEncodingType, const BYTE *pbCtlEncoded, DWORD cbCtlEncoded, DWORD dwAddDisposition, PCCTL_CONTEXT *ppCtlContext);
   4004   WINIMPM WINBOOL WINAPI CertAddCTLContextToStore (HCERTSTORE hCertStore, PCCTL_CONTEXT pCtlContext, DWORD dwAddDisposition, PCCTL_CONTEXT *ppStoreContext);
   4005   WINIMPM WINBOOL WINAPI CertSerializeCTLStoreElement (PCCTL_CONTEXT pCtlContext, DWORD dwFlags, BYTE *pbElement, DWORD *pcbElement);
   4006   WINIMPM WINBOOL WINAPI CertDeleteCTLFromStore (PCCTL_CONTEXT pCtlContext);
   4007   WINIMPM WINBOOL WINAPI CertAddCertificateLinkToStore (HCERTSTORE hCertStore, PCCERT_CONTEXT pCertContext, DWORD dwAddDisposition, PCCERT_CONTEXT *ppStoreContext);
   4008   WINIMPM WINBOOL WINAPI CertAddCRLLinkToStore (HCERTSTORE hCertStore, PCCRL_CONTEXT pCrlContext, DWORD dwAddDisposition, PCCRL_CONTEXT *ppStoreContext);
   4009   WINIMPM WINBOOL WINAPI CertAddCTLLinkToStore (HCERTSTORE hCertStore, PCCTL_CONTEXT pCtlContext, DWORD dwAddDisposition, PCCTL_CONTEXT *ppStoreContext);
   4010   WINIMPM WINBOOL WINAPI CertAddStoreToCollection (HCERTSTORE hCollectionStore, HCERTSTORE hSiblingStore, DWORD dwUpdateFlags, DWORD dwPriority);
   4011   WINIMPM void WINAPI CertRemoveStoreFromCollection (HCERTSTORE hCollectionStore, HCERTSTORE hSiblingStore);
   4012   WINIMPM WINBOOL WINAPI CertControlStore (HCERTSTORE hCertStore, DWORD dwFlags, DWORD dwCtrlType, void const *pvCtrlPara);
   4013   WINIMPM WINBOOL WINAPI CertSetStoreProperty (HCERTSTORE hCertStore, DWORD dwPropId, DWORD dwFlags, const void *pvData);
   4014   WINIMPM WINBOOL WINAPI CertGetStoreProperty (HCERTSTORE hCertStore, DWORD dwPropId, void *pvData, DWORD *pcbData);
   4015   WINIMPM const void *WINAPI CertCreateContext (DWORD dwContextType, DWORD dwEncodingType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCERT_CREATE_CONTEXT_PARA pCreatePara);
   4016   WINIMPM WINBOOL WINAPI CertRegisterSystemStore (const void *pvSystemStore, DWORD dwFlags, PCERT_SYSTEM_STORE_INFO pStoreInfo, void *pvReserved);
   4017   WINIMPM WINBOOL WINAPI CertRegisterPhysicalStore (const void *pvSystemStore, DWORD dwFlags, LPCWSTR pwszStoreName, PCERT_PHYSICAL_STORE_INFO pStoreInfo, void *pvReserved);
   4018   WINIMPM WINBOOL WINAPI CertUnregisterSystemStore (const void *pvSystemStore, DWORD dwFlags);
   4019   WINIMPM WINBOOL WINAPI CertUnregisterPhysicalStore (const void *pvSystemStore, DWORD dwFlags, LPCWSTR pwszStoreName);
   4020 
   4021   typedef WINBOOL (WINAPI *PFN_CERT_ENUM_SYSTEM_STORE_LOCATION) (LPCWSTR pwszStoreLocation, DWORD dwFlags, void *pvReserved, void *pvArg);
   4022   typedef WINBOOL (WINAPI *PFN_CERT_ENUM_SYSTEM_STORE) (const void *pvSystemStore, DWORD dwFlags, PCERT_SYSTEM_STORE_INFO pStoreInfo, void *pvReserved, void *pvArg);
   4023   typedef WINBOOL (WINAPI *PFN_CERT_ENUM_PHYSICAL_STORE) (const void *pvSystemStore, DWORD dwFlags, LPCWSTR pwszStoreName, PCERT_PHYSICAL_STORE_INFO pStoreInfo, void *pvReserved, void *pvArg);
   4024 
   4025 #define CERT_PHYSICAL_STORE_PREDEFINED_ENUM_FLAG 0x1
   4026 
   4027 #define CERT_PHYSICAL_STORE_DEFAULT_NAME L".Default"
   4028 #define CERT_PHYSICAL_STORE_GROUP_POLICY_NAME L".GroupPolicy"
   4029 #define CERT_PHYSICAL_STORE_LOCAL_MACHINE_NAME L".LocalMachine"
   4030 #define CERT_PHYSICAL_STORE_DS_USER_CERTIFICATE_NAME L".UserCertificate"
   4031 #define CERT_PHYSICAL_STORE_LOCAL_MACHINE_GROUP_POLICY_NAME L".LocalMachineGroupPolicy"
   4032 #define CERT_PHYSICAL_STORE_ENTERPRISE_NAME L".Enterprise"
   4033 #define CERT_PHYSICAL_STORE_AUTH_ROOT_NAME L".AuthRoot"
   4034 #define CERT_PHYSICAL_STORE_SMART_CARD_NAME L".SmartCard"
   4035 
   4036   WINIMPM WINBOOL WINAPI CertEnumSystemStoreLocation (DWORD dwFlags, void *pvArg, PFN_CERT_ENUM_SYSTEM_STORE_LOCATION pfnEnum);
   4037   WINIMPM WINBOOL WINAPI CertEnumSystemStore (DWORD dwFlags, void *pvSystemStoreLocationPara, void *pvArg, PFN_CERT_ENUM_SYSTEM_STORE pfnEnum);
   4038   WINIMPM WINBOOL WINAPI CertEnumPhysicalStore (const void *pvSystemStore, DWORD dwFlags, void *pvArg, PFN_CERT_ENUM_PHYSICAL_STORE pfnEnum);
   4039 
   4040 #define CRYPT_OID_OPEN_SYSTEM_STORE_PROV_FUNC "CertDllOpenSystemStoreProv"
   4041 #define CRYPT_OID_REGISTER_SYSTEM_STORE_FUNC "CertDllRegisterSystemStore"
   4042 #define CRYPT_OID_UNREGISTER_SYSTEM_STORE_FUNC "CertDllUnregisterSystemStore"
   4043 #define CRYPT_OID_ENUM_SYSTEM_STORE_FUNC "CertDllEnumSystemStore"
   4044 #define CRYPT_OID_REGISTER_PHYSICAL_STORE_FUNC "CertDllRegisterPhysicalStore"
   4045 #define CRYPT_OID_UNREGISTER_PHYSICAL_STORE_FUNC "CertDllUnregisterPhysicalStore"
   4046 #define CRYPT_OID_ENUM_PHYSICAL_STORE_FUNC "CertDllEnumPhysicalStore"
   4047 #define CRYPT_OID_SYSTEM_STORE_LOCATION_VALUE_NAME L"SystemStoreLocation"
   4048 
   4049 #define CMSG_TRUSTED_SIGNER_FLAG 0x1
   4050 #define CMSG_SIGNER_ONLY_FLAG 0x2
   4051 #define CMSG_USE_SIGNER_INDEX_FLAG 0x4
   4052 #define CMSG_CMS_ENCAPSULATED_CTL_FLAG 0x8000
   4053 
   4054 #define CMSG_ENCODE_SORTED_CTL_FLAG 0x1
   4055 #define CMSG_ENCODE_HASHED_SUBJECT_IDENTIFIER_FLAG 0x2
   4056 
   4057   WINIMPM WINBOOL WINAPI CertGetEnhancedKeyUsage (PCCERT_CONTEXT pCertContext, DWORD dwFlags, PCERT_ENHKEY_USAGE pUsage, DWORD *pcbUsage);
   4058   WINIMPM WINBOOL WINAPI CertSetEnhancedKeyUsage (PCCERT_CONTEXT pCertContext, PCERT_ENHKEY_USAGE pUsage);
   4059   WINIMPM WINBOOL WINAPI CertAddEnhancedKeyUsageIdentifier (PCCERT_CONTEXT pCertContext, LPCSTR pszUsageIdentifier);
   4060   WINIMPM WINBOOL WINAPI CertRemoveEnhancedKeyUsageIdentifier (PCCERT_CONTEXT pCertContext, LPCSTR pszUsageIdentifier);
   4061   WINIMPM WINBOOL WINAPI CertGetValidUsages (DWORD cCerts, PCCERT_CONTEXT *rghCerts, int *cNumOIDs, LPSTR *rghOIDs, DWORD *pcbOIDs);
   4062   WINIMPM WINBOOL WINAPI CryptMsgGetAndVerifySigner (HCRYPTMSG hCryptMsg, DWORD cSignerStore, HCERTSTORE *rghSignerStore, DWORD dwFlags, PCCERT_CONTEXT *ppSigner, DWORD *pdwSignerIndex);
   4063   WINIMPM WINBOOL WINAPI CryptMsgSignCTL (DWORD dwMsgEncodingType, BYTE *pbCtlContent, DWORD cbCtlContent, PCMSG_SIGNED_ENCODE_INFO pSignInfo, DWORD dwFlags, BYTE *pbEncoded, DWORD *pcbEncoded);
   4064   WINIMPM WINBOOL WINAPI CryptMsgEncodeAndSignCTL (DWORD dwMsgEncodingType, PCTL_INFO pCtlInfo, PCMSG_SIGNED_ENCODE_INFO pSignInfo, DWORD dwFlags, BYTE *pbEncoded, DWORD *pcbEncoded);
   4065   WINIMPM WINBOOL WINAPI CertFindSubjectInSortedCTL (PCRYPT_DATA_BLOB pSubjectIdentifier, PCCTL_CONTEXT pCtlContext, DWORD dwFlags, void *pvReserved, PCRYPT_DER_BLOB pEncodedAttributes);
   4066   WINIMPM WINBOOL WINAPI CertEnumSubjectInSortedCTL (PCCTL_CONTEXT pCtlContext, void **ppvNextSubject, PCRYPT_DER_BLOB pSubjectIdentifier, PCRYPT_DER_BLOB pEncodedAttributes);
   4067 
   4068   typedef struct _CTL_VERIFY_USAGE_PARA {
   4069     DWORD cbSize;
   4070     CRYPT_DATA_BLOB ListIdentifier;
   4071     DWORD cCtlStore;
   4072     HCERTSTORE *rghCtlStore;
   4073     DWORD cSignerStore;
   4074     HCERTSTORE *rghSignerStore;
   4075   } CTL_VERIFY_USAGE_PARA,*PCTL_VERIFY_USAGE_PARA;
   4076 
   4077   typedef struct _CTL_VERIFY_USAGE_STATUS {
   4078     DWORD cbSize;
   4079     DWORD dwError;
   4080     DWORD dwFlags;
   4081     PCCTL_CONTEXT *ppCtl;
   4082     DWORD dwCtlEntryIndex;
   4083     PCCERT_CONTEXT *ppSigner;
   4084     DWORD dwSignerIndex;
   4085   } CTL_VERIFY_USAGE_STATUS,*PCTL_VERIFY_USAGE_STATUS;
   4086 
   4087 #define CERT_VERIFY_INHIBIT_CTL_UPDATE_FLAG 0x1
   4088 #define CERT_VERIFY_TRUSTED_SIGNERS_FLAG 0x2
   4089 #define CERT_VERIFY_NO_TIME_CHECK_FLAG 0x4
   4090 #define CERT_VERIFY_ALLOW_MORE_USAGE_FLAG 0x8
   4091 
   4092 #define CERT_VERIFY_UPDATED_CTL_FLAG 0x1
   4093 
   4094   WINIMPM WINBOOL WINAPI CertVerifyCTLUsage (DWORD dwEncodingType, DWORD dwSubjectType, void *pvSubject, PCTL_USAGE pSubjectUsage, DWORD dwFlags, PCTL_VERIFY_USAGE_PARA pVerifyUsagePara, PCTL_VERIFY_USAGE_STATUS pVerifyUsageStatus);
   4095 
   4096   typedef struct _CERT_REVOCATION_CRL_INFO {
   4097     DWORD cbSize;
   4098     PCCRL_CONTEXT pBaseCrlContext;
   4099     PCCRL_CONTEXT pDeltaCrlContext;
   4100     PCRL_ENTRY pCrlEntry;
   4101     WINBOOL fDeltaCrlEntry;
   4102   } CERT_REVOCATION_CRL_INFO,*PCERT_REVOCATION_CRL_INFO;
   4103 
   4104   typedef struct _CERT_REVOCATION_CHAIN_PARA CERT_REVOCATION_CHAIN_PARA,*PCERT_REVOCATION_CHAIN_PARA;
   4105 
   4106   typedef struct _CERT_REVOCATION_PARA {
   4107     DWORD cbSize;
   4108     PCCERT_CONTEXT pIssuerCert;
   4109     DWORD cCertStore;
   4110     HCERTSTORE *rgCertStore;
   4111     HCERTSTORE hCrlStore;
   4112     LPFILETIME pftTimeToUse;
   4113 #ifdef CERT_REVOCATION_PARA_HAS_EXTRA_FIELDS
   4114     DWORD dwUrlRetrievalTimeout;
   4115     WINBOOL fCheckFreshnessTime;
   4116     DWORD dwFreshnessTime;
   4117     LPFILETIME pftCurrentTime;
   4118     PCERT_REVOCATION_CRL_INFO pCrlInfo;
   4119     LPFILETIME pftCacheResync;
   4120     PCERT_REVOCATION_CHAIN_PARA pChainPara;
   4121 #endif
   4122   } CERT_REVOCATION_PARA,*PCERT_REVOCATION_PARA;
   4123 
   4124   typedef struct _CERT_REVOCATION_STATUS {
   4125     DWORD cbSize;
   4126     DWORD dwIndex;
   4127     DWORD dwError;
   4128     DWORD dwReason;
   4129     WINBOOL fHasFreshnessTime;
   4130     DWORD dwFreshnessTime;
   4131   } CERT_REVOCATION_STATUS,*PCERT_REVOCATION_STATUS;
   4132 
   4133 #define CERT_CONTEXT_REVOCATION_TYPE 1
   4134 
   4135 #define CERT_VERIFY_REV_CHAIN_FLAG 0x1
   4136 #define CERT_VERIFY_CACHE_ONLY_BASED_REVOCATION 0x2
   4137 #define CERT_VERIFY_REV_ACCUMULATIVE_TIMEOUT_FLAG 0x4
   4138 #define CERT_VERIFY_REV_SERVER_OCSP_FLAG 0x8
   4139 #define CERT_VERIFY_REV_NO_OCSP_FAILOVER_TO_CRL_FLAG 0x10
   4140 
   4141 #define CERT_UNICODE_IS_RDN_ATTRS_FLAG 0x1
   4142 #define CERT_CASE_INSENSITIVE_IS_RDN_ATTRS_FLAG 0x2
   4143 
   4144 #define CRYPT_VERIFY_CERT_SIGN_SUBJECT_BLOB 1
   4145 #define CRYPT_VERIFY_CERT_SIGN_SUBJECT_CERT 2
   4146 #define CRYPT_VERIFY_CERT_SIGN_SUBJECT_CRL 3
   4147 #define CRYPT_VERIFY_CERT_SIGN_SUBJECT_OCSP_BASIC_SIGNED_RESPONSE 4
   4148 
   4149 #define CRYPT_VERIFY_CERT_SIGN_ISSUER_PUBKEY 1
   4150 #define CRYPT_VERIFY_CERT_SIGN_ISSUER_CERT 2
   4151 #define CRYPT_VERIFY_CERT_SIGN_ISSUER_CHAIN 3
   4152 #define CRYPT_VERIFY_CERT_SIGN_ISSUER_NULL 4
   4153 
   4154 #define CRYPT_VERIFY_CERT_SIGN_DISABLE_MD2_MD4_FLAG 0x1
   4155 #define CRYPT_VERIFY_CERT_SIGN_SET_STRONG_PROPERTIES_FLAG 0x2
   4156 #define CRYPT_VERIFY_CERT_SIGN_RETURN_STRONG_PROPERTIES_FLAG 0x4
   4157 
   4158 #define CRYPT_OID_EXTRACT_ENCODED_SIGNATURE_PARAMETERS_FUNC "CryptDllExtractEncodedSignatureParameters"
   4159 #define CRYPT_OID_SIGN_AND_ENCODE_HASH_FUNC "CryptDllSignAndEncodeHash"
   4160 #define CRYPT_OID_VERIFY_ENCODED_SIGNATURE_FUNC "CryptDllVerifyEncodedSignature"
   4161 
   4162 #define CRYPT_DEFAULT_CONTEXT_AUTO_RELEASE_FLAG 0x1
   4163 #define CRYPT_DEFAULT_CONTEXT_PROCESS_FLAG 0x2
   4164 
   4165 #define CRYPT_DEFAULT_CONTEXT_CERT_SIGN_OID 1
   4166 #define CRYPT_DEFAULT_CONTEXT_MULTI_CERT_SIGN_OID 2
   4167 
   4168   typedef struct _CRYPT_VERIFY_CERT_SIGN_STRONG_PROPERTIES_INFO {
   4169     CRYPT_DATA_BLOB CertSignHashCNGAlgPropData;
   4170     CRYPT_DATA_BLOB CertIssuerPubKeyBitLengthPropData;
   4171   } CRYPT_VERIFY_CERT_SIGN_STRONG_PROPERTIES_INFO, *PCRYPT_VERIFY_CERT_SIGN_STRONG_PROPERTIES_INFO;
   4172 
   4173   typedef WINBOOL (WINAPI *PFN_CRYPT_EXTRACT_ENCODED_SIGNATURE_PARAMETERS_FUNC) (DWORD dwCertEncodingType, PCRYPT_ALGORITHM_IDENTIFIER pSignatureAlgorithm, void **ppvDecodedSignPara, LPWSTR *ppwszCNGHashAlgid);
   4174   typedef WINBOOL (WINAPI *PFN_CRYPT_SIGN_AND_ENCODE_HASH_FUNC) (NCRYPT_KEY_HANDLE hKey, DWORD dwCertEncodingType, PCRYPT_ALGORITHM_IDENTIFIER pSignatureAlgorithm, void *pvDecodedSignPara, LPCWSTR pwszCNGPubKeyAlgid, LPCWSTR pwszCNGHashAlgid, BYTE *pbComputedHash, DWORD cbComputedHash, BYTE *pbSignature, DWORD *pcbSignature);
   4175   typedef WINBOOL (WINAPI *PFN_CRYPT_VERIFY_ENCODED_SIGNATURE_FUNC) (DWORD dwCertEncodingType, PCERT_PUBLIC_KEY_INFO pPubKeyInfo, PCRYPT_ALGORITHM_IDENTIFIER pSignatureAlgorithm, void *pvDecodedSignPara, LPCWSTR pwszCNGPubKeyAlgid, LPCWSTR pwszCNGHashAlgid, BYTE *pbComputedHash, DWORD cbComputedHash, BYTE *pbSignature, DWORD cbSignature);
   4176 
   4177   typedef void *HCRYPTDEFAULTCONTEXT;
   4178 
   4179   typedef struct _CRYPT_DEFAULT_CONTEXT_MULTI_OID_PARA {
   4180     DWORD cOID;
   4181     LPSTR *rgpszOID;
   4182   } CRYPT_DEFAULT_CONTEXT_MULTI_OID_PARA,*PCRYPT_DEFAULT_CONTEXT_MULTI_OID_PARA;
   4183 
   4184   WINIMPM WINBOOL WINAPI CertVerifyRevocation (DWORD dwEncodingType, DWORD dwRevType, DWORD cContext, PVOID rgpvContext[], DWORD dwFlags, PCERT_REVOCATION_PARA pRevPara, PCERT_REVOCATION_STATUS pRevStatus);
   4185   WINBOOL WINAPI CertCompareIntegerBlob (PCRYPT_INTEGER_BLOB pInt1, PCRYPT_INTEGER_BLOB pInt2);
   4186   WINIMPM WINBOOL WINAPI CertCompareCertificate (DWORD dwCertEncodingType, PCERT_INFO pCertId1, PCERT_INFO pCertId2);
   4187   WINIMPM WINBOOL WINAPI CertCompareCertificateName (DWORD dwCertEncodingType, PCERT_NAME_BLOB pCertName1, PCERT_NAME_BLOB pCertName2);
   4188   WINIMPM WINBOOL WINAPI CertIsRDNAttrsInCertificateName (DWORD dwCertEncodingType, DWORD dwFlags, PCERT_NAME_BLOB pCertName, PCERT_RDN pRDN);
   4189   WINIMPM WINBOOL WINAPI CertComparePublicKeyInfo (DWORD dwCertEncodingType, PCERT_PUBLIC_KEY_INFO pPublicKey1, PCERT_PUBLIC_KEY_INFO pPublicKey2);
   4190   WINIMPM DWORD WINAPI CertGetPublicKeyLength (DWORD dwCertEncodingType, PCERT_PUBLIC_KEY_INFO pPublicKey);
   4191   WINIMPM WINBOOL WINAPI CryptVerifyCertificateSignature (HCRYPTPROV_LEGACY hCryptProv, DWORD dwCertEncodingType, const BYTE *pbEncoded, DWORD cbEncoded, PCERT_PUBLIC_KEY_INFO pPublicKey);
   4192   WINIMPM WINBOOL WINAPI CryptVerifyCertificateSignatureEx (HCRYPTPROV_LEGACY hCryptProv, DWORD dwCertEncodingType, DWORD dwSubjectType, void *pvSubject, DWORD dwIssuerType, void *pvIssuer, DWORD dwFlags, void *pvExtra);
   4193   WINIMPM WINBOOL WINAPI CertIsStrongHashToSign (PCCERT_STRONG_SIGN_PARA pStrongSignPara, LPCWSTR pwszCNGHashAlgid, PCCERT_CONTEXT pSigningCert);
   4194   WINIMPM WINBOOL WINAPI CryptHashToBeSigned (HCRYPTPROV_LEGACY hCryptProv, DWORD dwCertEncodingType, const BYTE *pbEncoded, DWORD cbEncoded, BYTE *pbComputedHash, DWORD *pcbComputedHash);
   4195   WINIMPM WINBOOL WINAPI CryptHashCertificate (HCRYPTPROV_LEGACY hCryptProv, ALG_ID Algid, DWORD dwFlags, const BYTE *pbEncoded, DWORD cbEncoded, BYTE *pbComputedHash, DWORD *pcbComputedHash);
   4196 #if NTDDI_VERSION >= 0x06000000
   4197   WINIMPM WINBOOL WINAPI CryptHashCertificate2 (LPCWSTR pwszCNGHashAlgid, DWORD dwFlags, void *pvReserved, const BYTE *pbEncoded, DWORD cbEncoded, BYTE *pbComputedHash, DWORD *pcbComputedHash);
   4198 #endif
   4199   WINIMPM WINBOOL WINAPI CryptSignCertificate (HCRYPTPROV_OR_NCRYPT_KEY_HANDLE hCryptProvOrNCryptKey, DWORD dwKeySpec, DWORD dwCertEncodingType, const BYTE *pbEncodedToBeSigned, DWORD cbEncodedToBeSigned, PCRYPT_ALGORITHM_IDENTIFIER pSignatureAlgorithm, const void *pvHashAuxInfo, BYTE *pbSignature, DWORD *pcbSignature);
   4200   WINIMPM WINBOOL WINAPI CryptSignAndEncodeCertificate (HCRYPTPROV_OR_NCRYPT_KEY_HANDLE hCryptProvOrNCryptKey, DWORD dwKeySpec, DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, PCRYPT_ALGORITHM_IDENTIFIER pSignatureAlgorithm, const void *pvHashAuxInfo, BYTE *pbEncoded, DWORD *pcbEncoded);
   4201   WINIMPM LONG WINAPI CertVerifyTimeValidity (LPFILETIME pTimeToVerify, PCERT_INFO pCertInfo);
   4202   WINIMPM LONG WINAPI CertVerifyCRLTimeValidity (LPFILETIME pTimeToVerify, PCRL_INFO pCrlInfo);
   4203   WINIMPM WINBOOL WINAPI CertVerifyValidityNesting (PCERT_INFO pSubjectInfo, PCERT_INFO pIssuerInfo);
   4204   WINIMPM WINBOOL WINAPI CertVerifyCRLRevocation (DWORD dwCertEncodingType, PCERT_INFO pCertId, DWORD cCrlInfo, PCRL_INFO rgpCrlInfo[]);
   4205   WINIMPM LPCSTR WINAPI CertAlgIdToOID (DWORD dwAlgId);
   4206   WINIMPM DWORD WINAPI CertOIDToAlgId (LPCSTR pszObjId);
   4207   WINIMPM PCERT_EXTENSION WINAPI CertFindExtension (LPCSTR pszObjId, DWORD cExtensions, CERT_EXTENSION rgExtensions[]);
   4208   WINIMPM PCRYPT_ATTRIBUTE WINAPI CertFindAttribute (LPCSTR pszObjId, DWORD cAttr, CRYPT_ATTRIBUTE rgAttr[]);
   4209   WINIMPM PCERT_RDN_ATTR WINAPI CertFindRDNAttr (LPCSTR pszObjId, PCERT_NAME_INFO pName);
   4210   WINIMPM WINBOOL WINAPI CertGetIntendedKeyUsage (DWORD dwCertEncodingType, PCERT_INFO pCertInfo, BYTE *pbKeyUsage, DWORD cbKeyUsage);
   4211   WINIMPM WINBOOL WINAPI CryptInstallDefaultContext (HCRYPTPROV hCryptProv, DWORD dwDefaultType, const void *pvDefaultPara, DWORD dwFlags, void *pvReserved, HCRYPTDEFAULTCONTEXT *phDefaultContext);
   4212   WINIMPM WINBOOL WINAPI CryptUninstallDefaultContext (HCRYPTDEFAULTCONTEXT hDefaultContext, DWORD dwFlags, void *pvReserved);
   4213   WINIMPM WINBOOL WINAPI CryptExportPublicKeyInfo (HCRYPTPROV_OR_NCRYPT_KEY_HANDLE hCryptProvOrNCryptKey, DWORD dwKeySpec, DWORD dwCertEncodingType, PCERT_PUBLIC_KEY_INFO pInfo, DWORD *pcbInfo);
   4214   WINIMPM WINBOOL WINAPI CryptExportPublicKeyInfoEx (HCRYPTPROV_OR_NCRYPT_KEY_HANDLE hCryptProvOrNCryptKey, DWORD dwKeySpec, DWORD dwCertEncodingType, LPSTR pszPublicKeyObjId, DWORD dwFlags, void *pvAuxInfo, PCERT_PUBLIC_KEY_INFO pInfo, DWORD *pcbInfo);
   4215 
   4216 #define CRYPT_OID_EXPORT_PUBLIC_KEY_INFO_FUNC "CryptDllExportPublicKeyInfoEx"
   4217 #define CRYPT_OID_EXPORT_PUBLIC_KEY_INFO_EX2_FUNC "CryptDllExportPublicKeyInfoEx2"
   4218 
   4219   typedef WINBOOL (WINAPI *PFN_CRYPT_EXPORT_PUBLIC_KEY_INFO_EX2_FUNC) (NCRYPT_KEY_HANDLE hNCryptKey, DWORD dwCertEncodingType, LPSTR pszPublicKeyObjId, DWORD dwFlags, void *pvAuxInfo, PCERT_PUBLIC_KEY_INFO pInfo, DWORD *pcbInfo);
   4220 
   4221 #if NTDDI_VERSION >= 0x06010000
   4222 #define CRYPT_OID_EXPORT_PUBLIC_KEY_INFO_FROM_BCRYPT_HANDLE_FUNC "CryptDllExportPublicKeyInfoFromBCryptKeyHandle"
   4223 
   4224   typedef WINBOOL (WINAPI *PFN_CRYPT_EXPORT_PUBLIC_KEY_INFO_FROM_BCRYPT_HANDLE_FUNC) (BCRYPT_KEY_HANDLE hBCryptKey, DWORD dwCertEncodingType, LPSTR pszPublicKeyObjId, DWORD dwFlags, void *pvAuxInfo, PCERT_PUBLIC_KEY_INFO pInfo, DWORD *pcbInfo);
   4225 
   4226   WINIMPM WINBOOL WINAPI CryptExportPublicKeyInfoFromBCryptKeyHandle (BCRYPT_KEY_HANDLE hBCryptKey, DWORD dwCertEncodingType, LPSTR pszPublicKeyObjId, DWORD dwFlags, void *pvAuxInfo, PCERT_PUBLIC_KEY_INFO pInfo, DWORD *pcbInfo);
   4227 #endif
   4228 
   4229 #define CRYPT_OID_IMPORT_PUBLIC_KEY_INFO_FUNC "CryptDllImportPublicKeyInfoEx"
   4230 #define CRYPT_OID_IMPORT_PRIVATE_KEY_INFO_FUNC "CryptDllImportPrivateKeyInfoEx"
   4231 #define CRYPT_OID_EXPORT_PRIVATE_KEY_INFO_FUNC "CryptDllExportPrivateKeyInfoEx"
   4232 
   4233 #define CRYPT_ACQUIRE_CACHE_FLAG 0x1
   4234 #define CRYPT_ACQUIRE_USE_PROV_INFO_FLAG 0x2
   4235 #define CRYPT_ACQUIRE_COMPARE_KEY_FLAG 0x4
   4236 #define CRYPT_ACQUIRE_NO_HEALING 0x8
   4237 #define CRYPT_ACQUIRE_SILENT_FLAG 0x40
   4238 #define CRYPT_ACQUIRE_WINDOW_HANDLE_FLAG 0x80
   4239 
   4240 #define CRYPT_ACQUIRE_NCRYPT_KEY_FLAGS_MASK 0x70000
   4241 #define CRYPT_ACQUIRE_ALLOW_NCRYPT_KEY_FLAG 0x10000
   4242 #define CRYPT_ACQUIRE_PREFER_NCRYPT_KEY_FLAG 0x20000
   4243 #define CRYPT_ACQUIRE_ONLY_NCRYPT_KEY_FLAG 0x40000
   4244 
   4245 #define CRYPT_FIND_USER_KEYSET_FLAG 0x1
   4246 #define CRYPT_FIND_MACHINE_KEYSET_FLAG 0x2
   4247 #define CRYPT_FIND_SILENT_KEYSET_FLAG 0x40
   4248 
   4249 #define CRYPT_DELETE_KEYSET CRYPT_DELETEKEYSET
   4250 
   4251   typedef WINBOOL (WINAPI *PFN_IMPORT_PRIV_KEY_FUNC) (HCRYPTPROV hCryptProv, CRYPT_PRIVATE_KEY_INFO *pPrivateKeyInfo, DWORD dwFlags, void *pvAuxInfo);
   4252   typedef WINBOOL (WINAPI *PFN_EXPORT_PRIV_KEY_FUNC) (HCRYPTPROV hCryptProv, DWORD dwKeySpec, LPSTR pszPrivateKeyObjId, DWORD dwFlags, void *pvAuxInfo, CRYPT_PRIVATE_KEY_INFO *pPrivateKeyInfo, DWORD *pcbPrivateKeyInfo);
   4253 
   4254 #define CertRDNValueToStr __MINGW_NAME_AW(CertRDNValueToStr)
   4255 #define CertNameToStr __MINGW_NAME_AW(CertNameToStr)
   4256 
   4257   WINIMPM WINBOOL WINAPI CryptImportPublicKeyInfo (HCRYPTPROV hCryptProv, DWORD dwCertEncodingType, PCERT_PUBLIC_KEY_INFO pInfo, HCRYPTKEY *phKey);
   4258   WINIMPM WINBOOL WINAPI CryptImportPublicKeyInfoEx (HCRYPTPROV hCryptProv, DWORD dwCertEncodingType, PCERT_PUBLIC_KEY_INFO pInfo, ALG_ID aiKeyAlg, DWORD dwFlags, void *pvAuxInfo, HCRYPTKEY *phKey);
   4259 
   4260 #if NTDDI_VERSION >= 0x06000000
   4261 #define CRYPT_OID_IMPORT_PUBLIC_KEY_INFO_EX2_FUNC "CryptDllImportPublicKeyInfoEx2"
   4262 
   4263   typedef WINBOOL (WINAPI *PFN_IMPORT_PUBLIC_KEY_INFO_EX2_FUNC) (DWORD dwCertEncodingType, PCERT_PUBLIC_KEY_INFO pInfo, DWORD dwFlags, void *pvAuxInfo, BCRYPT_KEY_HANDLE *phKey);
   4264 
   4265   WINIMPM WINBOOL WINAPI CryptImportPublicKeyInfoEx2 (DWORD dwCertEncodingType, PCERT_PUBLIC_KEY_INFO pInfo, DWORD dwFlags, void *pvAuxInfo, BCRYPT_KEY_HANDLE *phKey);
   4266 #endif
   4267   WINIMPM WINBOOL WINAPI CryptAcquireCertificatePrivateKey (PCCERT_CONTEXT pCert, DWORD dwFlags, void *pvParameters, HCRYPTPROV_OR_NCRYPT_KEY_HANDLE *phCryptProvOrNCryptKey, DWORD *pdwKeySpec, WINBOOL *pfCallerFreeProvOrNCryptKey);
   4268   WINIMPM WINBOOL WINAPI CryptFindCertificateKeyProvInfo (PCCERT_CONTEXT pCert, DWORD dwFlags, void *pvReserved);
   4269   WINIMPM WINBOOL WINAPI CryptImportPKCS8 (CRYPT_PKCS8_IMPORT_PARAMS sPrivateKeyAndParams, DWORD dwFlags, HCRYPTPROV *phCryptProv, void *pvAuxInfo);
   4270   WINIMPM WINBOOL WINAPI CryptExportPKCS8 (HCRYPTPROV hCryptProv, DWORD dwKeySpec, LPSTR pszPrivateKeyObjId, DWORD dwFlags, void *pvAuxInfo, BYTE *pbPrivateKeyBlob, DWORD *pcbPrivateKeyBlob);
   4271   WINIMPM WINBOOL WINAPI CryptExportPKCS8Ex (CRYPT_PKCS8_EXPORT_PARAMS *psExportParams, DWORD dwFlags, void *pvAuxInfo, BYTE *pbPrivateKeyBlob, DWORD *pcbPrivateKeyBlob);
   4272   WINIMPM WINBOOL WINAPI CryptHashPublicKeyInfo (HCRYPTPROV_LEGACY hCryptProv, ALG_ID Algid, DWORD dwFlags, DWORD dwCertEncodingType, PCERT_PUBLIC_KEY_INFO pInfo, BYTE *pbComputedHash, DWORD *pcbComputedHash);
   4273   WINIMPM DWORD WINAPI CertRDNValueToStrA (DWORD dwValueType, PCERT_RDN_VALUE_BLOB pValue, LPSTR psz, DWORD csz);
   4274   WINIMPM DWORD WINAPI CertRDNValueToStrW (DWORD dwValueType, PCERT_RDN_VALUE_BLOB pValue, LPWSTR psz, DWORD csz);
   4275   WINIMPM DWORD WINAPI CertNameToStrA (DWORD dwCertEncodingType, PCERT_NAME_BLOB pName, DWORD dwStrType, LPSTR psz, DWORD csz);
   4276   WINIMPM DWORD WINAPI CertNameToStrW (DWORD dwCertEncodingType, PCERT_NAME_BLOB pName, DWORD dwStrType, LPWSTR psz, DWORD csz);
   4277 
   4278 
   4279 #define CERT_SIMPLE_NAME_STR 1
   4280 #define CERT_OID_NAME_STR 2
   4281 #define CERT_X500_NAME_STR 3
   4282 #define CERT_XML_NAME_STR 4
   4283 
   4284 #define CERT_NAME_STR_DISABLE_IE4_UTF8_FLAG 0x10000
   4285 #define CERT_NAME_STR_ENABLE_T61_UNICODE_FLAG 0x20000
   4286 #define CERT_NAME_STR_ENABLE_UTF8_UNICODE_FLAG 0x40000
   4287 #define CERT_NAME_STR_FORCE_UTF8_DIR_STR_FLAG 0x80000
   4288 #define CERT_NAME_STR_FORWARD_FLAG 0x1000000
   4289 #define CERT_NAME_STR_REVERSE_FLAG 0x2000000
   4290 #define CERT_NAME_STR_COMMA_FLAG 0x4000000
   4291 #define CERT_NAME_STR_CRLF_FLAG 0x8000000
   4292 #define CERT_NAME_STR_NO_QUOTING_FLAG 0x10000000
   4293 #define CERT_NAME_STR_NO_PLUS_FLAG 0x20000000
   4294 #define CERT_NAME_STR_SEMICOLON_FLAG 0x40000000
   4295 #define CERT_NAME_STR_DISABLE_UTF8_DIR_STR_FLAG 0x100000
   4296 #define CERT_NAME_STR_ENABLE_PUNYCODE_FLAG 0x200000
   4297 
   4298 #define CertStrToName __MINGW_NAME_AW(CertStrToName)
   4299 #define CertGetNameString __MINGW_NAME_AW(CertGetNameString)
   4300 
   4301   WINIMPM WINBOOL WINAPI CertStrToNameA (DWORD dwCertEncodingType, LPCSTR pszX500, DWORD dwStrType, void *pvReserved, BYTE *pbEncoded, DWORD *pcbEncoded, LPCSTR *ppszError);
   4302   WINIMPM WINBOOL WINAPI CertStrToNameW (DWORD dwCertEncodingType, LPCWSTR pszX500, DWORD dwStrType, void *pvReserved, BYTE *pbEncoded, DWORD *pcbEncoded, LPCWSTR *ppszError);
   4303   WINIMPM DWORD WINAPI CertGetNameStringA (PCCERT_CONTEXT pCertContext, DWORD dwType, DWORD dwFlags, void *pvTypePara, LPSTR pszNameString, DWORD cchNameString);
   4304   WINIMPM DWORD WINAPI CertGetNameStringW (PCCERT_CONTEXT pCertContext, DWORD dwType, DWORD dwFlags, void *pvTypePara, LPWSTR pszNameString, DWORD cchNameString);
   4305 
   4306 #define CERT_NAME_EMAIL_TYPE 1
   4307 #define CERT_NAME_RDN_TYPE 2
   4308 #define CERT_NAME_ATTR_TYPE 3
   4309 #define CERT_NAME_SIMPLE_DISPLAY_TYPE 4
   4310 #define CERT_NAME_FRIENDLY_DISPLAY_TYPE 5
   4311 #define CERT_NAME_DNS_TYPE 6
   4312 #define CERT_NAME_URL_TYPE 7
   4313 #define CERT_NAME_UPN_TYPE 8
   4314 
   4315 #define CERT_NAME_ISSUER_FLAG 0x1
   4316 #define CERT_NAME_DISABLE_IE4_UTF8_FLAG 0x10000
   4317 
   4318 #define CERT_NAME_SEARCH_ALL_NAMES_FLAG 0x2
   4319 
   4320   typedef PCCERT_CONTEXT (WINAPI *PFN_CRYPT_GET_SIGNER_CERTIFICATE) (void *pvGetArg, DWORD dwCertEncodingType, PCERT_INFO pSignerId, HCERTSTORE hMsgCertStore);
   4321 
   4322   typedef struct _CRYPT_SIGN_MESSAGE_PARA {
   4323     DWORD cbSize;
   4324     DWORD dwMsgEncodingType;
   4325     PCCERT_CONTEXT pSigningCert;
   4326     CRYPT_ALGORITHM_IDENTIFIER HashAlgorithm;
   4327     void *pvHashAuxInfo;
   4328     DWORD cMsgCert;
   4329     PCCERT_CONTEXT *rgpMsgCert;
   4330     DWORD cMsgCrl;
   4331     PCCRL_CONTEXT *rgpMsgCrl;
   4332     DWORD cAuthAttr;
   4333     PCRYPT_ATTRIBUTE rgAuthAttr;
   4334     DWORD cUnauthAttr;
   4335     PCRYPT_ATTRIBUTE rgUnauthAttr;
   4336     DWORD dwFlags;
   4337     DWORD dwInnerContentType;
   4338 #ifdef CRYPT_SIGN_MESSAGE_PARA_HAS_CMS_FIELDS
   4339     CRYPT_ALGORITHM_IDENTIFIER HashEncryptionAlgorithm;
   4340     void *pvHashEncryptionAuxInfo;
   4341 #endif
   4342   } CRYPT_SIGN_MESSAGE_PARA,*PCRYPT_SIGN_MESSAGE_PARA;
   4343 
   4344 #define CRYPT_MESSAGE_BARE_CONTENT_OUT_FLAG 0x1
   4345 #define CRYPT_MESSAGE_ENCAPSULATED_CONTENT_OUT_FLAG 0x2
   4346 #define CRYPT_MESSAGE_KEYID_SIGNER_FLAG 0x4
   4347 #define CRYPT_MESSAGE_SILENT_KEYSET_FLAG 0x40
   4348 
   4349   typedef struct _CRYPT_VERIFY_MESSAGE_PARA {
   4350     DWORD cbSize;
   4351     DWORD dwMsgAndCertEncodingType;
   4352     HCRYPTPROV_LEGACY hCryptProv;
   4353     PFN_CRYPT_GET_SIGNER_CERTIFICATE pfnGetSignerCertificate;
   4354     void *pvGetArg;
   4355 #ifdef CRYPT_VERIFY_MESSAGE_PARA_HAS_EXTRA_FIELDS
   4356     PCCERT_STRONG_SIGN_PARA pStrongSignPara;
   4357 #endif
   4358   } CRYPT_VERIFY_MESSAGE_PARA,*PCRYPT_VERIFY_MESSAGE_PARA;
   4359 
   4360   typedef struct _CRYPT_ENCRYPT_MESSAGE_PARA {
   4361     DWORD cbSize;
   4362     DWORD dwMsgEncodingType;
   4363     HCRYPTPROV_LEGACY hCryptProv;
   4364     CRYPT_ALGORITHM_IDENTIFIER ContentEncryptionAlgorithm;
   4365     void *pvEncryptionAuxInfo;
   4366     DWORD dwFlags;
   4367     DWORD dwInnerContentType;
   4368   } CRYPT_ENCRYPT_MESSAGE_PARA,*PCRYPT_ENCRYPT_MESSAGE_PARA;
   4369 
   4370 #define CRYPT_MESSAGE_KEYID_RECIPIENT_FLAG 0x4
   4371 
   4372   typedef struct _CRYPT_DECRYPT_MESSAGE_PARA {
   4373     DWORD cbSize;
   4374     DWORD dwMsgAndCertEncodingType;
   4375     DWORD cCertStore;
   4376     HCERTSTORE *rghCertStore;
   4377 #ifdef CRYPT_DECRYPT_MESSAGE_PARA_HAS_EXTRA_FIELDS
   4378     DWORD dwFlags;
   4379 #endif
   4380   } CRYPT_DECRYPT_MESSAGE_PARA,*PCRYPT_DECRYPT_MESSAGE_PARA;
   4381 
   4382   typedef struct _CRYPT_HASH_MESSAGE_PARA {
   4383     DWORD cbSize;
   4384     DWORD dwMsgEncodingType;
   4385     HCRYPTPROV_LEGACY hCryptProv;
   4386     CRYPT_ALGORITHM_IDENTIFIER HashAlgorithm;
   4387     void *pvHashAuxInfo;
   4388   } CRYPT_HASH_MESSAGE_PARA,*PCRYPT_HASH_MESSAGE_PARA;
   4389 
   4390   typedef struct _CRYPT_KEY_SIGN_MESSAGE_PARA {
   4391     DWORD cbSize;
   4392     DWORD dwMsgAndCertEncodingType;
   4393     __C89_NAMELESS union {
   4394       HCRYPTPROV hCryptProv;
   4395       NCRYPT_KEY_HANDLE hNCryptKey;
   4396     };
   4397     DWORD dwKeySpec;
   4398     CRYPT_ALGORITHM_IDENTIFIER HashAlgorithm;
   4399     void *pvHashAuxInfo;
   4400     CRYPT_ALGORITHM_IDENTIFIER PubKeyAlgorithm;
   4401   } CRYPT_KEY_SIGN_MESSAGE_PARA,*PCRYPT_KEY_SIGN_MESSAGE_PARA;
   4402 
   4403   typedef struct _CRYPT_KEY_VERIFY_MESSAGE_PARA {
   4404     DWORD cbSize;
   4405     DWORD dwMsgEncodingType;
   4406     HCRYPTPROV_LEGACY hCryptProv;
   4407   } CRYPT_KEY_VERIFY_MESSAGE_PARA,*PCRYPT_KEY_VERIFY_MESSAGE_PARA;
   4408 
   4409   typedef struct _CERT_CHAIN {
   4410     DWORD cCerts;
   4411     PCERT_BLOB certs;
   4412     CRYPT_KEY_PROV_INFO keyLocatorInfo;
   4413   } CERT_CHAIN,*PCERT_CHAIN;
   4414 
   4415 #define CertOpenSystemStore __MINGW_NAME_AW(CertOpenSystemStore)
   4416 #define CertAddEncodedCertificateToSystemStore __MINGW_NAME_AW(CertAddEncodedCertificateToSystemStore)
   4417 
   4418   WINIMPM WINBOOL WINAPI CryptSignMessage (PCRYPT_SIGN_MESSAGE_PARA pSignPara, WINBOOL fDetachedSignature, DWORD cToBeSigned, const BYTE *rgpbToBeSigned[], DWORD rgcbToBeSigned[], BYTE *pbSignedBlob, DWORD *pcbSignedBlob);
   4419   WINIMPM WINBOOL WINAPI CryptVerifyMessageSignature (PCRYPT_VERIFY_MESSAGE_PARA pVerifyPara, DWORD dwSignerIndex, const BYTE *pbSignedBlob, DWORD cbSignedBlob, BYTE *pbDecoded, DWORD *pcbDecoded, PCCERT_CONTEXT *ppSignerCert);
   4420   WINIMPM LONG WINAPI CryptGetMessageSignerCount (DWORD dwMsgEncodingType, const BYTE *pbSignedBlob, DWORD cbSignedBlob);
   4421   WINIMPM HCERTSTORE WINAPI CryptGetMessageCertificates (DWORD dwMsgAndCertEncodingType, HCRYPTPROV_LEGACY hCryptProv, DWORD dwFlags, const BYTE *pbSignedBlob, DWORD cbSignedBlob);
   4422   WINIMPM WINBOOL WINAPI CryptVerifyDetachedMessageSignature (PCRYPT_VERIFY_MESSAGE_PARA pVerifyPara, DWORD dwSignerIndex, const BYTE *pbDetachedSignBlob, DWORD cbDetachedSignBlob, DWORD cToBeSigned, const BYTE *rgpbToBeSigned[], DWORD rgcbToBeSigned[], PCCERT_CONTEXT *ppSignerCert);
   4423   WINIMPM WINBOOL WINAPI CryptEncryptMessage (PCRYPT_ENCRYPT_MESSAGE_PARA pEncryptPara, DWORD cRecipientCert, PCCERT_CONTEXT rgpRecipientCert[], const BYTE *pbToBeEncrypted, DWORD cbToBeEncrypted, BYTE *pbEncryptedBlob, DWORD *pcbEncryptedBlob);
   4424   WINIMPM WINBOOL WINAPI CryptDecryptMessage (PCRYPT_DECRYPT_MESSAGE_PARA pDecryptPara, const BYTE *pbEncryptedBlob, DWORD cbEncryptedBlob, BYTE *pbDecrypted, DWORD *pcbDecrypted, PCCERT_CONTEXT *ppXchgCert);
   4425   WINIMPM WINBOOL WINAPI CryptSignAndEncryptMessage (PCRYPT_SIGN_MESSAGE_PARA pSignPara, PCRYPT_ENCRYPT_MESSAGE_PARA pEncryptPara, DWORD cRecipientCert, PCCERT_CONTEXT rgpRecipientCert[], const BYTE *pbToBeSignedAndEncrypted, DWORD cbToBeSignedAndEncrypted, BYTE *pbSignedAndEncryptedBlob, DWORD *pcbSignedAndEncryptedBlob);
   4426   WINIMPM WINBOOL WINAPI CryptDecryptAndVerifyMessageSignature (PCRYPT_DECRYPT_MESSAGE_PARA pDecryptPara, PCRYPT_VERIFY_MESSAGE_PARA pVerifyPara, DWORD dwSignerIndex, const BYTE *pbEncryptedBlob, DWORD cbEncryptedBlob, BYTE *pbDecrypted, DWORD *pcbDecrypted, PCCERT_CONTEXT *ppXchgCert, PCCERT_CONTEXT *ppSignerCert);
   4427   WINIMPM WINBOOL WINAPI CryptDecodeMessage (DWORD dwMsgTypeFlags, PCRYPT_DECRYPT_MESSAGE_PARA pDecryptPara, PCRYPT_VERIFY_MESSAGE_PARA pVerifyPara, DWORD dwSignerIndex, const BYTE *pbEncodedBlob, DWORD cbEncodedBlob, DWORD dwPrevInnerContentType, DWORD *pdwMsgType, DWORD *pdwInnerContentType, BYTE *pbDecoded, DWORD *pcbDecoded, PCCERT_CONTEXT *ppXchgCert, PCCERT_CONTEXT *ppSignerCert);
   4428   WINIMPM WINBOOL WINAPI CryptHashMessage (PCRYPT_HASH_MESSAGE_PARA pHashPara, WINBOOL fDetachedHash, DWORD cToBeHashed, const BYTE *rgpbToBeHashed[], DWORD rgcbToBeHashed[], BYTE *pbHashedBlob, DWORD *pcbHashedBlob, BYTE *pbComputedHash, DWORD *pcbComputedHash);
   4429   WINIMPM WINBOOL WINAPI CryptVerifyMessageHash (PCRYPT_HASH_MESSAGE_PARA pHashPara, BYTE *pbHashedBlob, DWORD cbHashedBlob, BYTE *pbToBeHashed, DWORD *pcbToBeHashed, BYTE *pbComputedHash, DWORD *pcbComputedHash);
   4430   WINIMPM WINBOOL WINAPI CryptVerifyDetachedMessageHash (PCRYPT_HASH_MESSAGE_PARA pHashPara, BYTE *pbDetachedHashBlob, DWORD cbDetachedHashBlob, DWORD cToBeHashed, const BYTE *rgpbToBeHashed[], DWORD rgcbToBeHashed[], BYTE *pbComputedHash, DWORD *pcbComputedHash);
   4431   WINIMPM WINBOOL WINAPI CryptSignMessageWithKey (PCRYPT_KEY_SIGN_MESSAGE_PARA pSignPara, const BYTE *pbToBeSigned, DWORD cbToBeSigned, BYTE *pbSignedBlob, DWORD *pcbSignedBlob);
   4432   WINIMPM WINBOOL WINAPI CryptVerifyMessageSignatureWithKey (PCRYPT_KEY_VERIFY_MESSAGE_PARA pVerifyPara, PCERT_PUBLIC_KEY_INFO pPublicKeyInfo, const BYTE *pbSignedBlob, DWORD cbSignedBlob, BYTE *pbDecoded, DWORD *pcbDecoded);
   4433   WINIMPM HCERTSTORE WINAPI CertOpenSystemStoreA (HCRYPTPROV_LEGACY hProv, LPCSTR szSubsystemProtocol);
   4434   WINIMPM HCERTSTORE WINAPI CertOpenSystemStoreW (HCRYPTPROV_LEGACY hProv, LPCWSTR szSubsystemProtocol);
   4435   WINIMPM WINBOOL WINAPI CertAddEncodedCertificateToSystemStoreA (LPCSTR szCertStoreName, const BYTE *pbCertEncoded, DWORD cbCertEncoded);
   4436   WINIMPM WINBOOL WINAPI CertAddEncodedCertificateToSystemStoreW (LPCWSTR szCertStoreName, const BYTE *pbCertEncoded, DWORD cbCertEncoded);
   4437   HRESULT WINAPI FindCertsByIssuer (PCERT_CHAIN pCertChains, DWORD *pcbCertChains, DWORD *pcCertChains, BYTE *pbEncodedIssuerName, DWORD cbEncodedIssuerName, LPCWSTR pwszPurpose, DWORD dwKeySpec);
   4438   WINIMPM WINBOOL WINAPI CryptQueryObject (DWORD dwObjectType, const void *pvObject, DWORD dwExpectedContentTypeFlags, DWORD dwExpectedFormatTypeFlags, DWORD dwFlags, DWORD *pdwMsgAndCertEncodingType, DWORD *pdwContentType, DWORD *pdwFormatType, HCERTSTORE *phCertStore, HCRYPTMSG *phMsg, const void **ppvContext);
   4439 
   4440 #define CERT_QUERY_OBJECT_FILE 0x1
   4441 #define CERT_QUERY_OBJECT_BLOB 0x2
   4442 
   4443 #define CERT_QUERY_CONTENT_CERT 1
   4444 #define CERT_QUERY_CONTENT_CTL 2
   4445 #define CERT_QUERY_CONTENT_CRL 3
   4446 #define CERT_QUERY_CONTENT_SERIALIZED_STORE 4
   4447 #define CERT_QUERY_CONTENT_SERIALIZED_CERT 5
   4448 #define CERT_QUERY_CONTENT_SERIALIZED_CTL 6
   4449 #define CERT_QUERY_CONTENT_SERIALIZED_CRL 7
   4450 #define CERT_QUERY_CONTENT_PKCS7_SIGNED 8
   4451 #define CERT_QUERY_CONTENT_PKCS7_UNSIGNED 9
   4452 #define CERT_QUERY_CONTENT_PKCS7_SIGNED_EMBED 10
   4453 #define CERT_QUERY_CONTENT_PKCS10 11
   4454 #define CERT_QUERY_CONTENT_PFX 12
   4455 #define CERT_QUERY_CONTENT_CERT_PAIR 13
   4456 #define CERT_QUERY_CONTENT_PFX_AND_LOAD 14
   4457 
   4458 #define CERT_QUERY_CONTENT_FLAG_CERT (1 << CERT_QUERY_CONTENT_CERT)
   4459 #define CERT_QUERY_CONTENT_FLAG_CTL (1 << CERT_QUERY_CONTENT_CTL)
   4460 #define CERT_QUERY_CONTENT_FLAG_CRL (1 << CERT_QUERY_CONTENT_CRL)
   4461 #define CERT_QUERY_CONTENT_FLAG_SERIALIZED_STORE (1 << CERT_QUERY_CONTENT_SERIALIZED_STORE)
   4462 #define CERT_QUERY_CONTENT_FLAG_SERIALIZED_CERT (1 << CERT_QUERY_CONTENT_SERIALIZED_CERT)
   4463 #define CERT_QUERY_CONTENT_FLAG_SERIALIZED_CTL (1 << CERT_QUERY_CONTENT_SERIALIZED_CTL)
   4464 #define CERT_QUERY_CONTENT_FLAG_SERIALIZED_CRL (1 << CERT_QUERY_CONTENT_SERIALIZED_CRL)
   4465 #define CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED (1 << CERT_QUERY_CONTENT_PKCS7_SIGNED)
   4466 #define CERT_QUERY_CONTENT_FLAG_PKCS7_UNSIGNED (1 << CERT_QUERY_CONTENT_PKCS7_UNSIGNED)
   4467 #define CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED_EMBED (1 << CERT_QUERY_CONTENT_PKCS7_SIGNED_EMBED)
   4468 #define CERT_QUERY_CONTENT_FLAG_PKCS10 (1 << CERT_QUERY_CONTENT_PKCS10)
   4469 #define CERT_QUERY_CONTENT_FLAG_PFX (1 << CERT_QUERY_CONTENT_PFX)
   4470 #define CERT_QUERY_CONTENT_FLAG_CERT_PAIR (1 << CERT_QUERY_CONTENT_CERT_PAIR)
   4471 #define CERT_QUERY_CONTENT_FLAG_PFX_AND_LOAD (1 << CERT_QUERY_CONTENT_PFX_AND_LOAD)
   4472 
   4473 #define CERT_QUERY_CONTENT_FLAG_ALL (CERT_QUERY_CONTENT_FLAG_CERT | CERT_QUERY_CONTENT_FLAG_CTL | CERT_QUERY_CONTENT_FLAG_CRL | CERT_QUERY_CONTENT_FLAG_SERIALIZED_STORE | CERT_QUERY_CONTENT_FLAG_SERIALIZED_CERT | CERT_QUERY_CONTENT_FLAG_SERIALIZED_CTL | CERT_QUERY_CONTENT_FLAG_SERIALIZED_CRL | CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED | CERT_QUERY_CONTENT_FLAG_PKCS7_UNSIGNED | CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED_EMBED | CERT_QUERY_CONTENT_FLAG_PKCS10 | CERT_QUERY_CONTENT_FLAG_PFX | CERT_QUERY_CONTENT_FLAG_CERT_PAIR)
   4474 #define CERT_QUERY_CONTENT_FLAG_ALL_ISSUER_CERT (CERT_QUERY_CONTENT_FLAG_CERT | CERT_QUERY_CONTENT_FLAG_SERIALIZED_STORE | CERT_QUERY_CONTENT_FLAG_SERIALIZED_CERT | CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED | CERT_QUERY_CONTENT_FLAG_PKCS7_UNSIGNED)
   4475 
   4476 #define CERT_QUERY_FORMAT_BINARY 1
   4477 #define CERT_QUERY_FORMAT_BASE64_ENCODED 2
   4478 #define CERT_QUERY_FORMAT_ASN_ASCII_HEX_ENCODED 3
   4479 
   4480 #define CERT_QUERY_FORMAT_FLAG_BINARY (1 << CERT_QUERY_FORMAT_BINARY)
   4481 #define CERT_QUERY_FORMAT_FLAG_BASE64_ENCODED (1 << CERT_QUERY_FORMAT_BASE64_ENCODED)
   4482 #define CERT_QUERY_FORMAT_FLAG_ASN_ASCII_HEX_ENCODED (1 << CERT_QUERY_FORMAT_ASN_ASCII_HEX_ENCODED)
   4483 
   4484 #define CERT_QUERY_FORMAT_FLAG_ALL (CERT_QUERY_FORMAT_FLAG_BINARY | CERT_QUERY_FORMAT_FLAG_BASE64_ENCODED | CERT_QUERY_FORMAT_FLAG_ASN_ASCII_HEX_ENCODED)
   4485 
   4486   typedef HANDLE HCRYPTASYNC,*PHCRYPTASYNC;
   4487   typedef VOID (WINAPI *PFN_CRYPT_ASYNC_PARAM_FREE_FUNC) (LPSTR pszParamOid, LPVOID pvParam);
   4488 
   4489   WINIMPM LPVOID WINAPI CryptMemAlloc (ULONG cbSize);
   4490   WINIMPM LPVOID WINAPI CryptMemRealloc (LPVOID pv, ULONG cbSize);
   4491   WINIMPM VOID WINAPI CryptMemFree (LPVOID pv);
   4492   WINIMPM WINBOOL WINAPI CryptCreateAsyncHandle (DWORD dwFlags, PHCRYPTASYNC phAsync);
   4493   WINIMPM WINBOOL WINAPI CryptSetAsyncParam (HCRYPTASYNC hAsync, LPSTR pszParamOid, LPVOID pvParam, PFN_CRYPT_ASYNC_PARAM_FREE_FUNC pfnFree);
   4494   WINIMPM WINBOOL WINAPI CryptGetAsyncParam (HCRYPTASYNC hAsync, LPSTR pszParamOid, LPVOID *ppvParam, PFN_CRYPT_ASYNC_PARAM_FREE_FUNC *ppfnFree);
   4495   WINIMPM WINBOOL WINAPI CryptCloseAsyncHandle (HCRYPTASYNC hAsync);
   4496 
   4497   typedef struct _CRYPT_BLOB_ARRAY {
   4498     DWORD cBlob;
   4499     PCRYPT_DATA_BLOB rgBlob;
   4500   } CRYPT_BLOB_ARRAY,*PCRYPT_BLOB_ARRAY;
   4501 
   4502   typedef struct _CRYPT_CREDENTIALS {
   4503     DWORD cbSize;
   4504     LPCSTR pszCredentialsOid;
   4505     LPVOID pvCredentials;
   4506   } CRYPT_CREDENTIALS,*PCRYPT_CREDENTIALS;
   4507 
   4508 #define CREDENTIAL_OID_PASSWORD_CREDENTIALS_A ((LPCSTR)1)
   4509 #define CREDENTIAL_OID_PASSWORD_CREDENTIALS_W ((LPCSTR)2)
   4510 
   4511 #define CREDENTIAL_OID_PASSWORD_CREDENTIALS __MINGW_NAME_UAW(CREDENTIAL_OID_PASSWORD_CREDENTIALS)
   4512 
   4513   typedef struct _CRYPT_PASSWORD_CREDENTIALSA {
   4514     DWORD cbSize;
   4515     LPSTR pszUsername;
   4516     LPSTR pszPassword;
   4517   } CRYPT_PASSWORD_CREDENTIALSA,*PCRYPT_PASSWORD_CREDENTIALSA;
   4518 
   4519   typedef struct _CRYPT_PASSWORD_CREDENTIALSW {
   4520     DWORD cbSize;
   4521     LPWSTR pszUsername;
   4522     LPWSTR pszPassword;
   4523   } CRYPT_PASSWORD_CREDENTIALSW,*PCRYPT_PASSWORD_CREDENTIALSW;
   4524 
   4525   typedef __MINGW_NAME_AW(CRYPT_PASSWORD_CREDENTIALS) CRYPT_PASSWORD_CREDENTIALS;
   4526   typedef __MINGW_NAME_AW(PCRYPT_PASSWORD_CREDENTIALS) PCRYPT_PASSWORD_CREDENTIALS;
   4527 
   4528 #define SCHEME_OID_RETRIEVE_ENCODED_OBJECT_FUNC "SchemeDllRetrieveEncodedObject"
   4529 #define SCHEME_OID_RETRIEVE_ENCODED_OBJECTW_FUNC "SchemeDllRetrieveEncodedObjectW"
   4530 #define CONTEXT_OID_CREATE_OBJECT_CONTEXT_FUNC "ContextDllCreateObjectContext"
   4531 
   4532   typedef VOID (WINAPI *PFN_FREE_ENCODED_OBJECT_FUNC) (LPCSTR pszObjectOid, PCRYPT_BLOB_ARRAY pObject, LPVOID pvFreeContext);
   4533 
   4534 #define CONTEXT_OID_CERTIFICATE ((LPCSTR)1)
   4535 #define CONTEXT_OID_CRL ((LPCSTR)2)
   4536 #define CONTEXT_OID_CTL ((LPCSTR)3)
   4537 #define CONTEXT_OID_PKCS7 ((LPCSTR)4)
   4538 #define CONTEXT_OID_CAPI2_ANY ((LPCSTR)5)
   4539 #define CONTEXT_OID_OCSP_RESP ((LPCSTR)6)
   4540 
   4541 #define CRYPT_RETRIEVE_MULTIPLE_OBJECTS 0x1
   4542 #define CRYPT_CACHE_ONLY_RETRIEVAL 0x2
   4543 #define CRYPT_WIRE_ONLY_RETRIEVAL 0x4
   4544 #define CRYPT_DONT_CACHE_RESULT 0x8
   4545 #define CRYPT_ASYNC_RETRIEVAL 0x10
   4546 #define CRYPT_VERIFY_CONTEXT_SIGNATURE 0x20
   4547 #define CRYPT_VERIFY_DATA_HASH 0x40
   4548 #define CRYPT_KEEP_TIME_VALID 0x80
   4549 #define CRYPT_DONT_VERIFY_SIGNATURE 0x100
   4550 #define CRYPT_DONT_CHECK_TIME_VALIDITY 0x200
   4551 #define CRYPT_CHECK_FRESHNESS_TIME_VALIDITY 0x400
   4552 #define CRYPT_ACCUMULATIVE_TIMEOUT 0x800
   4553 #define CRYPT_STICKY_CACHE_RETRIEVAL 0x1000
   4554 #define CRYPT_LDAP_SCOPE_BASE_ONLY_RETRIEVAL 0x2000
   4555 #define CRYPT_OFFLINE_CHECK_RETRIEVAL 0x4000
   4556 #define CRYPT_LDAP_INSERT_ENTRY_ATTRIBUTE 0x8000
   4557 #define CRYPT_LDAP_SIGN_RETRIEVAL 0x10000
   4558 #define CRYPT_NO_AUTH_RETRIEVAL 0x20000
   4559 #define CRYPT_LDAP_AREC_EXCLUSIVE_RETRIEVAL 0x40000
   4560 #define CRYPT_AIA_RETRIEVAL 0x80000
   4561 #define CRYPT_HTTP_POST_RETRIEVAL 0x100000
   4562 #define CRYPT_PROXY_CACHE_RETRIEVAL 0x200000
   4563 #define CRYPT_NOT_MODIFIED_RETRIEVAL 0x400000
   4564 #define CRYPT_ENABLE_SSL_REVOCATION_RETRIEVAL 0x800000
   4565 #define CRYPT_OCSP_ONLY_RETRIEVAL 0x1000000
   4566 #define CRYPT_NO_OCSP_FAILOVER_TO_CRL_RETRIEVAL 0x2000000
   4567 #define CRYPT_RANDOM_QUERY_STRING_RETRIEVAL 0x4000000
   4568 
   4569   typedef struct _CRYPTNET_URL_CACHE_PRE_FETCH_INFO {
   4570     DWORD cbSize;
   4571     DWORD dwObjectType;
   4572     DWORD dwError;
   4573     DWORD dwReserved;
   4574     FILETIME ThisUpdateTime;
   4575     FILETIME NextUpdateTime;
   4576     FILETIME PublishTime;
   4577   } CRYPTNET_URL_CACHE_PRE_FETCH_INFO,*PCRYPTNET_URL_CACHE_PRE_FETCH_INFO;
   4578 
   4579 #define CRYPTNET_URL_CACHE_PRE_FETCH_NONE 0
   4580 #define CRYPTNET_URL_CACHE_PRE_FETCH_BLOB 1
   4581 #define CRYPTNET_URL_CACHE_PRE_FETCH_CRL 2
   4582 #define CRYPTNET_URL_CACHE_PRE_FETCH_OCSP 3
   4583 #define CRYPTNET_URL_CACHE_PRE_FETCH_AUTOROOT_CAB 5
   4584 #define CRYPTNET_URL_CACHE_PRE_FETCH_DISALLOWED_CERT_CAB 6
   4585 
   4586   typedef struct _CRYPTNET_URL_CACHE_FLUSH_INFO {
   4587     DWORD cbSize;
   4588     DWORD dwExemptSeconds;
   4589     FILETIME ExpireTime;
   4590   } CRYPTNET_URL_CACHE_FLUSH_INFO,*PCRYPTNET_URL_CACHE_FLUSH_INFO;
   4591 
   4592 #define CRYPTNET_URL_CACHE_DEFAULT_FLUSH 0
   4593 #define CRYPTNET_URL_CACHE_DISABLE_FLUSH 0xffffffff
   4594 
   4595   typedef struct _CRYPTNET_URL_CACHE_RESPONSE_INFO {
   4596     DWORD cbSize;
   4597     WORD wResponseType;
   4598     WORD wResponseFlags;
   4599     FILETIME LastModifiedTime;
   4600     DWORD dwMaxAge;
   4601     LPCWSTR pwszETag;
   4602     DWORD dwProxyId;
   4603   } CRYPTNET_URL_CACHE_RESPONSE_INFO,*PCRYPTNET_URL_CACHE_RESPONSE_INFO;
   4604 
   4605 #define CRYPTNET_URL_CACHE_RESPONSE_NONE 0
   4606 #define CRYPTNET_URL_CACHE_RESPONSE_HTTP 1
   4607 
   4608 #define CRYPTNET_URL_CACHE_RESPONSE_VALIDATED 0x8000
   4609 
   4610   typedef struct _CRYPT_RETRIEVE_AUX_INFO {
   4611     DWORD cbSize;
   4612     FILETIME *pLastSyncTime;
   4613     DWORD dwMaxUrlRetrievalByteCount;
   4614     PCRYPTNET_URL_CACHE_PRE_FETCH_INFO pPreFetchInfo;
   4615     PCRYPTNET_URL_CACHE_FLUSH_INFO pFlushInfo;
   4616     PCRYPTNET_URL_CACHE_RESPONSE_INFO *ppResponseInfo;
   4617     LPWSTR pwszCacheFileNamePrefix;
   4618     LPFILETIME pftCacheResync;
   4619     WINBOOL fProxyCacheRetrieval;
   4620     DWORD dwHttpStatusCode;
   4621   } CRYPT_RETRIEVE_AUX_INFO,*PCRYPT_RETRIEVE_AUX_INFO;
   4622 
   4623   WINIMPM WINBOOL WINAPI CryptRetrieveObjectByUrlA (LPCSTR pszUrl, LPCSTR pszObjectOid, DWORD dwRetrievalFlags, DWORD dwTimeout, LPVOID *ppvObject, HCRYPTASYNC hAsyncRetrieve, PCRYPT_CREDENTIALS pCredentials, LPVOID pvVerify, PCRYPT_RETRIEVE_AUX_INFO pAuxInfo);
   4624   WINIMPM WINBOOL WINAPI CryptRetrieveObjectByUrlW (LPCWSTR pszUrl, LPCSTR pszObjectOid, DWORD dwRetrievalFlags, DWORD dwTimeout, LPVOID *ppvObject, HCRYPTASYNC hAsyncRetrieve, PCRYPT_CREDENTIALS pCredentials, LPVOID pvVerify, PCRYPT_RETRIEVE_AUX_INFO pAuxInfo);
   4625 
   4626 #define CryptRetrieveObjectByUrl __MINGW_NAME_AW(CryptRetrieveObjectByUrl)
   4627 
   4628   typedef WINBOOL (WINAPI *PFN_CRYPT_CANCEL_RETRIEVAL) (DWORD dwFlags, void *pvArg);
   4629 
   4630   WINIMPM WINBOOL WINAPI CryptInstallCancelRetrieval (PFN_CRYPT_CANCEL_RETRIEVAL pfnCancel, const void *pvArg, DWORD dwFlags, void *pvReserved);
   4631   WINIMPM WINBOOL WINAPI CryptUninstallCancelRetrieval (DWORD dwFlags, void *pvReserved);
   4632   WINIMPM WINBOOL WINAPI CryptCancelAsyncRetrieval (HCRYPTASYNC hAsyncRetrieval);
   4633 
   4634 #define CRYPT_PARAM_ASYNC_RETRIEVAL_COMPLETION ((LPCSTR)1)
   4635 
   4636   typedef VOID (WINAPI *PFN_CRYPT_ASYNC_RETRIEVAL_COMPLETION_FUNC) (LPVOID pvCompletion, DWORD dwCompletionCode, LPCSTR pszUrl, LPSTR pszObjectOid, LPVOID pvObject);
   4637 
   4638   typedef struct _CRYPT_ASYNC_RETRIEVAL_COMPLETION {
   4639     PFN_CRYPT_ASYNC_RETRIEVAL_COMPLETION_FUNC pfnCompletion;
   4640     LPVOID pvCompletion;
   4641   } CRYPT_ASYNC_RETRIEVAL_COMPLETION,*PCRYPT_ASYNC_RETRIEVAL_COMPLETION;
   4642 
   4643 #define CRYPT_PARAM_CANCEL_ASYNC_RETRIEVAL ((LPCSTR)2)
   4644 
   4645   typedef WINBOOL (WINAPI *PFN_CANCEL_ASYNC_RETRIEVAL_FUNC) (HCRYPTASYNC hAsyncRetrieve);
   4646 
   4647 #define CRYPT_GET_URL_FROM_PROPERTY 0x1
   4648 #define CRYPT_GET_URL_FROM_EXTENSION 0x2
   4649 #define CRYPT_GET_URL_FROM_UNAUTH_ATTRIBUTE 0x4
   4650 #define CRYPT_GET_URL_FROM_AUTH_ATTRIBUTE 0x8
   4651 
   4652   typedef struct _CRYPT_URL_ARRAY {
   4653     DWORD cUrl;
   4654     LPWSTR *rgwszUrl;
   4655   } CRYPT_URL_ARRAY,*PCRYPT_URL_ARRAY;
   4656 
   4657   typedef struct _CRYPT_URL_INFO {
   4658     DWORD cbSize;
   4659     DWORD dwSyncDeltaTime;
   4660     DWORD cGroup;
   4661     DWORD *rgcGroupEntry;
   4662   } CRYPT_URL_INFO,*PCRYPT_URL_INFO;
   4663 
   4664   WINIMPM WINBOOL WINAPI CryptGetObjectUrl (LPCSTR pszUrlOid, LPVOID pvPara, DWORD dwFlags, PCRYPT_URL_ARRAY pUrlArray, DWORD *pcbUrlArray, PCRYPT_URL_INFO pUrlInfo, DWORD *pcbUrlInfo, LPVOID pvReserved);
   4665 
   4666 #define URL_OID_GET_OBJECT_URL_FUNC "UrlDllGetObjectUrl"
   4667 
   4668 #define URL_OID_CERTIFICATE_ISSUER ((LPCSTR) 1)
   4669 #define URL_OID_CERTIFICATE_CRL_DIST_POINT ((LPCSTR) 2)
   4670 #define URL_OID_CTL_ISSUER ((LPCSTR) 3)
   4671 #define URL_OID_CTL_NEXT_UPDATE ((LPCSTR) 4)
   4672 #define URL_OID_CRL_ISSUER ((LPCSTR) 5)
   4673 #define URL_OID_CERTIFICATE_FRESHEST_CRL ((LPCSTR) 6)
   4674 #define URL_OID_CRL_FRESHEST_CRL ((LPCSTR) 7)
   4675 #define URL_OID_CROSS_CERT_DIST_POINT ((LPCSTR) 8)
   4676 #define URL_OID_CERTIFICATE_OCSP ((LPCSTR) 9)
   4677 #define URL_OID_CERTIFICATE_OCSP_AND_CRL_DIST_POINT ((LPCSTR) 10)
   4678 #define URL_OID_CERTIFICATE_CRL_DIST_POINT_AND_OCSP ((LPCSTR) 11)
   4679 #define URL_OID_CROSS_CERT_SUBJECT_INFO_ACCESS ((LPCSTR) 12)
   4680 #define URL_OID_CERTIFICATE_ONLY_OCSP ((LPCSTR) 13)
   4681 
   4682   typedef struct _CERT_CRL_CONTEXT_PAIR {
   4683     PCCERT_CONTEXT pCertContext;
   4684     PCCRL_CONTEXT pCrlContext;
   4685   } CERT_CRL_CONTEXT_PAIR,*PCERT_CRL_CONTEXT_PAIR;
   4686 
   4687   typedef const CERT_CRL_CONTEXT_PAIR *PCCERT_CRL_CONTEXT_PAIR;
   4688 
   4689   typedef struct _CRYPT_GET_TIME_VALID_OBJECT_EXTRA_INFO {
   4690     DWORD cbSize;
   4691     int iDeltaCrlIndicator;
   4692     LPFILETIME pftCacheResync;
   4693     LPFILETIME pLastSyncTime;
   4694     LPFILETIME pMaxAgeTime;
   4695     PCERT_REVOCATION_CHAIN_PARA pChainPara;
   4696     PCRYPT_INTEGER_BLOB pDeltaCrlIndicator;
   4697   } CRYPT_GET_TIME_VALID_OBJECT_EXTRA_INFO, *PCRYPT_GET_TIME_VALID_OBJECT_EXTRA_INFO;
   4698 
   4699   typedef WINBOOL (WINAPI *PFN_CRYPT_ENUM_KEYID_PROP) (const CRYPT_HASH_BLOB *pKeyIdentifier, DWORD dwFlags, void *pvReserved, void *pvArg, DWORD cProp, DWORD *rgdwPropId, void **rgpvData, DWORD *rgcbData);
   4700 
   4701 #define TIME_VALID_OID_GET_OBJECT_FUNC "TimeValidDllGetObject"
   4702 #define CERT_CHAIN_CONFIG_REGPATH L"Software\\Microsoft\\Cryptography\\OID\\EncodingType 0\\CertDllCreateCertificateChainEngine\\Config"
   4703 
   4704 #define TIME_VALID_OID_GET_CTL ((LPCSTR)1)
   4705 #define TIME_VALID_OID_GET_CRL ((LPCSTR)2)
   4706 #define TIME_VALID_OID_GET_CRL_FROM_CERT ((LPCSTR)3)
   4707 
   4708 #define TIME_VALID_OID_GET_FRESHEST_CRL_FROM_CERT ((LPCSTR)4)
   4709 #define TIME_VALID_OID_GET_FRESHEST_CRL_FROM_CRL ((LPCSTR)5)
   4710 
   4711 #define TIME_VALID_OID_FLUSH_OBJECT_FUNC "TimeValidDllFlushObject"
   4712 
   4713 #define TIME_VALID_OID_FLUSH_CTL ((LPCSTR)1)
   4714 #define TIME_VALID_OID_FLUSH_CRL ((LPCSTR)2)
   4715 #define TIME_VALID_OID_FLUSH_CRL_FROM_CERT ((LPCSTR)3)
   4716 #define TIME_VALID_OID_FLUSH_FRESHEST_CRL_FROM_CERT ((LPCSTR)4)
   4717 #define TIME_VALID_OID_FLUSH_FRESHEST_CRL_FROM_CRL ((LPCSTR)5)
   4718 
   4719 #define CERT_CREATE_SELFSIGN_NO_SIGN 1
   4720 #define CERT_CREATE_SELFSIGN_NO_KEY_INFO 2
   4721 
   4722 #define CRYPT_KEYID_DELETE_FLAG 0x10
   4723 #define CRYPT_KEYID_MACHINE_FLAG 0x20
   4724 #define CRYPT_KEYID_SET_NEW_FLAG 0x2000
   4725 #define CRYPT_KEYID_ALLOC_FLAG 0x8000
   4726 
   4727   WINIMPM WINBOOL WINAPI CryptGetTimeValidObject (LPCSTR pszTimeValidOid, LPVOID pvPara, PCCERT_CONTEXT pIssuer, LPFILETIME pftValidFor, DWORD dwFlags, DWORD dwTimeout, LPVOID *ppvObject, PCRYPT_CREDENTIALS pCredentials, PCRYPT_GET_TIME_VALID_OBJECT_EXTRA_INFO pExtraInfo);
   4728   WINIMPM WINBOOL WINAPI CryptFlushTimeValidObject (LPCSTR pszFlushTimeValidOid, LPVOID pvPara, PCCERT_CONTEXT pIssuer, DWORD dwFlags, LPVOID pvReserved);
   4729   WINIMPM PCCERT_CONTEXT WINAPI CertCreateSelfSignCertificate (HCRYPTPROV_OR_NCRYPT_KEY_HANDLE hCryptProvOrNCryptKey, PCERT_NAME_BLOB pSubjectIssuerBlob, DWORD dwFlags, PCRYPT_KEY_PROV_INFO pKeyProvInfo, PCRYPT_ALGORITHM_IDENTIFIER pSignatureAlgorithm, PSYSTEMTIME pStartTime, PSYSTEMTIME pEndTime, PCERT_EXTENSIONS pExtensions);
   4730   WINIMPM WINBOOL WINAPI CryptGetKeyIdentifierProperty (const CRYPT_HASH_BLOB *pKeyIdentifier, DWORD dwPropId, DWORD dwFlags, LPCWSTR pwszComputerName, void *pvReserved, void *pvData, DWORD *pcbData);
   4731   WINIMPM WINBOOL WINAPI CryptSetKeyIdentifierProperty (const CRYPT_HASH_BLOB *pKeyIdentifier, DWORD dwPropId, DWORD dwFlags, LPCWSTR pwszComputerName, void *pvReserved, const void *pvData);
   4732   WINIMPM WINBOOL WINAPI CryptEnumKeyIdentifierProperties (const CRYPT_HASH_BLOB *pKeyIdentifier, DWORD dwPropId, DWORD dwFlags, LPCWSTR pwszComputerName, void *pvReserved, void *pvArg, PFN_CRYPT_ENUM_KEYID_PROP pfnEnum);
   4733   WINIMPM WINBOOL WINAPI CryptCreateKeyIdentifierFromCSP (DWORD dwCertEncodingType, LPCSTR pszPubKeyOID, const PUBLICKEYSTRUC *pPubKeyStruc, DWORD cbPubKeyStruc, DWORD dwFlags, void *pvReserved, BYTE *pbHash, DWORD *pcbHash);
   4734 
   4735 #define CERT_CHAIN_MAX_URL_RETRIEVAL_BYTE_COUNT_VALUE_NAME L"MaxUrlRetrievalByteCount"
   4736 #define CERT_CHAIN_MAX_URL_RETRIEVAL_BYTE_COUNT_DEFAULT (100 *1024 *1024)
   4737 #define CERT_CHAIN_CACHE_RESYNC_FILETIME_VALUE_NAME L"ChainCacheResyncFiletime"
   4738 #define CERT_CHAIN_DISABLE_MANDATORY_BASIC_CONSTRAINTS_VALUE_NAME L"DisableMandatoryBasicConstraints"
   4739 #define CERT_CHAIN_DISABLE_CA_NAME_CONSTRAINTS_VALUE_NAME L"DisableCANameConstraints"
   4740 #define CERT_CHAIN_DISABLE_UNSUPPORTED_CRITICAL_EXTENSIONS_VALUE_NAME L"DisableUnsupportedCriticalExtensions"
   4741 #define CERT_CHAIN_MAX_AIA_URL_COUNT_IN_CERT_VALUE_NAME L"MaxAIAUrlCountInCert"
   4742 #define CERT_CHAIN_MAX_AIA_URL_COUNT_IN_CERT_DEFAULT 5
   4743 #define CERT_CHAIN_MAX_AIA_URL_RETRIEVAL_COUNT_PER_CHAIN_VALUE_NAME L"MaxAIAUrlRetrievalCountPerChain"
   4744 #define CERT_CHAIN_MAX_AIA_URL_RETRIEVAL_COUNT_PER_CHAIN_DEFAULT 3
   4745 #define CERT_CHAIN_MAX_AIA_URL_RETRIEVAL_BYTE_COUNT_VALUE_NAME L"MaxAIAUrlRetrievalByteCount"
   4746 #define CERT_CHAIN_MAX_AIA_URL_RETRIEVAL_BYTE_COUNT_DEFAULT 100000
   4747 #define CERT_CHAIN_MAX_AIA_URL_RETRIEVAL_CERT_COUNT_VALUE_NAME L"MaxAIAUrlRetrievalCertCount"
   4748 #define CERT_CHAIN_MAX_AIA_URL_RETRIEVAL_CERT_COUNT_DEFAULT 10
   4749 #define CERT_CHAIN_OCSP_VALIDITY_SECONDS_VALUE_NAME L"OcspValiditySeconds"
   4750 #define CERT_CHAIN_OCSP_VALIDITY_SECONDS_DEFAULT (12 *60 *60)
   4751 #define CERT_CHAIN_ENABLE_WEAK_SIGNATURE_FLAGS_VALUE_NAME L"EnableWeakSignatureFlags"
   4752 #define CERT_CHAIN_ENABLE_MD2_MD4_FLAG 0x1
   4753 #define CERT_CHAIN_ENABLE_WEAK_RSA_ROOT_FLAG 0x2
   4754 #define CERT_CHAIN_ENABLE_WEAK_LOGGING_FLAG 0x4
   4755 #define CERT_CHAIN_ENABLE_ONLY_WEAK_LOGGING_FLAG 0x8
   4756 #define CERT_CHAIN_MIN_RSA_PUB_KEY_BIT_LENGTH_VALUE_NAME L"MinRsaPubKeyBitLength"
   4757 #define CERT_CHAIN_MIN_RSA_PUB_KEY_BIT_LENGTH_DEFAULT 1023
   4758 #define CERT_CHAIN_MIN_RSA_PUB_KEY_BIT_LENGTH_DISABLE 0xffffffff
   4759 #define CERT_CHAIN_WEAK_RSA_PUB_KEY_TIME_VALUE_NAME L"WeakRsaPubKeyTime"
   4760 #define CERT_CHAIN_WEAK_RSA_PUB_KEY_TIME_DEFAULT 0x01ca8a755c6e0000ULL
   4761 #define CERT_CHAIN_WEAK_SIGNATURE_LOG_DIR_VALUE_NAME L"WeakSignatureLogDir"
   4762 #define CERT_SRV_OCSP_RESP_MIN_VALIDITY_SECONDS_VALUE_NAME L"SrvOcspRespMinValiditySeconds"
   4763 #define CERT_SRV_OCSP_RESP_MIN_VALIDITY_SECONDS_DEFAULT (10 *60)
   4764 #define CERT_SRV_OCSP_RESP_URL_RETRIEVAL_TIMEOUT_MILLISECONDS_VALUE_NAME L"SrvOcspRespUrlRetrievalTimeoutMilliseconds"
   4765 #define CERT_SRV_OCSP_RESP_URL_RETRIEVAL_TIMEOUT_MILLISECONDS_DEFAULT (15 *1000)
   4766 #define CERT_SRV_OCSP_RESP_MAX_BEFORE_NEXT_UPDATE_SECONDS_VALUE_NAME L"SrvOcspRespMaxBeforeNextUpdateSeconds"
   4767 #define CERT_SRV_OCSP_RESP_MAX_BEFORE_NEXT_UPDATE_SECONDS_DEFAULT (4 *60 *60)
   4768 #define CERT_SRV_OCSP_RESP_MIN_BEFORE_NEXT_UPDATE_SECONDS_VALUE_NAME L"SrvOcspRespMinBeforeNextUpdateSeconds"
   4769 #define CERT_SRV_OCSP_RESP_MIN_BEFORE_NEXT_UPDATE_SECONDS_DEFAULT (2 *60)
   4770 #define CERT_SRV_OCSP_RESP_MIN_AFTER_NEXT_UPDATE_SECONDS_VALUE_NAME L"SrvOcspRespMinAfterNextUpdateSeconds"
   4771 #define CERT_SRV_OCSP_RESP_MIN_AFTER_NEXT_UPDATE_SECONDS_DEFAULT (1 *60)
   4772 #define CRYPTNET_MAX_CACHED_OCSP_PER_CRL_COUNT_VALUE_NAME L"CryptnetMaxCachedOcspPerCrlCount"
   4773 #define CRYPTNET_MAX_CACHED_OCSP_PER_CRL_COUNT_DEFAULT 500
   4774 #define CRYPTNET_OCSP_AFTER_CRL_DISABLE 0xffffffff
   4775 #define CRYPTNET_URL_CACHE_DEFAULT_FLUSH_EXEMPT_SECONDS_VALUE_NAME L"CryptnetDefaultFlushExemptSeconds"
   4776 #define CRYPTNET_URL_CACHE_DEFAULT_FLUSH_EXEMPT_SECONDS_DEFAULT (28 *24 *60 *60)
   4777 #define CRYPTNET_PRE_FETCH_MIN_MAX_AGE_SECONDS_VALUE_NAME L"CryptnetPreFetchMinMaxAgeSeconds"
   4778 #define CRYPTNET_PRE_FETCH_MIN_MAX_AGE_SECONDS_DEFAULT (1 *60 *60)
   4779 #define CRYPTNET_PRE_FETCH_MAX_MAX_AGE_SECONDS_VALUE_NAME L"CryptnetPreFetchMaxMaxAgeSeconds"
   4780 #define CRYPTNET_PRE_FETCH_MAX_MAX_AGE_SECONDS_DEFAULT (14 *24 *60 *60)
   4781 #define CRYPTNET_PRE_FETCH_MIN_OCSP_VALIDITY_PERIOD_SECONDS_VALUE_NAME L"CryptnetPreFetchMinOcspValidityPeriodSeconds"
   4782 #define CRYPTNET_PRE_FETCH_MIN_OCSP_VALIDITY_PERIOD_SECONDS_DEFAULT (14 *24 *60 *60)
   4783 #define CRYPTNET_PRE_FETCH_AFTER_PUBLISH_PRE_FETCH_DIVISOR_VALUE_NAME L"CryptnetPreFetchAfterPublishPreFetchDivisor"
   4784 #define CRYPTNET_PRE_FETCH_AFTER_PUBLISH_PRE_FETCH_DIVISOR_DEFAULT 10
   4785 #define CRYPTNET_PRE_FETCH_BEFORE_NEXT_UPDATE_PRE_FETCH_DIVISOR_VALUE_NAME L"CryptnetPreFetchBeforeNextUpdatePreFetchDivisor"
   4786 #define CRYPTNET_PRE_FETCH_BEFORE_NEXT_UPDATE_PRE_FETCH_DIVISOR_DEFAULT 20
   4787 #define CRYPTNET_PRE_FETCH_MIN_BEFORE_NEXT_UPDATE_PRE_FETCH_PERIOD_SECONDS_VALUE_NAME L"CryptnetPreFetchMinBeforeNextUpdatePreFetchSeconds"
   4788 #define CRYPTNET_PRE_FETCH_MIN_BEFORE_NEXT_UPDATE_PRE_FETCH_PERIOD_SECONDS_DEFAULT (1 *60 *60)
   4789 #define CRYPTNET_PRE_FETCH_VALIDITY_PERIOD_AFTER_NEXT_UPDATE_PRE_FETCH_DIVISOR_VALUE_NAME L"CryptnetPreFetchValidityPeriodAfterNextUpdatePreFetchDivisor"
   4790 #define CRYPTNET_PRE_FETCH_VALIDITY_PERIOD_AFTER_NEXT_UPDATE_PRE_FETCH_DIVISOR_DEFAULT 10
   4791 #define CRYPTNET_PRE_FETCH_MAX_AFTER_NEXT_UPDATE_PRE_FETCH_PERIOD_SECONDS_VALUE_NAME L"CryptnetPreFetchMaxAfterNextUpdatePreFetchPeriodSeconds"
   4792 #define CRYPTNET_PRE_FETCH_MAX_AFTER_NEXT_UPDATE_PRE_FETCH_PERIOD_SECONDS_DEFAULT (4 *60 *60)
   4793 #define CRYPTNET_PRE_FETCH_MIN_AFTER_NEXT_UPDATE_PRE_FETCH_PERIOD_SECONDS_VALUE_NAME L"CryptnetPreFetchMinAfterNextUpdatePreFetchPeriodSeconds"
   4794 #define CRYPTNET_PRE_FETCH_MIN_AFTER_NEXT_UPDATE_PRE_FETCH_PERIOD_SECONDS_DEFAULT (30 *60)
   4795 #define CRYPTNET_PRE_FETCH_AFTER_CURRENT_TIME_PRE_FETCH_PERIOD_SECONDS_VALUE_NAME L"CryptnetPreFetchAfterCurrentTimePreFetchPeriodSeconds"
   4796 #define CRYPTNET_PRE_FETCH_AFTER_CURRENT_TIME_PRE_FETCH_PERIOD_SECONDS_DEFAULT (30 *60)
   4797 #define CRYPTNET_PRE_FETCH_TRIGGER_PERIOD_SECONDS_VALUE_NAME L"CryptnetPreFetchTriggerPeriodSeconds"
   4798 #define CRYPTNET_PRE_FETCH_TRIGGER_PERIOD_SECONDS_DEFAULT (10 *60)
   4799 #define CRYPTNET_PRE_FETCH_TRIGGER_DISABLE 0xffffffff
   4800 #define CRYPTNET_PRE_FETCH_SCAN_AFTER_TRIGGER_DELAY_SECONDS_VALUE_NAME L"CryptnetPreFetchScanAfterTriggerDelaySeconds"
   4801 #define CRYPTNET_PRE_FETCH_SCAN_AFTER_TRIGGER_DELAY_SECONDS_DEFAULT 30
   4802 #define CRYPTNET_PRE_FETCH_RETRIEVAL_TIMEOUT_SECONDS_VALUE_NAME L"CryptnetPreFetchRetrievalTimeoutSeconds"
   4803 #define CRYPTNET_PRE_FETCH_RETRIEVAL_TIMEOUT_SECONDS_DEFAULT (5 *60)
   4804 #define CERT_GROUP_POLICY_CHAIN_CONFIG_REGPATH CERT_GROUP_POLICY_SYSTEM_STORE_REGPATH L"\\ChainEngine\\Config"
   4805 #define CERT_CHAIN_URL_RETRIEVAL_TIMEOUT_MILLISECONDS_VALUE_NAME L"ChainUrlRetrievalTimeoutMilliseconds"
   4806 #define CERT_CHAIN_URL_RETRIEVAL_TIMEOUT_MILLISECONDS_DEFAULT (15 *1000)
   4807 #define CERT_CHAIN_REV_ACCUMULATIVE_URL_RETRIEVAL_TIMEOUT_MILLISECONDS_VALUE_NAME L"ChainRevAccumulativeUrlRetrievalTimeoutMilliseconds"
   4808 #define CERT_CHAIN_REV_ACCUMULATIVE_URL_RETRIEVAL_TIMEOUT_MILLISECONDS_DEFAULT (20 *1000)
   4809 #define CERT_RETR_BEHAVIOR_INET_AUTH_VALUE_NAME L"EnableInetUnknownAuth"
   4810 #define CERT_RETR_BEHAVIOR_INET_STATUS_VALUE_NAME L"EnableInetLocal"
   4811 #define CERT_RETR_BEHAVIOR_FILE_VALUE_NAME L"AllowFileUrlScheme"
   4812 #define CERT_RETR_BEHAVIOR_LDAP_VALUE_NAME L"DisableLDAPSignAndEncrypt"
   4813 #define CRYPTNET_CACHED_OCSP_SWITCH_TO_CRL_COUNT_VALUE_NAME L"CryptnetCachedOcspSwitchToCrlCount"
   4814 #define CRYPTNET_CACHED_OCSP_SWITCH_TO_CRL_COUNT_DEFAULT 50
   4815 #define CRYPTNET_CRL_BEFORE_OCSP_ENABLE 0xffffffff
   4816 #define CERT_CHAIN_DISABLE_AIA_URL_RETRIEVAL_VALUE_NAME L"DisableAIAUrlRetrieval"
   4817 #define CERT_CHAIN_OPTIONS_VALUE_NAME L"Options"
   4818 #define CERT_CHAIN_OPTION_DISABLE_AIA_URL_RETRIEVAL 0x2
   4819 #define CERT_CHAIN_OPTION_ENABLE_SIA_URL_RETRIEVAL 0x4
   4820 #define CERT_CHAIN_CROSS_CERT_DOWNLOAD_INTERVAL_HOURS_VALUE_NAME L"CrossCertDownloadIntervalHours"
   4821 #define CERT_CHAIN_CROSS_CERT_DOWNLOAD_INTERVAL_HOURS_DEFAULT (24 *7)
   4822 #define CERT_CHAIN_CRL_VALIDITY_EXT_PERIOD_HOURS_VALUE_NAME L"CRLValidityExtensionPeriod"
   4823 #define CERT_CHAIN_CRL_VALIDITY_EXT_PERIOD_HOURS_DEFAULT 12
   4824 
   4825 #define HCCE_CURRENT_USER ((HCERTCHAINENGINE)NULL)
   4826 #define HCCE_LOCAL_MACHINE ((HCERTCHAINENGINE)0x1)
   4827 
   4828 #define CERT_CHAIN_CACHE_END_CERT 0x1
   4829 #define CERT_CHAIN_THREAD_STORE_SYNC 0x2
   4830 #define CERT_CHAIN_CACHE_ONLY_URL_RETRIEVAL 0x4
   4831 #define CERT_CHAIN_USE_LOCAL_MACHINE_STORE 0x8
   4832 #define CERT_CHAIN_ENABLE_CACHE_AUTO_UPDATE 0x10
   4833 #define CERT_CHAIN_ENABLE_SHARE_STORE 0x20
   4834 
   4835   typedef HANDLE HCERTCHAINENGINE;
   4836 
   4837   typedef struct _CERT_CHAIN_ENGINE_CONFIG {
   4838     DWORD cbSize;
   4839     HCERTSTORE hRestrictedRoot;
   4840     HCERTSTORE hRestrictedTrust;
   4841     HCERTSTORE hRestrictedOther;
   4842     DWORD cAdditionalStore;
   4843     HCERTSTORE *rghAdditionalStore;
   4844     DWORD dwFlags;
   4845     DWORD dwUrlRetrievalTimeout;
   4846     DWORD MaximumCachedCertificates;
   4847     DWORD CycleDetectionModulus;
   4848 #if NTDDI_VERSION >= 0x06010000
   4849     HCERTSTORE hExclusiveRoot;
   4850     HCERTSTORE hExclusiveTrustedPeople;
   4851 #endif
   4852 #if NTDDI_VERSION >= 0x06020000
   4853     DWORD dwExclusiveFlags;
   4854 #endif
   4855   } CERT_CHAIN_ENGINE_CONFIG,*PCERT_CHAIN_ENGINE_CONFIG;
   4856 
   4857 #if NTDDI_VERSION >= 0x06020000
   4858 #define CERT_CHAIN_EXCLUSIVE_ENABLE_CA_FLAG 0x1
   4859 #endif
   4860 
   4861   WINIMPM WINBOOL WINAPI CertCreateCertificateChainEngine (PCERT_CHAIN_ENGINE_CONFIG pConfig, HCERTCHAINENGINE *phChainEngine);
   4862   WINIMPM VOID WINAPI CertFreeCertificateChainEngine (HCERTCHAINENGINE hChainEngine);
   4863   WINIMPM WINBOOL WINAPI CertResyncCertificateChainEngine (HCERTCHAINENGINE hChainEngine);
   4864 
   4865   typedef struct _CERT_TRUST_STATUS {
   4866     DWORD dwErrorStatus;
   4867     DWORD dwInfoStatus;
   4868   } CERT_TRUST_STATUS,*PCERT_TRUST_STATUS;
   4869 
   4870 #define CERT_TRUST_NO_ERROR 0x0
   4871 #define CERT_TRUST_IS_NOT_TIME_VALID 0x1
   4872 #define CERT_TRUST_IS_NOT_TIME_NESTED 0x2
   4873 #define CERT_TRUST_IS_REVOKED 0x4
   4874 #define CERT_TRUST_IS_NOT_SIGNATURE_VALID 0x8
   4875 #define CERT_TRUST_IS_NOT_VALID_FOR_USAGE 0x10
   4876 #define CERT_TRUST_IS_UNTRUSTED_ROOT 0x20
   4877 #define CERT_TRUST_REVOCATION_STATUS_UNKNOWN 0x40
   4878 #define CERT_TRUST_IS_CYCLIC 0x80
   4879 #define CERT_TRUST_INVALID_EXTENSION 0x100
   4880 #define CERT_TRUST_INVALID_POLICY_CONSTRAINTS 0x200
   4881 #define CERT_TRUST_INVALID_BASIC_CONSTRAINTS 0x400
   4882 #define CERT_TRUST_INVALID_NAME_CONSTRAINTS 0x800
   4883 #define CERT_TRUST_HAS_NOT_SUPPORTED_NAME_CONSTRAINT 0x1000
   4884 #define CERT_TRUST_HAS_NOT_DEFINED_NAME_CONSTRAINT 0x2000
   4885 #define CERT_TRUST_HAS_NOT_PERMITTED_NAME_CONSTRAINT 0x4000
   4886 #define CERT_TRUST_HAS_EXCLUDED_NAME_CONSTRAINT 0x8000
   4887 #define CERT_TRUST_IS_PARTIAL_CHAIN 0x10000
   4888 #define CERT_TRUST_CTL_IS_NOT_TIME_VALID 0x20000
   4889 #define CERT_TRUST_CTL_IS_NOT_SIGNATURE_VALID 0x40000
   4890 #define CERT_TRUST_CTL_IS_NOT_VALID_FOR_USAGE 0x80000
   4891 #define CERT_TRUST_IS_OFFLINE_REVOCATION 0x1000000
   4892 #define CERT_TRUST_NO_ISSUANCE_CHAIN_POLICY 0x2000000
   4893 #define CERT_TRUST_IS_EXPLICIT_DISTRUST 0x4000000
   4894 #define CERT_TRUST_HAS_NOT_SUPPORTED_CRITICAL_EXT 0x8000000
   4895 #define CERT_TRUST_HAS_WEAK_SIGNATURE 0x100000
   4896 
   4897 #define CERT_TRUST_HAS_EXACT_MATCH_ISSUER 0x1
   4898 #define CERT_TRUST_HAS_KEY_MATCH_ISSUER 0x2
   4899 #define CERT_TRUST_HAS_NAME_MATCH_ISSUER 0x4
   4900 #define CERT_TRUST_IS_SELF_SIGNED 0x8
   4901 #define CERT_TRUST_AUTO_UPDATE_CA_REVOCATION 0x10
   4902 #define CERT_TRUST_AUTO_UPDATE_END_REVOCATION 0x20
   4903 #define CERT_TRUST_NO_OCSP_FAILOVER_TO_CRL 0x40
   4904 #define CERT_TRUST_HAS_PREFERRED_ISSUER 0x100
   4905 #define CERT_TRUST_HAS_ISSUANCE_CHAIN_POLICY 0x200
   4906 #define CERT_TRUST_HAS_VALID_NAME_CONSTRAINTS 0x400
   4907 #define CERT_TRUST_IS_PEER_TRUSTED 0x800
   4908 #define CERT_TRUST_HAS_CRL_VALIDITY_EXTENDED 0x1000
   4909 #define CERT_TRUST_IS_FROM_EXCLUSIVE_TRUST_STORE 0x2000
   4910 #if NTDDI_VERSION >= 0x06020000
   4911 #define CERT_TRUST_IS_CA_TRUSTED 0x4000
   4912 #endif
   4913 #define CERT_TRUST_IS_COMPLEX_CHAIN 0x10000
   4914 
   4915   typedef struct _CERT_REVOCATION_INFO {
   4916     DWORD cbSize;
   4917     DWORD dwRevocationResult;
   4918     LPCSTR pszRevocationOid;
   4919     LPVOID pvOidSpecificInfo;
   4920     WINBOOL fHasFreshnessTime;
   4921     DWORD dwFreshnessTime;
   4922     PCERT_REVOCATION_CRL_INFO pCrlInfo;
   4923   } CERT_REVOCATION_INFO,*PCERT_REVOCATION_INFO;
   4924 
   4925   typedef struct _CERT_TRUST_LIST_INFO {
   4926     DWORD cbSize;
   4927     PCTL_ENTRY pCtlEntry;
   4928     PCCTL_CONTEXT pCtlContext;
   4929   } CERT_TRUST_LIST_INFO,*PCERT_TRUST_LIST_INFO;
   4930 
   4931   typedef struct _CERT_CHAIN_ELEMENT {
   4932     DWORD cbSize;
   4933     PCCERT_CONTEXT pCertContext;
   4934     CERT_TRUST_STATUS TrustStatus;
   4935     PCERT_REVOCATION_INFO pRevocationInfo;
   4936     PCERT_ENHKEY_USAGE pIssuanceUsage;
   4937     PCERT_ENHKEY_USAGE pApplicationUsage;
   4938     LPCWSTR pwszExtendedErrorInfo;
   4939   } CERT_CHAIN_ELEMENT,*PCERT_CHAIN_ELEMENT;
   4940 
   4941   typedef const CERT_CHAIN_ELEMENT *PCCERT_CHAIN_ELEMENT;
   4942 
   4943   typedef struct _CERT_SIMPLE_CHAIN {
   4944     DWORD cbSize;
   4945     CERT_TRUST_STATUS TrustStatus;
   4946     DWORD cElement;
   4947     PCERT_CHAIN_ELEMENT *rgpElement;
   4948     PCERT_TRUST_LIST_INFO pTrustListInfo;
   4949     WINBOOL fHasRevocationFreshnessTime;
   4950     DWORD dwRevocationFreshnessTime;
   4951   } CERT_SIMPLE_CHAIN,*PCERT_SIMPLE_CHAIN;
   4952 
   4953   typedef const CERT_SIMPLE_CHAIN *PCCERT_SIMPLE_CHAIN;
   4954 
   4955   typedef struct _CERT_CHAIN_CONTEXT CERT_CHAIN_CONTEXT,*PCERT_CHAIN_CONTEXT;
   4956   typedef const CERT_CHAIN_CONTEXT *PCCERT_CHAIN_CONTEXT;
   4957 
   4958   struct _CERT_CHAIN_CONTEXT {
   4959     DWORD cbSize;
   4960     CERT_TRUST_STATUS TrustStatus;
   4961     DWORD cChain;
   4962     PCERT_SIMPLE_CHAIN *rgpChain;
   4963     DWORD cLowerQualityChainContext;
   4964     PCCERT_CHAIN_CONTEXT *rgpLowerQualityChainContext;
   4965     WINBOOL fHasRevocationFreshnessTime;
   4966     DWORD dwRevocationFreshnessTime;
   4967     DWORD dwCreateFlags;
   4968     GUID ChainId;
   4969   };
   4970 
   4971 #define USAGE_MATCH_TYPE_AND 0x0
   4972 #define USAGE_MATCH_TYPE_OR 0x1
   4973 
   4974   typedef struct _CERT_USAGE_MATCH {
   4975     DWORD dwType;
   4976     CERT_ENHKEY_USAGE Usage;
   4977   } CERT_USAGE_MATCH,*PCERT_USAGE_MATCH;
   4978 
   4979   typedef struct _CTL_USAGE_MATCH {
   4980     DWORD dwType;
   4981     CTL_USAGE Usage;
   4982   } CTL_USAGE_MATCH,*PCTL_USAGE_MATCH;
   4983 
   4984   typedef struct _CERT_CHAIN_PARA {
   4985     DWORD cbSize;
   4986     CERT_USAGE_MATCH RequestedUsage;
   4987 #ifdef CERT_CHAIN_PARA_HAS_EXTRA_FIELDS
   4988     CERT_USAGE_MATCH RequestedIssuancePolicy;
   4989     DWORD dwUrlRetrievalTimeout;
   4990     WINBOOL fCheckRevocationFreshnessTime;
   4991     DWORD dwRevocationFreshnessTime;
   4992     LPFILETIME pftCacheResync;
   4993     PCCERT_STRONG_SIGN_PARA pStrongSignPara;
   4994     DWORD dwStrongSignFlags;
   4995 #endif
   4996   } CERT_CHAIN_PARA,*PCERT_CHAIN_PARA;
   4997 
   4998 #define CERT_CHAIN_STRONG_SIGN_DISABLE_END_CHECK_FLAG 0x1
   4999 #define CERT_CHAIN_DISABLE_PASS1_QUALITY_FILTERING 0x40
   5000 #define CERT_CHAIN_RETURN_LOWER_QUALITY_CONTEXTS 0x80
   5001 #define CERT_CHAIN_DISABLE_AUTH_ROOT_AUTO_UPDATE 0x100
   5002 #define CERT_CHAIN_TIMESTAMP_TIME 0x200
   5003 #define CERT_CHAIN_ENABLE_PEER_TRUST 0x400
   5004 #define CERT_CHAIN_DISABLE_MY_PEER_TRUST 0x800
   5005 #define CERT_CHAIN_DISABLE_MD2_MD4 0x1000
   5006 #define CERT_CHAIN_REVOCATION_CHECK_END_CERT 0x10000000
   5007 #define CERT_CHAIN_REVOCATION_CHECK_CHAIN 0x20000000
   5008 #define CERT_CHAIN_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT 0x40000000
   5009 #define CERT_CHAIN_REVOCATION_CHECK_CACHE_ONLY 0x80000000
   5010 #define CERT_CHAIN_REVOCATION_ACCUMULATIVE_TIMEOUT 0x8000000
   5011 #define CERT_CHAIN_REVOCATION_CHECK_OCSP_CERT 0x4000000
   5012 
   5013   WINIMPM WINBOOL WINAPI CertGetCertificateChain (HCERTCHAINENGINE hChainEngine, PCCERT_CONTEXT pCertContext, LPFILETIME pTime, HCERTSTORE hAdditionalStore, PCERT_CHAIN_PARA pChainPara, DWORD dwFlags, LPVOID pvReserved, PCCERT_CHAIN_CONTEXT *ppChainContext);
   5014   WINIMPM VOID WINAPI CertFreeCertificateChain (PCCERT_CHAIN_CONTEXT pChainContext);
   5015   WINIMPM PCCERT_CHAIN_CONTEXT WINAPI CertDuplicateCertificateChain (PCCERT_CHAIN_CONTEXT pChainContext);
   5016 
   5017   struct _CERT_REVOCATION_CHAIN_PARA {
   5018     DWORD cbSize;
   5019     HCERTCHAINENGINE hChainEngine;
   5020     HCERTSTORE hAdditionalStore;
   5021     DWORD dwChainFlags;
   5022     DWORD dwUrlRetrievalTimeout;
   5023     LPFILETIME pftCurrentTime;
   5024     LPFILETIME pftCacheResync;
   5025     DWORD cbMaxUrlRetrievalByteCount;
   5026   };
   5027 
   5028 #define REVOCATION_OID_CRL_REVOCATION ((LPCSTR)1)
   5029 
   5030   typedef struct _CRL_REVOCATION_INFO {
   5031     PCRL_ENTRY pCrlEntry;
   5032     PCCRL_CONTEXT pCrlContext;
   5033     PCCERT_CHAIN_CONTEXT pCrlIssuerChain;
   5034   } CRL_REVOCATION_INFO,*PCRL_REVOCATION_INFO;
   5035 
   5036   WINIMPM PCCERT_CHAIN_CONTEXT WINAPI CertFindChainInStore (HCERTSTORE hCertStore, DWORD dwCertEncodingType, DWORD dwFindFlags, DWORD dwFindType, const void *pvFindPara, PCCERT_CHAIN_CONTEXT pPrevChainContext);
   5037 
   5038 #define CERT_CHAIN_FIND_BY_ISSUER 1
   5039 
   5040   typedef WINBOOL (WINAPI *PFN_CERT_CHAIN_FIND_BY_ISSUER_CALLBACK) (PCCERT_CONTEXT pCert, void *pvFindArg);
   5041 
   5042   typedef struct _CERT_CHAIN_FIND_BY_ISSUER_PARA {
   5043     DWORD cbSize;
   5044     LPCSTR pszUsageIdentifier;
   5045     DWORD dwKeySpec;
   5046     DWORD dwAcquirePrivateKeyFlags;
   5047     DWORD cIssuer;
   5048     CERT_NAME_BLOB *rgIssuer;
   5049     PFN_CERT_CHAIN_FIND_BY_ISSUER_CALLBACK pfnFindCallback;
   5050     void *pvFindArg;
   5051 #ifdef CERT_CHAIN_FIND_BY_ISSUER_PARA_HAS_EXTRA_FIELDS
   5052     DWORD *pdwIssuerChainIndex;
   5053     DWORD *pdwIssuerElementIndex;
   5054 #endif
   5055   } CERT_CHAIN_FIND_ISSUER_PARA,*PCERT_CHAIN_FIND_ISSUER_PARA,CERT_CHAIN_FIND_BY_ISSUER_PARA,*PCERT_CHAIN_FIND_BY_ISSUER_PARA;
   5056 
   5057 #define CERT_CHAIN_FIND_BY_ISSUER_COMPARE_KEY_FLAG 0x1
   5058 #define CERT_CHAIN_FIND_BY_ISSUER_COMPLEX_CHAIN_FLAG 0x2
   5059 #define CERT_CHAIN_FIND_BY_ISSUER_CACHE_ONLY_URL_FLAG 0x4
   5060 #define CERT_CHAIN_FIND_BY_ISSUER_LOCAL_MACHINE_FLAG 0x8
   5061 #define CERT_CHAIN_FIND_BY_ISSUER_NO_KEY_FLAG 0x4000
   5062 #define CERT_CHAIN_FIND_BY_ISSUER_CACHE_ONLY_FLAG 0x8000
   5063 
   5064   typedef struct _CERT_CHAIN_POLICY_PARA {
   5065     DWORD cbSize;
   5066     DWORD dwFlags;
   5067     void *pvExtraPolicyPara;
   5068   } CERT_CHAIN_POLICY_PARA,*PCERT_CHAIN_POLICY_PARA;
   5069 
   5070   typedef struct _CERT_CHAIN_POLICY_STATUS {
   5071     DWORD cbSize;
   5072     DWORD dwError;
   5073     LONG lChainIndex;
   5074     LONG lElementIndex;
   5075     void *pvExtraPolicyStatus;
   5076   } CERT_CHAIN_POLICY_STATUS,*PCERT_CHAIN_POLICY_STATUS;
   5077 
   5078 #define CERT_CHAIN_POLICY_IGNORE_NOT_TIME_VALID_FLAG 0x1
   5079 #define CERT_CHAIN_POLICY_IGNORE_CTL_NOT_TIME_VALID_FLAG 0x2
   5080 #define CERT_CHAIN_POLICY_IGNORE_NOT_TIME_NESTED_FLAG 0x4
   5081 #define CERT_CHAIN_POLICY_IGNORE_INVALID_BASIC_CONSTRAINTS_FLAG 0x8
   5082 
   5083 #define CERT_CHAIN_POLICY_IGNORE_ALL_NOT_TIME_VALID_FLAGS (CERT_CHAIN_POLICY_IGNORE_NOT_TIME_VALID_FLAG | CERT_CHAIN_POLICY_IGNORE_CTL_NOT_TIME_VALID_FLAG | CERT_CHAIN_POLICY_IGNORE_NOT_TIME_NESTED_FLAG)
   5084 
   5085 #define CERT_CHAIN_POLICY_ALLOW_UNKNOWN_CA_FLAG 0x10
   5086 #define CERT_CHAIN_POLICY_IGNORE_WRONG_USAGE_FLAG 0x20
   5087 #define CERT_CHAIN_POLICY_IGNORE_INVALID_NAME_FLAG 0x40
   5088 #define CERT_CHAIN_POLICY_IGNORE_INVALID_POLICY_FLAG 0x80
   5089 
   5090 #define CERT_CHAIN_POLICY_IGNORE_END_REV_UNKNOWN_FLAG 0x100
   5091 #define CERT_CHAIN_POLICY_IGNORE_CTL_SIGNER_REV_UNKNOWN_FLAG 0x200
   5092 #define CERT_CHAIN_POLICY_IGNORE_CA_REV_UNKNOWN_FLAG 0x400
   5093 #define CERT_CHAIN_POLICY_IGNORE_ROOT_REV_UNKNOWN_FLAG 0x800
   5094 
   5095 #define CERT_CHAIN_POLICY_IGNORE_ALL_REV_UNKNOWN_FLAGS (CERT_CHAIN_POLICY_IGNORE_END_REV_UNKNOWN_FLAG | CERT_CHAIN_POLICY_IGNORE_CTL_SIGNER_REV_UNKNOWN_FLAG | CERT_CHAIN_POLICY_IGNORE_CA_REV_UNKNOWN_FLAG | CERT_CHAIN_POLICY_IGNORE_ROOT_REV_UNKNOWN_FLAG)
   5096 
   5097 #define CERT_CHAIN_POLICY_IGNORE_PEER_TRUST_FLAG 0x1000
   5098 #define CERT_CHAIN_POLICY_IGNORE_NOT_SUPPORTED_CRITICAL_EXT_FLAG 0x2000
   5099 #define CERT_CHAIN_POLICY_TRUST_TESTROOT_FLAG 0x4000
   5100 #define CERT_CHAIN_POLICY_ALLOW_TESTROOT_FLAG 0x8000
   5101 
   5102   WINIMPM WINBOOL WINAPI CertVerifyCertificateChainPolicy (LPCSTR pszPolicyOID, PCCERT_CHAIN_CONTEXT pChainContext, PCERT_CHAIN_POLICY_PARA pPolicyPara, PCERT_CHAIN_POLICY_STATUS pPolicyStatus);
   5103 
   5104 #define CRYPT_OID_VERIFY_CERTIFICATE_CHAIN_POLICY_FUNC "CertDllVerifyCertificateChainPolicy"
   5105 
   5106 #define CERT_CHAIN_POLICY_BASE ((LPCSTR) 1)
   5107 #define CERT_CHAIN_POLICY_AUTHENTICODE ((LPCSTR) 2)
   5108 #define CERT_CHAIN_POLICY_AUTHENTICODE_TS ((LPCSTR) 3)
   5109 #define CERT_CHAIN_POLICY_SSL ((LPCSTR) 4)
   5110 #define CERT_CHAIN_POLICY_BASIC_CONSTRAINTS ((LPCSTR) 5)
   5111 #define CERT_CHAIN_POLICY_NT_AUTH ((LPCSTR) 6)
   5112 #define CERT_CHAIN_POLICY_MICROSOFT_ROOT ((LPCSTR) 7)
   5113 #define CERT_CHAIN_POLICY_EV ((LPCSTR) 8)
   5114 
   5115   typedef struct _AUTHENTICODE_EXTRA_CERT_CHAIN_POLICY_PARA {
   5116     DWORD cbSize;
   5117     DWORD dwRegPolicySettings;
   5118     PCMSG_SIGNER_INFO pSignerInfo;
   5119   } AUTHENTICODE_EXTRA_CERT_CHAIN_POLICY_PARA, *PAUTHENTICODE_EXTRA_CERT_CHAIN_POLICY_PARA;
   5120 
   5121   typedef struct _AUTHENTICODE_EXTRA_CERT_CHAIN_POLICY_STATUS {
   5122     DWORD cbSize;
   5123     WINBOOL fCommercial;
   5124   } AUTHENTICODE_EXTRA_CERT_CHAIN_POLICY_STATUS, *PAUTHENTICODE_EXTRA_CERT_CHAIN_POLICY_STATUS;
   5125 
   5126   typedef struct _AUTHENTICODE_TS_EXTRA_CERT_CHAIN_POLICY_PARA {
   5127     DWORD cbSize;
   5128     DWORD dwRegPolicySettings;
   5129     WINBOOL fCommercial;
   5130   } AUTHENTICODE_TS_EXTRA_CERT_CHAIN_POLICY_PARA,*PAUTHENTICODE_TS_EXTRA_CERT_CHAIN_POLICY_PARA;
   5131 
   5132 #define AUTHTYPE_CLIENT 1
   5133 #define AUTHTYPE_SERVER 2
   5134 
   5135   typedef struct _HTTPSPolicyCallbackData {
   5136     __C89_NAMELESS union {
   5137       DWORD cbStruct;
   5138       DWORD cbSize;
   5139     };
   5140     DWORD dwAuthType;
   5141     DWORD fdwChecks;
   5142     WCHAR *pwszServerName;
   5143   } HTTPSPolicyCallbackData,*PHTTPSPolicyCallbackData,SSL_EXTRA_CERT_CHAIN_POLICY_PARA,*PSSL_EXTRA_CERT_CHAIN_POLICY_PARA;
   5144 
   5145 #define BASIC_CONSTRAINTS_CERT_CHAIN_POLICY_CA_FLAG 0x80000000
   5146 #define BASIC_CONSTRAINTS_CERT_CHAIN_POLICY_END_ENTITY_FLAG 0x40000000
   5147 #define MICROSOFT_ROOT_CERT_CHAIN_POLICY_ENABLE_TEST_ROOT_FLAG 0x10000
   5148 #define MICROSOFT_ROOT_CERT_CHAIN_POLICY_CHECK_APPLICATION_ROOT_FLAG 0x20000
   5149 
   5150   typedef struct _EV_EXTRA_CERT_CHAIN_POLICY_PARA {
   5151     DWORD cbSize;
   5152     DWORD dwRootProgramQualifierFlags;
   5153   } EV_EXTRA_CERT_CHAIN_POLICY_PARA,*PEV_EXTRA_CERT_CHAIN_POLICY_PARA;
   5154 
   5155   typedef struct _EV_EXTRA_CERT_CHAIN_POLICY_STATUS {
   5156     DWORD cbSize;
   5157     DWORD dwQualifiers;
   5158     DWORD dwIssuanceUsageIndex;
   5159   } EV_EXTRA_CERT_CHAIN_POLICY_STATUS,*PEV_EXTRA_CERT_CHAIN_POLICY_STATUS;
   5160 
   5161 #define CryptStringToBinary __MINGW_NAME_AW(CryptStringToBinary)
   5162 #define CryptBinaryToString __MINGW_NAME_AW(CryptBinaryToString)
   5163 
   5164   WINIMPM WINBOOL WINAPI CryptStringToBinaryA (LPCSTR pszString, DWORD cchString, DWORD dwFlags, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags);
   5165   WINIMPM WINBOOL WINAPI CryptStringToBinaryW (LPCWSTR pszString, DWORD cchString, DWORD dwFlags, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags);
   5166   WINIMPM WINBOOL WINAPI CryptBinaryToStringA (CONST BYTE *pbBinary, DWORD cbBinary, DWORD dwFlags, LPSTR pszString, DWORD *pcchString);
   5167   WINIMPM WINBOOL WINAPI CryptBinaryToStringW (CONST BYTE *pbBinary, DWORD cbBinary, DWORD dwFlags, LPWSTR pszString, DWORD *pcchString);
   5168 
   5169 #define CRYPT_STRING_BASE64HEADER 0x0
   5170 #define CRYPT_STRING_BASE64 0x1
   5171 #define CRYPT_STRING_BINARY 0x2
   5172 #define CRYPT_STRING_BASE64REQUESTHEADER 0x00000003
   5173 #define CRYPT_STRING_HEX 0x4
   5174 #define CRYPT_STRING_HEXASCII 0x00000005
   5175 #define CRYPT_STRING_BASE64_ANY 0x00000006
   5176 #define CRYPT_STRING_ANY 0x00000007
   5177 #define CRYPT_STRING_HEX_ANY 0x8
   5178 #define CRYPT_STRING_BASE64X509CRLHEADER 0x00000009
   5179 #define CRYPT_STRING_HEXADDR 0x0000000a
   5180 #define CRYPT_STRING_HEXASCIIADDR 0x0000000b
   5181 #define CRYPT_STRING_HEXRAW 0x0000000c
   5182 
   5183 #define CRYPT_STRING_HASHDATA 0x10000000
   5184 #define CRYPT_STRING_STRICT 0x20000000
   5185 #define CRYPT_STRING_NOCRLF 0x40000000
   5186 #define CRYPT_STRING_NOCR 0x80000000
   5187 
   5188 #define szOID_PKCS_12_PbeIds "1.2.840.113549.1.12.1"
   5189 #define szOID_PKCS_12_pbeWithSHA1And128BitRC4 "1.2.840.113549.1.12.1.1"
   5190 #define szOID_PKCS_12_pbeWithSHA1And40BitRC4 "1.2.840.113549.1.12.1.2"
   5191 #define szOID_PKCS_12_pbeWithSHA1And3KeyTripleDES "1.2.840.113549.1.12.1.3"
   5192 #define szOID_PKCS_12_pbeWithSHA1And2KeyTripleDES "1.2.840.113549.1.12.1.4"
   5193 #define szOID_PKCS_12_pbeWithSHA1And128BitRC2 "1.2.840.113549.1.12.1.5"
   5194 #define szOID_PKCS_12_pbeWithSHA1And40BitRC2 "1.2.840.113549.1.12.1.6"
   5195 
   5196   typedef struct _CRYPT_PKCS12_PBE_PARAMS {
   5197     int iIterations;
   5198     ULONG cbSalt;
   5199   } CRYPT_PKCS12_PBE_PARAMS;
   5200 
   5201   WINIMPM HCERTSTORE WINAPI PFXImportCertStore (CRYPT_DATA_BLOB *pPFX, LPCWSTR szPassword, DWORD dwFlags);
   5202 
   5203 #define PKCS12_IMPORT_SILENT 0x40
   5204 #define CRYPT_USER_KEYSET 0x1000
   5205 #define PKCS12_PREFER_CNG_KSP 0x100
   5206 #define PKCS12_ALWAYS_CNG_KSP 0x200
   5207 #define PKCS12_ALLOW_OVERWRITE_KEY 0x4000
   5208 #define PKCS12_NO_PERSIST_KEY 0x8000
   5209 #define PKCS12_IMPORT_RESERVED_MASK 0xffff0000
   5210 
   5211 #define PKCS12_OBJECT_LOCATOR_ALL_IMPORT_FLAGS (PKCS12_ALWAYS_CNG_KSP | PKCS12_NO_PERSIST_KEY | PKCS12_IMPORT_SILENT | PKCS12_INCLUDE_EXTENDED_PROPERTIES)
   5212 
   5213   WINIMPM WINBOOL WINAPI PFXIsPFXBlob (CRYPT_DATA_BLOB *pPFX);
   5214   WINIMPM WINBOOL WINAPI PFXVerifyPassword (CRYPT_DATA_BLOB *pPFX, LPCWSTR szPassword, DWORD dwFlags);
   5215   WINIMPM WINBOOL WINAPI PFXExportCertStoreEx (HCERTSTORE hStore, CRYPT_DATA_BLOB *pPFX, LPCWSTR szPassword, void *pvPara, DWORD dwFlags);
   5216 
   5217 #define REPORT_NO_PRIVATE_KEY 0x1
   5218 #define REPORT_NOT_ABLE_TO_EXPORT_PRIVATE_KEY 0x2
   5219 #define EXPORT_PRIVATE_KEYS 0x4
   5220 #define PKCS12_INCLUDE_EXTENDED_PROPERTIES 0x10
   5221 #define PKCS12_PROTECT_TO_DOMAIN_SIDS 0x20
   5222 #define PKCS12_EXPORT_SILENT 0x40
   5223 #define PKCS12_EXPORT_RESERVED_MASK 0xffff0000
   5224 
   5225   WINIMPM WINBOOL WINAPI PFXExportCertStore (HCERTSTORE hStore, CRYPT_DATA_BLOB *pPFX, LPCWSTR szPassword, DWORD dwFlags);
   5226 
   5227 #if NTDDI_VERSION >= 0x06000000
   5228   typedef VOID *HCERT_SERVER_OCSP_RESPONSE;
   5229 
   5230   WINIMPM HCERT_SERVER_OCSP_RESPONSE WINAPI CertOpenServerOcspResponse (PCCERT_CHAIN_CONTEXT pChainContext, DWORD dwFlags, LPVOID pvReserved);
   5231 
   5232 #define CERT_SERVER_OCSP_RESPONSE_ASYNC_FLAG 0x1
   5233 
   5234   WINIMPM VOID WINAPI CertAddRefServerOcspResponse (HCERT_SERVER_OCSP_RESPONSE hServerOcspResponse);
   5235   WINIMPM VOID WINAPI CertCloseServerOcspResponse (HCERT_SERVER_OCSP_RESPONSE hServerOcspResponse, DWORD dwFlags);
   5236 
   5237   typedef struct _CERT_SERVER_OCSP_RESPONSE_CONTEXT CERT_SERVER_OCSP_RESPONSE_CONTEXT,*PCERT_SERVER_OCSP_RESPONSE_CONTEXT;
   5238   typedef const CERT_SERVER_OCSP_RESPONSE_CONTEXT *PCCERT_SERVER_OCSP_RESPONSE_CONTEXT;
   5239 
   5240   struct _CERT_SERVER_OCSP_RESPONSE_CONTEXT {
   5241     DWORD cbSize;
   5242     BYTE *pbEncodedOcspResponse;
   5243     DWORD cbEncodedOcspResponse;
   5244   };
   5245 
   5246   WINIMPM PCCERT_SERVER_OCSP_RESPONSE_CONTEXT WINAPI CertGetServerOcspResponseContext (HCERT_SERVER_OCSP_RESPONSE hServerOcspResponse, DWORD dwFlags, LPVOID pvReserved);
   5247   WINIMPM VOID WINAPI CertAddRefServerOcspResponseContext (PCCERT_SERVER_OCSP_RESPONSE_CONTEXT pServerOcspResponseContext);
   5248   WINIMPM VOID WINAPI CertFreeServerOcspResponseContext (PCCERT_SERVER_OCSP_RESPONSE_CONTEXT pServerOcspResponseContext);
   5249 #endif
   5250   WINIMPM WINBOOL WINAPI CertRetrieveLogoOrBiometricInfo (PCCERT_CONTEXT pCertContext, LPCSTR lpszLogoOrBiometricType, DWORD dwRetrievalFlags, DWORD dwTimeout, DWORD dwFlags, void *pvReserved, BYTE **ppbData, DWORD *pcbData, LPWSTR *ppwszMimeType);
   5251 
   5252 #define CERT_RETRIEVE_ISSUER_LOGO ((LPCSTR) 1)
   5253 #define CERT_RETRIEVE_SUBJECT_LOGO ((LPCSTR) 2)
   5254 #define CERT_RETRIEVE_COMMUNITY_LOGO ((LPCSTR) 3)
   5255 
   5256 #define CERT_RETRIEVE_BIOMETRIC_PREDEFINED_BASE_TYPE ((LPCSTR) 1000)
   5257 
   5258 #define CERT_RETRIEVE_BIOMETRIC_PICTURE_TYPE (CERT_RETRIEVE_BIOMETRIC_PREDEFINED_BASE_TYPE + CERT_BIOMETRIC_PICTURE_TYPE)
   5259 #define CERT_RETRIEVE_BIOMETRIC_SIGNATURE_TYPE (CERT_RETRIEVE_BIOMETRIC_PREDEFINED_BASE_TYPE + CERT_BIOMETRIC_SIGNATURE_TYPE)
   5260 
   5261 #if NTDDI_VERSION >= 0x06010000
   5262   typedef struct _CERT_SELECT_CHAIN_PARA {
   5263     HCERTCHAINENGINE hChainEngine;
   5264     PFILETIME pTime;
   5265     HCERTSTORE hAdditionalStore;
   5266     PCERT_CHAIN_PARA pChainPara;
   5267     DWORD dwFlags;
   5268   } CERT_SELECT_CHAIN_PARA,*PCERT_SELECT_CHAIN_PARA;
   5269 
   5270   typedef const CERT_SELECT_CHAIN_PARA *PCCERT_SELECT_CHAIN_PARA;
   5271 
   5272 #define CERT_SELECT_MAX_PARA 500
   5273 
   5274   typedef struct _CERT_SELECT_CRITERIA {
   5275     DWORD dwType;
   5276     DWORD cPara;
   5277     void **ppPara;
   5278   } CERT_SELECT_CRITERIA,*PCERT_SELECT_CRITERIA;
   5279 
   5280   typedef const CERT_SELECT_CRITERIA *PCCERT_SELECT_CRITERIA;
   5281 
   5282 #define CERT_SELECT_BY_ENHKEY_USAGE 1
   5283 #define CERT_SELECT_BY_KEY_USAGE 2
   5284 #define CERT_SELECT_BY_POLICY_OID 3
   5285 #define CERT_SELECT_BY_PROV_NAME 4
   5286 #define CERT_SELECT_BY_EXTENSION 5
   5287 #define CERT_SELECT_BY_SUBJECT_HOST_NAME 6
   5288 #define CERT_SELECT_BY_ISSUER_ATTR 7
   5289 #define CERT_SELECT_BY_SUBJECT_ATTR 8
   5290 #define CERT_SELECT_BY_ISSUER_NAME 9
   5291 #define CERT_SELECT_BY_PUBLIC_KEY 10
   5292 #define CERT_SELECT_BY_TLS_SIGNATURES 11
   5293 
   5294 #define CERT_SELECT_LAST CERT_SELECT_BY_TLS_SIGNATURES
   5295 #define CERT_SELECT_MAX (CERT_SELECT_LAST *3)
   5296 
   5297 #define CERT_SELECT_ALLOW_EXPIRED 0x1
   5298 #define CERT_SELECT_TRUSTED_ROOT 0x2
   5299 #define CERT_SELECT_DISALLOW_SELFSIGNED 0x4
   5300 #define CERT_SELECT_HAS_PRIVATE_KEY 0x8
   5301 #define CERT_SELECT_HAS_KEY_FOR_SIGNATURE 0x10
   5302 #define CERT_SELECT_HAS_KEY_FOR_KEY_EXCHANGE 0x20
   5303 #define CERT_SELECT_HARDWARE_ONLY 0x40
   5304 #define CERT_SELECT_ALLOW_DUPLICATES 0x80
   5305 
   5306   WINIMPM WINBOOL WINAPI CertSelectCertificateChains (LPCGUID pSelectionContext, DWORD dwFlags, PCCERT_SELECT_CHAIN_PARA pChainParameters, DWORD cCriteria, PCCERT_SELECT_CRITERIA rgpCriteria, HCERTSTORE hStore, PDWORD pcSelection, PCCERT_CHAIN_CONTEXT **pprgpSelection);
   5307   WINIMPM VOID WINAPI CertFreeCertificateChainList (PCCERT_CHAIN_CONTEXT *prgpSelection);
   5308 #endif
   5309 
   5310 #if NTDDI_VERSION >= 0x06010000
   5311 #define TIMESTAMP_VERSION 1
   5312 
   5313   typedef struct _CRYPT_TIMESTAMP_REQUEST {
   5314     DWORD dwVersion;
   5315     CRYPT_ALGORITHM_IDENTIFIER HashAlgorithm;
   5316     CRYPT_DER_BLOB HashedMessage;
   5317     LPSTR pszTSAPolicyId;
   5318     CRYPT_INTEGER_BLOB Nonce;
   5319     WINBOOL fCertReq;
   5320     DWORD cExtension;
   5321     PCERT_EXTENSION rgExtension;
   5322   } CRYPT_TIMESTAMP_REQUEST,*PCRYPT_TIMESTAMP_REQUEST;
   5323 
   5324   typedef struct _CRYPT_TIMESTAMP_RESPONSE {
   5325     DWORD dwStatus;
   5326     DWORD cFreeText;
   5327     LPWSTR *rgFreeText;
   5328     CRYPT_BIT_BLOB FailureInfo;
   5329     CRYPT_DER_BLOB ContentInfo;
   5330   } CRYPT_TIMESTAMP_RESPONSE,*PCRYPT_TIMESTAMP_RESPONSE;
   5331 
   5332 #define TIMESTAMP_STATUS_GRANTED 0
   5333 #define TIMESTAMP_STATUS_GRANTED_WITH_MODS 1
   5334 #define TIMESTAMP_STATUS_REJECTED 2
   5335 #define TIMESTAMP_STATUS_WAITING 3
   5336 #define TIMESTAMP_STATUS_REVOCATION_WARNING 4
   5337 #define TIMESTAMP_STATUS_REVOKED 5
   5338 
   5339 #define TIMESTAMP_FAILURE_BAD_ALG 0
   5340 #define TIMESTAMP_FAILURE_BAD_REQUEST 2
   5341 #define TIMESTAMP_FAILURE_BAD_FORMAT 5
   5342 #define TIMESTAMP_FAILURE_TIME_NOT_AVAILABLE 14
   5343 #define TIMESTAMP_FAILURE_POLICY_NOT_SUPPORTED 15
   5344 #define TIMESTAMP_FAILURE_EXTENSION_NOT_SUPPORTED 16
   5345 #define TIMESTAMP_FAILURE_INFO_NOT_AVAILABLE 17
   5346 #define TIMESTAMP_FAILURE_SYSTEM_FAILURE 25
   5347 
   5348   typedef struct _CRYPT_TIMESTAMP_ACCURACY {
   5349     DWORD dwSeconds;
   5350     DWORD dwMillis;
   5351     DWORD dwMicros;
   5352   } CRYPT_TIMESTAMP_ACCURACY,*PCRYPT_TIMESTAMP_ACCURACY;
   5353 
   5354   typedef struct _CRYPT_TIMESTAMP_INFO {
   5355     DWORD dwVersion;
   5356     LPSTR pszTSAPolicyId;
   5357     CRYPT_ALGORITHM_IDENTIFIER HashAlgorithm;
   5358     CRYPT_DER_BLOB HashedMessage;
   5359     CRYPT_INTEGER_BLOB SerialNumber;
   5360     FILETIME ftTime;
   5361     PCRYPT_TIMESTAMP_ACCURACY pvAccuracy;
   5362     WINBOOL fOrdering;
   5363     CRYPT_DER_BLOB Nonce;
   5364     CRYPT_DER_BLOB Tsa;
   5365     DWORD cExtension;
   5366     PCERT_EXTENSION rgExtension;
   5367   } CRYPT_TIMESTAMP_INFO,*PCRYPT_TIMESTAMP_INFO;
   5368 
   5369   typedef struct _CRYPT_TIMESTAMP_CONTEXT {
   5370     DWORD cbEncoded;
   5371     BYTE *pbEncoded;
   5372     PCRYPT_TIMESTAMP_INFO pTimeStamp;
   5373   } CRYPT_TIMESTAMP_CONTEXT,*PCRYPT_TIMESTAMP_CONTEXT;
   5374 
   5375   typedef struct _CRYPT_TIMESTAMP_PARA {
   5376     LPCSTR pszTSAPolicyId;
   5377     WINBOOL fRequestCerts;
   5378     CRYPT_INTEGER_BLOB Nonce;
   5379     DWORD cExtension;
   5380     PCERT_EXTENSION rgExtension;
   5381   } CRYPT_TIMESTAMP_PARA,*PCRYPT_TIMESTAMP_PARA;
   5382 
   5383   WINBOOL WINAPI CryptRetrieveTimeStamp (LPCWSTR wszUrl, DWORD dwRetrievalFlags, DWORD dwTimeout, LPCSTR pszHashId, const CRYPT_TIMESTAMP_PARA *pPara, const BYTE *pbData, DWORD cbData, PCRYPT_TIMESTAMP_CONTEXT *ppTsContext, PCCERT_CONTEXT *ppTsSigner, HCERTSTORE *phStore);
   5384 
   5385 #define TIMESTAMP_DONT_HASH_DATA 0x1
   5386 #define TIMESTAMP_VERIFY_CONTEXT_SIGNATURE 0x20
   5387 #define TIMESTAMP_NO_AUTH_RETRIEVAL 0x20000
   5388 
   5389   WINBOOL WINAPI CryptVerifyTimeStampSignature (const BYTE *pbTSContentInfo, DWORD cbTSContentInfo, const BYTE *pbData, DWORD cbData, HCERTSTORE hAdditionalStore, PCRYPT_TIMESTAMP_CONTEXT *ppTsContext, PCCERT_CONTEXT *ppTsSigner, HCERTSTORE *phStore);
   5390 #endif
   5391 
   5392 #if NTDDI_VERSION >= 0x06020000
   5393 #define CRYPT_OBJECT_LOCATOR_SPN_NAME_TYPE 1
   5394 #define CRYPT_OBJECT_LOCATOR_LAST_RESERVED_NAME_TYPE 32
   5395 #define CRYPT_OBJECT_LOCATOR_FIRST_RESERVED_USER_NAME_TYPE 33
   5396 #define CRYPT_OBJECT_LOCATOR_LAST_RESERVED_USER_NAME_TYPE 0x0000ffff
   5397 
   5398 #define SSL_OBJECT_LOCATOR_PFX_FUNC "SslObjectLocatorInitializePfx"
   5399 #define SSL_OBJECT_LOCATOR_ISSUER_LIST_FUNC "SslObjectLocatorInitializeIssuerList"
   5400 #define SSL_OBJECT_LOCATOR_CERT_VALIDATION_CONFIG_FUNC "SslObjectLocatorInitializeCertValidationConfig"
   5401 
   5402 #define CRYPT_OBJECT_LOCATOR_RELEASE_SYSTEM_SHUTDOWN 1
   5403 #define CRYPT_OBJECT_LOCATOR_RELEASE_SERVICE_STOP 2
   5404 #define CRYPT_OBJECT_LOCATOR_RELEASE_PROCESS_EXIT 3
   5405 #define CRYPT_OBJECT_LOCATOR_RELEASE_DLL_UNLOAD 4
   5406 
   5407   typedef WINBOOL (WINAPI *PFN_CRYPT_OBJECT_LOCATOR_PROVIDER_FLUSH) (LPVOID pContext, PCERT_NAME_BLOB *rgIdentifierOrNameList, DWORD dwIdentifierOrNameListCount);
   5408   typedef WINBOOL (WINAPI *PFN_CRYPT_OBJECT_LOCATOR_PROVIDER_GET) (LPVOID pPluginContext, PCRYPT_DATA_BLOB pIdentifier, DWORD dwNameType, PCERT_NAME_BLOB pNameBlob, PBYTE *ppbContent, DWORD *pcbContent, PCWSTR *ppwszPassword, PCRYPT_DATA_BLOB *ppIdentifier);
   5409   typedef void (WINAPI *PFN_CRYPT_OBJECT_LOCATOR_PROVIDER_RELEASE) (DWORD dwReason, LPVOID pPluginContext);
   5410   typedef void (WINAPI *PFN_CRYPT_OBJECT_LOCATOR_PROVIDER_FREE_PASSWORD) (LPVOID pPluginContext, PCWSTR pwszPassword);
   5411   typedef void (WINAPI *PFN_CRYPT_OBJECT_LOCATOR_PROVIDER_FREE) (LPVOID pPluginContext, PBYTE pbData);
   5412   typedef void (WINAPI *PFN_CRYPT_OBJECT_LOCATOR_PROVIDER_FREE_IDENTIFIER) (LPVOID pPluginContext, PCRYPT_DATA_BLOB pIdentifier);
   5413 
   5414   typedef struct _CRYPT_OBJECT_LOCATOR_PROVIDER_TABLE {
   5415     DWORD cbSize;
   5416     PFN_CRYPT_OBJECT_LOCATOR_PROVIDER_GET pfnGet;
   5417     PFN_CRYPT_OBJECT_LOCATOR_PROVIDER_RELEASE pfnRelease;
   5418     PFN_CRYPT_OBJECT_LOCATOR_PROVIDER_FREE_PASSWORD pfnFreePassword;
   5419     PFN_CRYPT_OBJECT_LOCATOR_PROVIDER_FREE pfnFree;
   5420     PFN_CRYPT_OBJECT_LOCATOR_PROVIDER_FREE_IDENTIFIER pfnFreeIdentifier;
   5421   } CRYPT_OBJECT_LOCATOR_PROVIDER_TABLE,*PCRYPT_OBJECT_LOCATOR_PROVIDER_TABLE;
   5422 
   5423   typedef WINBOOL (WINAPI *PFN_CRYPT_OBJECT_LOCATOR_PROVIDER_INITIALIZE) (PFN_CRYPT_OBJECT_LOCATOR_PROVIDER_FLUSH pfnFlush, LPVOID pContext, DWORD *pdwExpectedObjectCount, PCRYPT_OBJECT_LOCATOR_PROVIDER_TABLE *ppFuncTable, void **ppPluginContext);
   5424 #endif
   5425 #endif
   5426 
   5427 #endif
   5428 
   5429 #ifdef __cplusplus
   5430 }
   5431 #endif
   5432 
   5433 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
   5434 #ifndef _WINCRYPT_NO_DPAPI
   5435 #include <dpapi.h>
   5436 #endif
   5437 #endif
   5438 #endif
   5439