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