Differences From Artifact [01dc6f0e64f6c54b]:
- File
src/win32/wincrypt.d
- 2015-04-21 10:46:55 - part of checkin [4e2933c620] on branch trunk - Rebased to the latest verson dmd 2.067. Not yet verified the outcome. (user: kinaba) [annotate]
To Artifact [56b59d671f703037]:
- File
src/win32/wincrypt.d
-
2015-05-05 06:49:05
- part of checkin
[9b639cf2d6]
on branch trunk
- Working version for update to 2.067.
The problem was __gshared. Replacing it with TLS fixed the issue. Remaining problem is that "hack.d"'s CloseHandle hack is not working anymore.
(user: kinaba) [annotate]
-
2015-05-05 06:49:05
- part of checkin
[9b639cf2d6]
on branch trunk
- Working version for update to 2.067.
29 29 MS_DEF_DSS_DH_PROV
30 30 = "Microsoft Base DSS and Diffie-Hellman Cryptographic Provider",
31 31 MS_ENH_DSS_DH_PROV
32 32 = "Microsoft Enhanced DSS and Diffie-Hellman Cryptographic Provider",
33 33 MS_DEF_DH_SCHANNEL_PROV = "Microsoft DH SChannel Cryptographic Provider",
34 34 MS_SCARD_PROV = "Microsoft Base Smart Card Crypto Provider";
35 35
36 -static if (WINVER > 0x501) {
36 +static if (_WIN32_WINNT > 0x501) {
37 37 const TCHAR[] MS_ENH_RSA_AES_PROV
38 38 = "Microsoft Enhanced RSA and AES Cryptographic Provider";
39 -} else static if (WINVER == 0x501) {
39 +} else static if (_WIN32_WINNT == 0x501) {
40 40 const TCHAR[] MS_ENH_RSA_AES_PROV
41 41 = "Microsoft Enhanced RSA and AES Cryptographic Provider (Prototype)";
42 42 }
43 43
44 44 ALG_ID GET_ALG_CLASS(ALG_ID x) { return x & 0xE000; }
45 45 ALG_ID GET_ALG_TYPE (ALG_ID x) { return x & 0x1E00; }
46 46 ALG_ID GET_ALG_SID (ALG_ID x) { return x & 0x01FF; }
................................................................................
132 132 CALG_TLS1PRF = ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_TLS1PRF,
133 133 CALG_AES_128 = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_AES_128,
134 134 CALG_AES_192 = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_AES_192,
135 135 CALG_AES_256 = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_AES_256,
136 136 CALG_AES = ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_AES,
137 137 }
138 138
139 -/+
140 -#define CRYPT_VERIFYCONTEXT 0xF0000000
141 -#define CRYPT_NEWKEYSET 8
142 -#define CRYPT_DELETEKEYSET 16
143 -#define CRYPT_MACHINE_KEYSET 32
144 -#define CRYPT_SILENT 64
145 -#define CRYPT_EXPORTABLE 1
146 -#define CRYPT_USER_PROTECTED 2
147 -#define CRYPT_CREATE_SALT 4
148 -#define CRYPT_UPDATE_KEY 8
149 -#define SIMPLEBLOB 1
150 -#define PUBLICKEYBLOB 6
151 -#define PRIVATEKEYBLOB 7
152 -#define PLAINTEXTKEYBLOB 8
153 -#define OPAQUEKEYBLOB 9
154 -#define PUBLICKEYBLOBEX 10
155 -#define SYMMETRICWRAPKEYBLOB 11
156 -#define AT_KEYEXCHANGE 1
157 -#define AT_SIGNATURE 2
158 -#define CRYPT_USERDATA 1
159 -#define PKCS5_PADDING 1
160 -#define CRYPT_MODE_CBC 1
161 -#define CRYPT_MODE_ECB 2
162 -#define CRYPT_MODE_OFB 3
163 -#define CRYPT_MODE_CFB 4
164 -#define CRYPT_MODE_CTS 5
165 -#define CRYPT_MODE_CBCI 6
166 -#define CRYPT_MODE_CFBP 7
167 -#define CRYPT_MODE_OFBP 8
168 -#define CRYPT_MODE_CBCOFM 9
169 -#define CRYPT_MODE_CBCOFMI 10
170 -#define CRYPT_ENCRYPT 1
171 -#define CRYPT_DECRYPT 2
172 -#define CRYPT_EXPORT 4
173 -#define CRYPT_READ 8
174 -#define CRYPT_WRITE 16
175 -#define CRYPT_MAC 32
176 -#define HP_ALGID 1
177 -#define HP_HASHVAL 2
178 -#define HP_HASHSIZE 4
179 -#define HP_HMAC_INFO 5
180 -#define CRYPT_FAILED FALSE
181 -#define CRYPT_SUCCEED TRUE
182 -#define RCRYPT_SUCCEEDED(r) ((r)==CRYPT_SUCCEED)
183 -#define RCRYPT_FAILED(r) ((r)==CRYPT_FAILED)
184 -#define PP_ENUMALGS 1
185 -#define PP_ENUMCONTAINERS 2
186 -#define PP_IMPTYPE 3
187 -#define PP_NAME 4
188 -#define PP_VERSION 5
189 -#define PP_CONTAINER 6
190 -#define PP_CHANGE_PASSWORD 7
191 -#define PP_KEYSET_SEC_DESCR 8
192 -#define PP_CERTCHAIN 9
193 -#define PP_KEY_TYPE_SUBTYPE 10
194 -#define PP_PROVTYPE 16
195 -#define PP_KEYSTORAGE 17
196 -#define PP_APPLI_CERT 18
197 -#define PP_SYM_KEYSIZE 19
198 -#define PP_SESSION_KEYSIZE 20
199 -#define PP_UI_PROMPT 21
200 -#define PP_ENUMALGS_EX 22
201 -#define PP_ENUMMANDROOTS 25
202 -#define PP_ENUMELECTROOTS 26
203 -#define PP_KEYSET_TYPE 27
204 -#define PP_ADMIN_PIN 31
205 -#define PP_KEYEXCHANGE_PIN 32
206 -#define PP_SIGNATURE_PIN 33
207 -#define PP_SIG_KEYSIZE_INC 34
208 -#define PP_KEYX_KEYSIZE_INC 35
209 -#define PP_UNIQUE_CONTAINER 36
210 -#define PP_SGC_INFO 37
211 -#define PP_USE_HARDWARE_RNG 38
212 -#define PP_KEYSPEC 39
213 -#define PP_ENUMEX_SIGNING_PROT 40
214 -#define CRYPT_FIRST 1
215 -#define CRYPT_NEXT 2
216 -#define CRYPT_IMPL_HARDWARE 1
217 -#define CRYPT_IMPL_SOFTWARE 2
218 -#define CRYPT_IMPL_MIXED 3
219 -#define CRYPT_IMPL_UNKNOWN 4
220 -#define PROV_RSA_FULL 1
221 -#define PROV_RSA_SIG 2
222 -#define PROV_DSS 3
223 -#define PROV_FORTEZZA 4
224 -#define PROV_MS_MAIL 5
225 -#define PROV_SSL 6
226 -#define PROV_STT_MER 7
227 -#define PROV_STT_ACQ 8
228 -#define PROV_STT_BRND 9
229 -#define PROV_STT_ROOT 10
230 -#define PROV_STT_ISS 11
231 -#define PROV_RSA_SCHANNEL 12
232 -#define PROV_DSS_DH 13
233 -#define PROV_EC_ECDSA_SIG 14
234 -#define PROV_EC_ECNRA_SIG 15
235 -#define PROV_EC_ECDSA_FULL 16
236 -#define PROV_EC_ECNRA_FULL 17
237 -#define PROV_DH_SCHANNEL 18
238 -#define PROV_SPYRUS_LYNKS 20
239 -#define PROV_RNG 21
240 -#define PROV_INTEL_SEC 22
241 -#define PROV_RSA_AES 24
242 -#define MAXUIDLEN 64
243 -#define CUR_BLOB_VERSION 2
244 -#define X509_ASN_ENCODING 1
245 -#define PKCS_7_ASN_ENCODING 65536
246 -#define CERT_V1 0
247 -#define CERT_V2 1
248 -#define CERT_V3 2
249 -#define CERT_E_CHAINING (-2146762486)
250 -#define CERT_E_CN_NO_MATCH (-2146762481)
251 -#define CERT_E_EXPIRED (-2146762495)
252 -#define CERT_E_PURPOSE (-2146762490)
253 -#define CERT_E_REVOCATION_FAILURE (-2146762482)
254 -#define CERT_E_REVOKED (-2146762484)
255 -#define CERT_E_ROLE (-2146762493)
256 -#define CERT_E_UNTRUSTEDROOT (-2146762487)
257 -#define CERT_E_UNTRUSTEDTESTROOT (-2146762483)
258 -#define CERT_E_VALIDITYPERIODNESTING (-2146762494)
259 -#define CERT_E_WRONG_USAGE (-2146762480)
260 -#define CERT_E_PATHLENCONST (-2146762492)
261 -#define CERT_E_CRITICAL (-2146762491)
262 -#define CERT_E_ISSUERCHAINING (-2146762489)
263 -#define CERT_E_MALFORMED (-2146762488)
264 -#define CRYPT_E_REVOCATION_OFFLINE (-2146885613)
265 -#define CRYPT_E_REVOKED (-2146885616)
266 -#define TRUST_E_BASIC_CONSTRAINTS (-2146869223)
267 -#define TRUST_E_CERT_SIGNATURE (-2146869244)
268 -#define TRUST_E_FAIL (-2146762485)
269 -#define CERT_TRUST_NO_ERROR 0
270 -#define CERT_TRUST_IS_NOT_TIME_VALID 1
271 -#define CERT_TRUST_IS_NOT_TIME_NESTED 2
272 -#define CERT_TRUST_IS_REVOKED 4
273 -#define CERT_TRUST_IS_NOT_SIGNATURE_VALID 8
274 -#define CERT_TRUST_IS_NOT_VALID_FOR_USAGE 16
275 -#define CERT_TRUST_IS_UNTRUSTED_ROOT 32
276 -#define CERT_TRUST_REVOCATION_STATUS_UNKNOWN 64
277 -#define CERT_TRUST_IS_CYCLIC 128
278 -#define CERT_TRUST_IS_PARTIAL_CHAIN 65536
279 -#define CERT_TRUST_CTL_IS_NOT_TIME_VALID 131072
280 -#define CERT_TRUST_CTL_IS_NOT_SIGNATURE_VALID 262144
281 -#define CERT_TRUST_CTL_IS_NOT_VALID_FOR_USAGE 524288
282 -#define CERT_TRUST_HAS_EXACT_MATCH_ISSUER 1
283 -#define CERT_TRUST_HAS_KEY_MATCH_ISSUER 2
284 -#define CERT_TRUST_HAS_NAME_MATCH_ISSUER 4
285 -#define CERT_TRUST_IS_SELF_SIGNED 8
286 -#define CERT_TRUST_IS_COMPLEX_CHAIN 65536
287 -#define CERT_CHAIN_POLICY_BASE ((LPCSTR) 1)
288 -#define CERT_CHAIN_POLICY_AUTHENTICODE ((LPCSTR) 2)
289 -#define CERT_CHAIN_POLICY_AUTHENTICODE_TS ((LPCSTR) 3)
290 -#define CERT_CHAIN_POLICY_SSL ((LPCSTR) 4)
291 -#define CERT_CHAIN_POLICY_BASIC_CONSTRAINTS ((LPCSTR) 5)
292 -#define CERT_CHAIN_POLICY_NT_AUTH ((LPCSTR) 6)
293 -#define USAGE_MATCH_TYPE_AND 0
294 -#define USAGE_MATCH_TYPE_OR 1
295 -#define CERT_SIMPLE_NAME_STR 1
296 -#define CERT_OID_NAME_STR 2
297 -#define CERT_X500_NAME_STR 3
298 -#define CERT_NAME_STR_SEMICOLON_FLAG 1073741824
299 -#define CERT_NAME_STR_CRLF_FLAG 134217728
300 -#define CERT_NAME_STR_NO_PLUS_FLAG 536870912
301 -#define CERT_NAME_STR_NO_QUOTING_FLAG 268435456
302 -#define CERT_NAME_STR_REVERSE_FLAG 33554432
303 -#define CERT_NAME_STR_ENABLE_T61_UNICODE_FLAG 131072
304 -#define CERT_FIND_ANY 0
305 -#define CERT_FIND_CERT_ID 1048576
306 -#define CERT_FIND_CTL_USAGE 655360
307 -#define CERT_FIND_ENHKEY_USAGE 655360
308 -#define CERT_FIND_EXISTING 851968
309 -#define CERT_FIND_HASH 65536
310 -#define CERT_FIND_ISSUER_ATTR 196612
311 -#define CERT_FIND_ISSUER_NAME 131076
312 -#define CERT_FIND_ISSUER_OF 786432
313 -#define CERT_FIND_KEY_IDENTIFIER 983040
314 -#define CERT_FIND_KEY_SPEC 589824
315 -#define CERT_FIND_MD5_HASH 262144
316 -#define CERT_FIND_PROPERTY 327680
317 -#define CERT_FIND_PUBLIC_KEY 393216
318 -#define CERT_FIND_SHA1_HASH 65536
319 -#define CERT_FIND_SIGNATURE_HASH 917504
320 -#define CERT_FIND_SUBJECT_ATTR 196615
321 -#define CERT_FIND_SUBJECT_CERT 720896
322 -#define CERT_FIND_SUBJECT_NAME 131079
323 -#define CERT_FIND_SUBJECT_STR_A 458759
324 -#define CERT_FIND_SUBJECT_STR_W 524295
325 -#define CERT_FIND_ISSUER_STR_A 458756
326 -#define CERT_FIND_ISSUER_STR_W 524292
327 -#define CERT_FIND_OR_ENHKEY_USAGE_FLAG 16
328 -#define CERT_FIND_OPTIONAL_ENHKEY_USAGE_FLAG 1
329 -#define CERT_FIND_NO_ENHKEY_USAGE_FLAG 8
330 -#define CERT_FIND_VALID_ENHKEY_USAGE_FLAG 32
331 -#define CERT_FIND_EXT_ONLY_ENHKEY_USAGE_FLAG 2
332 -#define CERT_CASE_INSENSITIVE_IS_RDN_ATTRS_FLAG 2
333 -#define CERT_UNICODE_IS_RDN_ATTRS_FLAG 1
334 -#define CERT_CHAIN_FIND_BY_ISSUER 1
335 -#define CERT_CHAIN_FIND_BY_ISSUER_COMPARE_KEY_FLAG 1
336 -#define CERT_CHAIN_FIND_BY_ISSUER_COMPLEX_CHAIN_FLAG 2
337 -#define CERT_CHAIN_FIND_BY_ISSUER_CACHE_ONLY_FLAG 32768
338 -#define CERT_CHAIN_FIND_BY_ISSUER_CACHE_ONLY_URL_FLAG 4
339 -#define CERT_CHAIN_FIND_BY_ISSUER_LOCAL_MACHINE_FLAG 8
340 -#define CERT_CHAIN_FIND_BY_ISSUER_NO_KEY_FLAG 16384
341 -#define CERT_STORE_PROV_SYSTEM 10
342 -#define CERT_SYSTEM_STORE_LOCAL_MACHINE 131072
343 -#define szOID_PKIX_KP_SERVER_AUTH "4235600"
344 -#define szOID_SERVER_GATED_CRYPTO "4235658"
345 -#define szOID_SGC_NETSCAPE "2.16.840.1.113730.4.1"
346 -#define szOID_PKIX_KP_CLIENT_AUTH "1.3.6.1.5.5.7.3.2"
347 -#define CRYPT_NOHASHOID 0x00000001
348 -#define CRYPT_NO_SALT 0x10
349 -#define CRYPT_PREGEN 0x40
350 -#define CRYPT_RECIPIENT 0x10
351 -#define CRYPT_INITIATOR 0x40
352 -#define CRYPT_ONLINE 0x80
353 -#define CRYPT_SF 0x100
354 -#define CRYPT_CREATE_IV 0x200
355 -#define CRYPT_KEK 0x400
356 -#define CRYPT_DATA_KEY 0x800
357 -#define CRYPT_VOLATILE 0x1000
358 -#define CRYPT_SGCKEY 0x2000
359 -#define KP_IV 0x00000001
360 -#define KP_SALT 0x00000002
361 -#define KP_PADDING 0x00000003
362 -#define KP_MODE 0x00000004
363 -#define KP_MODE_BITS 0x00000005
364 -#define KP_PERMISSIONS 0x00000006
365 -#define KP_ALGID 0x00000007
366 -#define KP_BLOCKLEN 0x00000008
367 -#define KP_KEYLEN 0x00000009
368 -#define KP_SALT_EX 0x0000000a
369 -#define KP_P 0x0000000b
370 -#define KP_G 0x0000000c
371 -#define KP_Q 0x0000000d
372 -#define KP_X 0x0000000e
373 -#define KP_Y 0x0000000f
374 -#define KP_RA 0x00000010
375 -#define KP_RB 0x00000011
376 -#define KP_INFO 0x00000012
377 -#define KP_EFFECTIVE_KEYLEN 0x00000013
378 -#define KP_SCHANNEL_ALG 0x00000014
379 -#define KP_PUB_PARAMS 0x00000027
380 -#define CRYPT_FLAG_PCT1 0x0001
381 -#define CRYPT_FLAG_SSL2 0x0002
382 -#define CRYPT_FLAG_SSL3 0x0004
383 -#define CRYPT_FLAG_TLS1 0x0008
384 -#define CRYPT_FLAG_IPSEC 0x0010
385 -#define CRYPT_FLAG_SIGNING 0x0020
386 -#define SCHANNEL_MAC_KEY 0x00000000
387 -#define SCHANNEL_ENC_KEY 0x00000001
388 -#define INTERNATIONAL_USAGE 0x00000001
389 -+/
139 +enum {
140 + CRYPT_VERIFYCONTEXT = 0xF0000000,
141 +}
142 +
143 +enum {
144 + CRYPT_NEWKEYSET = 8,
145 + CRYPT_DELETEKEYSET = 16,
146 + CRYPT_MACHINE_KEYSET = 32,
147 + CRYPT_SILENT = 64,
148 +}
149 +
150 +enum {
151 + CRYPT_EXPORTABLE = 1,
152 + CRYPT_USER_PROTECTED = 2,
153 + CRYPT_CREATE_SALT = 4,
154 + CRYPT_UPDATE_KEY = 8,
155 +}
156 +
157 +enum {
158 + SIMPLEBLOB = 1,
159 + PUBLICKEYBLOB = 6,
160 + PRIVATEKEYBLOB = 7,
161 + PLAINTEXTKEYBLOB = 8,
162 + OPAQUEKEYBLOB = 9,
163 + PUBLICKEYBLOBEX = 10,
164 + SYMMETRICWRAPKEYBLOB = 11,
165 +}
166 +
167 +enum {
168 + AT_KEYEXCHANGE = 1,
169 + AT_SIGNATURE = 2,
170 +}
171 +
172 +enum {
173 + CRYPT_USERDATA = 1,
174 +}
175 +
176 +enum {
177 + PKCS5_PADDING = 1,
178 +}
179 +
180 +enum {
181 + CRYPT_MODE_CBC = 1,
182 + CRYPT_MODE_ECB = 2,
183 + CRYPT_MODE_OFB = 3,
184 + CRYPT_MODE_CFB = 4,
185 + CRYPT_MODE_CTS = 5,
186 + CRYPT_MODE_CBCI = 6,
187 + CRYPT_MODE_CFBP = 7,
188 + CRYPT_MODE_OFBP = 8,
189 + CRYPT_MODE_CBCOFM = 9,
190 + CRYPT_MODE_CBCOFMI = 10,
191 +}
192 +
193 +enum {
194 + CRYPT_ENCRYPT = 1,
195 + CRYPT_DECRYPT = 2,
196 + CRYPT_EXPORT = 4,
197 + CRYPT_READ = 8,
198 + CRYPT_WRITE = 16,
199 + CRYPT_MAC = 32,
200 +}
201 +
202 +enum {
203 + HP_ALGID = 1,
204 + HP_HASHVAL = 2,
205 + HP_HASHSIZE = 4,
206 + HP_HMAC_INFO = 5,
207 +}
208 +
209 +enum {
210 + CRYPT_FAILED = FALSE,
211 + CRYPT_SUCCEED = TRUE,
212 +}
213 +
214 +bool RCRYPT_SUCCEEDED(BOOL r) { return r==CRYPT_SUCCEED; }
215 +bool RCRYPT_FAILED(BOOL r) { return r==CRYPT_FAILED; }
216 +
217 +enum {
218 + PP_ENUMALGS = 1,
219 + PP_ENUMCONTAINERS = 2,
220 + PP_IMPTYPE = 3,
221 + PP_NAME = 4,
222 + PP_VERSION = 5,
223 + PP_CONTAINER = 6,
224 + PP_CHANGE_PASSWORD = 7,
225 + PP_KEYSET_SEC_DESCR = 8,
226 + PP_CERTCHAIN = 9,
227 + PP_KEY_TYPE_SUBTYPE = 10,
228 + PP_PROVTYPE = 16,
229 + PP_KEYSTORAGE = 17,
230 + PP_APPLI_CERT = 18,
231 + PP_SYM_KEYSIZE = 19,
232 + PP_SESSION_KEYSIZE = 20,
233 + PP_UI_PROMPT = 21,
234 + PP_ENUMALGS_EX = 22,
235 + PP_ENUMMANDROOTS = 25,
236 + PP_ENUMELECTROOTS = 26,
237 + PP_KEYSET_TYPE = 27,
238 + PP_ADMIN_PIN = 31,
239 + PP_KEYEXCHANGE_PIN = 32,
240 + PP_SIGNATURE_PIN = 33,
241 + PP_SIG_KEYSIZE_INC = 34,
242 + PP_KEYX_KEYSIZE_INC = 35,
243 + PP_UNIQUE_CONTAINER = 36,
244 + PP_SGC_INFO = 37,
245 + PP_USE_HARDWARE_RNG = 38,
246 + PP_KEYSPEC = 39,
247 + PP_ENUMEX_SIGNING_PROT = 40,
248 +}
249 +
250 +enum {
251 + CRYPT_FIRST = 1,
252 + CRYPT_NEXT = 2,
253 +}
254 +
255 +enum {
256 + CRYPT_IMPL_HARDWARE = 1,
257 + CRYPT_IMPL_SOFTWARE = 2,
258 + CRYPT_IMPL_MIXED = 3,
259 + CRYPT_IMPL_UNKNOWN = 4,
260 +}
261 +
262 +enum {
263 + PROV_RSA_FULL = 1,
264 + PROV_RSA_SIG = 2,
265 + PROV_DSS = 3,
266 + PROV_FORTEZZA = 4,
267 + PROV_MS_MAIL = 5,
268 + PROV_SSL = 6,
269 + PROV_STT_MER = 7,
270 + PROV_STT_ACQ = 8,
271 + PROV_STT_BRND = 9,
272 + PROV_STT_ROOT = 10,
273 + PROV_STT_ISS = 11,
274 + PROV_RSA_SCHANNEL = 12,
275 + PROV_DSS_DH = 13,
276 + PROV_EC_ECDSA_SIG = 14,
277 + PROV_EC_ECNRA_SIG = 15,
278 + PROV_EC_ECDSA_FULL = 16,
279 + PROV_EC_ECNRA_FULL = 17,
280 + PROV_DH_SCHANNEL = 18,
281 + PROV_SPYRUS_LYNKS = 20,
282 + PROV_RNG = 21,
283 + PROV_INTEL_SEC = 22,
284 + PROV_RSA_AES = 24,
285 + MAXUIDLEN = 64,
286 +}
287 +
288 +enum {
289 + CUR_BLOB_VERSION = 2,
290 +}
291 +
292 +enum {
293 + X509_ASN_ENCODING = 1,
294 + PKCS_7_ASN_ENCODING = 65536,
295 +}
296 +
297 +enum {
298 + CERT_V1 = 0,
299 + CERT_V2 = 1,
300 + CERT_V3 = 2,
301 +}
302 +
303 +enum {
304 + CERT_E_CHAINING = (-2146762486),
305 + CERT_E_CN_NO_MATCH = (-2146762481),
306 + CERT_E_EXPIRED = (-2146762495),
307 + CERT_E_PURPOSE = (-2146762490),
308 + CERT_E_REVOCATION_FAILURE = (-2146762482),
309 + CERT_E_REVOKED = (-2146762484),
310 + CERT_E_ROLE = (-2146762493),
311 + CERT_E_UNTRUSTEDROOT = (-2146762487),
312 + CERT_E_UNTRUSTEDTESTROOT = (-2146762483),
313 + CERT_E_VALIDITYPERIODNESTING = (-2146762494),
314 + CERT_E_WRONG_USAGE = (-2146762480),
315 + CERT_E_PATHLENCONST = (-2146762492),
316 + CERT_E_CRITICAL = (-2146762491),
317 + CERT_E_ISSUERCHAINING = (-2146762489),
318 + CERT_E_MALFORMED = (-2146762488),
319 + CRYPT_E_REVOCATION_OFFLINE = (-2146885613),
320 + CRYPT_E_REVOKED = (-2146885616),
321 + TRUST_E_BASIC_CONSTRAINTS = (-2146869223),
322 + TRUST_E_CERT_SIGNATURE = (-2146869244),
323 + TRUST_E_FAIL = (-2146762485),
324 +}
325 +
326 +enum {
327 + CERT_TRUST_NO_ERROR = 0,
328 + CERT_TRUST_IS_NOT_TIME_VALID = 1,
329 + CERT_TRUST_IS_NOT_TIME_NESTED = 2,
330 + CERT_TRUST_IS_REVOKED = 4,
331 + CERT_TRUST_IS_NOT_SIGNATURE_VALID = 8,
332 + CERT_TRUST_IS_NOT_VALID_FOR_USAGE = 16,
333 + CERT_TRUST_IS_UNTRUSTED_ROOT = 32,
334 + CERT_TRUST_REVOCATION_STATUS_UNKNOWN = 64,
335 + CERT_TRUST_IS_CYCLIC = 128,
336 + CERT_TRUST_IS_PARTIAL_CHAIN = 65536,
337 + CERT_TRUST_CTL_IS_NOT_TIME_VALID = 131072,
338 + CERT_TRUST_CTL_IS_NOT_SIGNATURE_VALID = 262144,
339 + CERT_TRUST_CTL_IS_NOT_VALID_FOR_USAGE = 524288,
340 +}
341 +
342 +enum {
343 + CERT_TRUST_HAS_EXACT_MATCH_ISSUER = 1,
344 + CERT_TRUST_HAS_KEY_MATCH_ISSUER = 2,
345 + CERT_TRUST_HAS_NAME_MATCH_ISSUER = 4,
346 + CERT_TRUST_IS_SELF_SIGNED = 8,
347 + CERT_TRUST_IS_COMPLEX_CHAIN = 65536,
348 +}
349 +
350 +enum {
351 + CERT_CHAIN_POLICY_BASE = cast(LPCSTR) 1,
352 + CERT_CHAIN_POLICY_AUTHENTICODE = cast(LPCSTR) 2,
353 + CERT_CHAIN_POLICY_AUTHENTICODE_TS = cast(LPCSTR) 3,
354 + CERT_CHAIN_POLICY_SSL = cast(LPCSTR) 4,
355 + CERT_CHAIN_POLICY_BASIC_CONSTRAINTS = cast(LPCSTR) 5,
356 + CERT_CHAIN_POLICY_NT_AUTH = cast(LPCSTR) 6,
357 +}
358 +
359 +enum {
360 + USAGE_MATCH_TYPE_AND = 0,
361 + USAGE_MATCH_TYPE_OR = 1,
362 +}
363 +
364 +enum {
365 + CERT_SIMPLE_NAME_STR = 1,
366 + CERT_OID_NAME_STR = 2,
367 + CERT_X500_NAME_STR = 3,
368 +}
369 +enum {
370 + CERT_NAME_STR_SEMICOLON_FLAG = 1073741824,
371 + CERT_NAME_STR_CRLF_FLAG = 134217728,
372 + CERT_NAME_STR_NO_PLUS_FLAG = 536870912,
373 + CERT_NAME_STR_NO_QUOTING_FLAG = 268435456,
374 + CERT_NAME_STR_REVERSE_FLAG = 33554432,
375 + CERT_NAME_STR_ENABLE_T61_UNICODE_FLAG = 131072,
376 +}
377 +
378 +enum {
379 + CERT_FIND_ANY = 0,
380 + CERT_FIND_CERT_ID = 1048576,
381 + CERT_FIND_CTL_USAGE = 655360,
382 + CERT_FIND_ENHKEY_USAGE = 655360,
383 + CERT_FIND_EXISTING = 851968,
384 + CERT_FIND_HASH = 65536,
385 + CERT_FIND_ISSUER_ATTR = 196612,
386 + CERT_FIND_ISSUER_NAME = 131076,
387 + CERT_FIND_ISSUER_OF = 786432,
388 + CERT_FIND_KEY_IDENTIFIER = 983040,
389 + CERT_FIND_KEY_SPEC = 589824,
390 + CERT_FIND_MD5_HASH = 262144,
391 + CERT_FIND_PROPERTY = 327680,
392 + CERT_FIND_PUBLIC_KEY = 393216,
393 + CERT_FIND_SHA1_HASH = 65536,
394 + CERT_FIND_SIGNATURE_HASH = 917504,
395 + CERT_FIND_SUBJECT_ATTR = 196615,
396 + CERT_FIND_SUBJECT_CERT = 720896,
397 + CERT_FIND_SUBJECT_NAME = 131079,
398 + CERT_FIND_SUBJECT_STR_A = 458759,
399 + CERT_FIND_SUBJECT_STR_W = 524295,
400 + CERT_FIND_ISSUER_STR_A = 458756,
401 + CERT_FIND_ISSUER_STR_W = 524292,
402 +}
403 +
404 +enum {
405 + CERT_FIND_OR_ENHKEY_USAGE_FLAG = 16,
406 + CERT_FIND_OPTIONAL_ENHKEY_USAGE_FLAG = 1,
407 + CERT_FIND_NO_ENHKEY_USAGE_FLAG = 8,
408 + CERT_FIND_VALID_ENHKEY_USAGE_FLAG = 32,
409 + CERT_FIND_EXT_ONLY_ENHKEY_USAGE_FLAG = 2,
410 +}
411 +
412 +enum {
413 + CERT_CASE_INSENSITIVE_IS_RDN_ATTRS_FLAG = 2,
414 + CERT_UNICODE_IS_RDN_ATTRS_FLAG = 1,
415 + CERT_CHAIN_FIND_BY_ISSUER = 1,
416 +}
417 +
418 +enum {
419 + CERT_CHAIN_FIND_BY_ISSUER_COMPARE_KEY_FLAG = 1,
420 + CERT_CHAIN_FIND_BY_ISSUER_COMPLEX_CHAIN_FLAG = 2,
421 + CERT_CHAIN_FIND_BY_ISSUER_CACHE_ONLY_URL_FLAG = 4,
422 + CERT_CHAIN_FIND_BY_ISSUER_LOCAL_MACHINE_FLAG = 8,
423 + CERT_CHAIN_FIND_BY_ISSUER_NO_KEY_FLAG = 16384,
424 + CERT_CHAIN_FIND_BY_ISSUER_CACHE_ONLY_FLAG = 32768,
425 +}
426 +
427 +enum {
428 + CERT_STORE_PROV_SYSTEM = 10,
429 + CERT_SYSTEM_STORE_LOCAL_MACHINE = 131072,
430 +}
431 +
432 +enum {
433 + szOID_PKIX_KP_SERVER_AUTH = "4235600",
434 + szOID_SERVER_GATED_CRYPTO = "4235658",
435 + szOID_SGC_NETSCAPE = "2.16.840.1.113730.4.1",
436 + szOID_PKIX_KP_CLIENT_AUTH = "1.3.6.1.5.5.7.3.2",
437 +}
438 +
439 +enum {
440 + CRYPT_NOHASHOID = 0x00000001,
441 + CRYPT_NO_SALT = 0x10,
442 + CRYPT_PREGEN = 0x40,
443 +}
444 +
445 +enum {
446 + CRYPT_RECIPIENT = 0x10,
447 + CRYPT_INITIATOR = 0x40,
448 + CRYPT_ONLINE = 0x80,
449 + CRYPT_SF = 0x100,
450 + CRYPT_CREATE_IV = 0x200,
451 + CRYPT_KEK = 0x400,
452 + CRYPT_DATA_KEY = 0x800,
453 + CRYPT_VOLATILE = 0x1000,
454 + CRYPT_SGCKEY = 0x2000,
455 +}
456 +
457 +enum {
458 + KP_IV = 0x00000001,
459 + KP_SALT = 0x00000002,
460 + KP_PADDING = 0x00000003,
461 + KP_MODE = 0x00000004,
462 + KP_MODE_BITS = 0x00000005,
463 + KP_PERMISSIONS = 0x00000006,
464 + KP_ALGID = 0x00000007,
465 + KP_BLOCKLEN = 0x00000008,
466 + KP_KEYLEN = 0x00000009,
467 + KP_SALT_EX = 0x0000000a,
468 + KP_P = 0x0000000b,
469 + KP_G = 0x0000000c,
470 + KP_Q = 0x0000000d,
471 + KP_X = 0x0000000e,
472 + KP_Y = 0x0000000f,
473 + KP_RA = 0x00000010,
474 + KP_RB = 0x00000011,
475 + KP_INFO = 0x00000012,
476 + KP_EFFECTIVE_KEYLEN = 0x00000013,
477 + KP_SCHANNEL_ALG = 0x00000014,
478 + KP_PUB_PARAMS = 0x00000027,
479 +}
480 +
481 +enum {
482 + CRYPT_FLAG_PCT1 = 0x0001,
483 + CRYPT_FLAG_SSL2 = 0x0002,
484 + CRYPT_FLAG_SSL3 = 0x0004,
485 + CRYPT_FLAG_TLS1 = 0x0008,
486 + CRYPT_FLAG_IPSEC = 0x0010,
487 + CRYPT_FLAG_SIGNING = 0x0020,
488 +}
489 +
490 +enum {
491 + SCHANNEL_MAC_KEY = 0x00000000,
492 + SCHANNEL_ENC_KEY = 0x00000001,
493 +}
494 +
495 +enum {
496 + INTERNATIONAL_USAGE = 0x00000001,
497 +}
498 +
390 499
391 500 alias UINT ALG_ID;
392 501 alias ULONG HCRYPTPROV, HCRYPTKEY, HCRYPTHASH;
393 502 alias PVOID HCERTSTORE, HCRYPTMSG, HCERTCHAINENGINE;
394 503
395 504 struct VTableProvStruc {
396 505 FARPROC FuncVerifyImage;
................................................................................
484 593 struct CERT_CONTEXT {
485 594 DWORD dwCertEncodingType;
486 595 BYTE* pbCertEncoded;
487 596 DWORD cbCertEncoded;
488 597 PCERT_INFO pCertInfo;
489 598 HCERTSTORE hCertStore;
490 599 }
491 -alias CERT_CONTEXT* PCERT_CONTEXT;
492 -alias CPtr!(CERT_CONTEXT) PCCERT_CONTEXT;
600 +alias CERT_CONTEXT* PCERT_CONTEXT;
601 +alias const(CERT_CONTEXT)* PCCERT_CONTEXT;
493 602
494 603 struct CTL_USAGE {
495 604 DWORD cUsageIdentifier;
496 605 LPSTR* rgpszUsageIdentifier;
497 606 }
498 607 alias CTL_USAGE CERT_ENHKEY_USAGE;
499 608 alias CTL_USAGE* PCTRL_USAGE, PCERT_ENHKEY_USAGE;
................................................................................
565 674 struct CRL_CONTEXT {
566 675 DWORD dwCertEncodingType;
567 676 BYTE* pbCrlEncoded;
568 677 DWORD cbCrlEncoded;
569 678 PCRL_INFO pCrlInfo;
570 679 HCERTSTORE hCertStore;
571 680 }
572 -alias CRL_CONTEXT* PCRL_CONTEXT;
573 -alias CPtr!(CRL_CONTEXT) PCCRL_CONTEXT;
681 +alias CRL_CONTEXT* PCRL_CONTEXT;
682 +alias const(CRL_CONTEXT)* PCCRL_CONTEXT;
574 683
575 684 struct CERT_REVOCATION_CRL_INFO {
576 685 DWORD cbSize = CERT_REVOCATION_CRL_INFO.sizeof;
577 686 PCCRL_CONTEXT pBaseCRLContext;
578 687 PCCRL_CONTEXT pDeltaCRLContext;
579 688 PCRL_ENTRY pCrlEntry;
580 689 BOOL fDeltaCrlEntry;
................................................................................
639 748 DWORD cbCtlEncoded;
640 749 PCTL_INFO pCtlInfo;
641 750 HCERTSTORE hCertStore;
642 751 HCRYPTMSG hCryptMsg;
643 752 BYTE* pbCtlContent;
644 753 DWORD cbCtlContent;
645 754 }
646 -alias CTL_CONTEXT* PCTL_CONTEXT;
647 -alias CPtr!(CTL_CONTEXT) PCCTL_CONTEXT;
755 +alias CTL_CONTEXT* PCTL_CONTEXT;
756 +alias const(CTL_CONTEXT)* PCCTL_CONTEXT;
648 757
649 758 struct CERT_TRUST_LIST_INFO {
650 759 DWORD cbSize = CERT_TRUST_LIST_INFO.sizeof;
651 760 PCTL_ENTRY pCtlEntry;
652 761 PCCTL_CONTEXT pCtlContext;
653 762 }
654 763 alias CERT_TRUST_LIST_INFO* PCERT_TRUST_LIST_INFO;
................................................................................
661 770 PCERT_TRUST_LIST_INFO pTrustListInfo;
662 771 BOOL fHasRevocationFreshnessTime;
663 772 DWORD dwRevocationFreshnessTime;
664 773 }
665 774 alias CERT_SIMPLE_CHAIN* PCERT_SIMPLE_CHAIN;
666 775
667 776 /* #if (_WIN32_WINNT>=0x500) */
668 -alias CPtr!(CERT_CHAIN_CONTEXT) PCCERT_CHAIN_CONTEXT;
777 +alias const(CERT_CHAIN_CONTEXT)* PCCERT_CHAIN_CONTEXT;
669 778 struct CERT_CHAIN_CONTEXT {
670 779 DWORD cbSize = CERT_CHAIN_CONTEXT.sizeof;
671 780 CERT_TRUST_STATUS TrustStatus;
672 781 DWORD cChain;
673 782 PCERT_SIMPLE_CHAIN* rgpChain;
674 783 DWORD cLowerQualityChainContext;
675 784 PCCERT_CHAIN_CONTEXT* rgpLowerQualityChainContext;
................................................................................
716 825 BOOL CertVerifyCertificateChainPolicy(LPCSTR, PCCERT_CHAIN_CONTEXT,
717 826 PCERT_CHAIN_POLICY_PARA, PCERT_CHAIN_POLICY_STATUS);
718 827 void CertFreeCertificateChain(PCCERT_CHAIN_CONTEXT);
719 828 DWORD CertNameToStrA(DWORD, PCERT_NAME_BLOB, DWORD, LPSTR, DWORD);
720 829 DWORD CertNameToStrW(DWORD, PCERT_NAME_BLOB, DWORD, LPWSTR, DWORD);
721 830 HCERTSTORE CertOpenSystemStoreA(HCRYPTPROV, LPCSTR);
722 831 HCERTSTORE CertOpenSystemStoreW(HCRYPTPROV, LPCWSTR);
723 - HCERTSTORE CertOpenStore(LPCSTR, DWORD, HCRYPTPROV, DWORD, CPtr!(void));
832 + HCERTSTORE CertOpenStore(LPCSTR, DWORD, HCRYPTPROV, DWORD, const(void)*);
724 833 PCCERT_CONTEXT CertFindCertificateInStore(HCERTSTORE, DWORD, DWORD, DWORD,
725 - CPtr!(void), PCCERT_CONTEXT);
834 + const(void)*, PCCERT_CONTEXT);
726 835 BOOL CertFreeCertificateContext(PCCERT_CONTEXT);
727 836 PCCERT_CONTEXT CertGetIssuerCertificateFromStore(HCERTSTORE,
728 837 PCCERT_CONTEXT, PCCERT_CONTEXT, DWORD*);
729 838 PCCERT_CHAIN_CONTEXT CertFindChainInStore(HCERTSTORE, DWORD, DWORD, DWORD,
730 - CPtr!(void), PCCERT_CHAIN_CONTEXT);
839 + const(void)*, PCCERT_CHAIN_CONTEXT);
731 840
732 841 BOOL CryptAcquireContextA(HCRYPTPROV*, LPCSTR, LPCSTR, DWORD, DWORD);
733 842 BOOL CryptAcquireContextW(HCRYPTPROV*, LPCWSTR, LPCWSTR, DWORD, DWORD);
734 843 BOOL CryptContextAddRef(HCRYPTPROV, DWORD*, DWORD);
735 844 BOOL CryptReleaseContext(HCRYPTPROV, DWORD);
736 845 BOOL CryptGenKey(HCRYPTPROV, ALG_ID, DWORD, HCRYPTKEY*);
737 846 BOOL CryptDeriveKey(HCRYPTPROV, ALG_ID, HCRYPTHASH, DWORD, HCRYPTKEY*);
738 847 BOOL CryptDestroyKey(HCRYPTKEY);
739 - static if (WINVER >= 0x0500) {
848 + static if (_WIN32_WINNT >= 0x500) {
740 849 BOOL CryptDuplicateHash(HCRYPTHASH, DWORD*, DWORD, HCRYPTHASH*);
741 850 BOOL CryptDuplicateKey(HCRYPTKEY, DWORD*, DWORD, HCRYPTKEY*);
742 851 }
743 852 BOOL CryptSetKeyParam(HCRYPTKEY, DWORD, PBYTE, DWORD);
744 853 BOOL CryptGetKeyParam(HCRYPTKEY, DWORD, PBYTE, PDWORD, DWORD);
745 854 BOOL CryptSetHashParam(HCRYPTHASH, DWORD, PBYTE, DWORD);
746 855 BOOL CryptGetHashParam(HCRYPTHASH, DWORD, PBYTE, PDWORD, DWORD);