1 /**
2  * Windows API header module
3  *
4  * Translated from MinGW Windows headers
5  *
6  * Authors: Stewart Gordon
7  * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
8  * Source: $(DRUNTIMESRC core/sys/windows/_schannel.d)
9  */
10 module core.sys.windows.schannel;
11 version (Windows):
12 
13 import core.sys.windows.wincrypt;
14 import core.sys.windows.windef;
15 
16 enum DWORD SCHANNEL_CRED_VERSION = 4;
17 enum SCHANNEL_SHUTDOWN           = 1;
18 /* Comment from MinGW
19     ? Do these belong here or in wincrypt.h
20  */
21 enum : DWORD {
22     AUTHTYPE_CLIENT = 1,
23     AUTHTYPE_SERVER = 2
24 }
25 
26 enum DWORD
27     SP_PROT_PCT1_SERVER = 0x01,
28     SP_PROT_PCT1_CLIENT = 0x02,
29     SP_PROT_SSL2_SERVER = 0x04,
30     SP_PROT_SSL2_CLIENT = 0x08,
31     SP_PROT_SSL3_SERVER = 0x10,
32     SP_PROT_SSL3_CLIENT = 0x20,
33     SP_PROT_TLS1_SERVER = 0x40,
34     SP_PROT_TLS1_CLIENT = 0x80,
35     SP_PROT_PCT1        = SP_PROT_PCT1_CLIENT | SP_PROT_PCT1_SERVER,
36     SP_PROT_TLS1        = SP_PROT_TLS1_CLIENT | SP_PROT_TLS1_SERVER,
37     SP_PROT_SSL2        = SP_PROT_SSL2_CLIENT | SP_PROT_SSL2_SERVER,
38     SP_PROT_SSL3        = SP_PROT_SSL3_CLIENT | SP_PROT_SSL3_SERVER;
39 
40 enum DWORD
41     SCH_CRED_NO_SYSTEM_MAPPER                    = 0x0002,
42     SCH_CRED_NO_SERVERNAME_CHECK                 = 0x0004,
43     SCH_CRED_MANUAL_CRED_VALIDATION              = 0x0008,
44     SCH_CRED_NO_DEFAULT_CREDS                    = 0x0010,
45     SCH_CRED_AUTO_CRED_VALIDATION                = 0x0020,
46     SCH_CRED_USE_DEFAULT_CREDS                   = 0x0040,
47     SCH_CRED_REVOCATION_CHECK_END_CERT           = 0x0100,
48     SCH_CRED_REVOCATION_CHECK_CHAIN              = 0x0200,
49     SCH_CRED_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT = 0x0400,
50     SCH_CRED_IGNORE_NO_REVOCATION_CHECK          = 0x0800,
51     SCH_CRED_IGNORE_REVOCATION_OFFLINE           = 0x1000;
52 
53 // No definition - presumably an opaque structure
54 struct _HMAPPER;
55 
56 struct SCHANNEL_CRED {
57     DWORD           dwVersion = SCHANNEL_CRED_VERSION;
58     DWORD           cCreds;
59     PCCERT_CONTEXT* paCred;
60     HCERTSTORE      hRootStore;
61     DWORD           cMappers;
62     _HMAPPER**      aphMappers;
63     DWORD           cSupportedAlgs;
64     ALG_ID*         palgSupportedAlgs;
65     DWORD           grbitEnabledProtocols;
66     DWORD           dwMinimumCypherStrength;
67     DWORD           dwMaximumCypherStrength;
68     DWORD           dwSessionLifespan;
69     DWORD           dwFlags;
70     DWORD           reserved;
71 }
72 alias SCHANNEL_CRED* PSCHANNEL_CRED;
73 
74 struct SecPkgCred_SupportedAlgs {
75     DWORD   cSupportedAlgs;
76     ALG_ID* palgSupportedAlgs;
77 }
78 alias SecPkgCred_SupportedAlgs* PSecPkgCred_SupportedAlgs;
79 
80 struct SecPkgCred_CypherStrengths {
81     DWORD dwMinimumCypherStrength;
82     DWORD dwMaximumCypherStrength;
83 }
84 alias SecPkgCred_CypherStrengths* PSecPkgCred_CypherStrengths;
85 
86 struct SecPkgCred_SupportedProtocols {
87     DWORD grbitProtocol;
88 }
89 alias SecPkgCred_SupportedProtocols* PSecPkgCred_SupportedProtocols;
90 
91 struct SecPkgContext_IssuerListInfoEx {
92     PCERT_NAME_BLOB aIssuers;
93     DWORD           cIssuers;
94 }
95 alias SecPkgContext_IssuerListInfoEx* PSecPkgContext_IssuerListInfoEx;
96 
97 struct SecPkgContext_ConnectionInfo {
98     DWORD  dwProtocol;
99     ALG_ID aiCipher;
100     DWORD  dwCipherStrength;
101     ALG_ID aiHash;
102     DWORD  dwHashStrength;
103     ALG_ID aiExch;
104     DWORD  dwExchStrength;
105 }
106 alias SecPkgContext_ConnectionInfo* PSecPkgContext_ConnectionInfo;