20 #ifndef WINPR_SSPI_SCHANNEL_H
21 #define WINPR_SSPI_SCHANNEL_H
23 #include <winpr/sspi.h>
24 #include <winpr/crypto.h>
26 #if defined(_WIN32) && !defined(_UWP)
32 #define SCHANNEL_NAME_A "Schannel"
33 #define SCHANNEL_NAME_W L"Schannel"
36 #define SCHANNEL_NAME SCHANNEL_NAME_W
38 #define SCHANNEL_NAME SCHANNEL_NAME_A
41 #define SECPKG_ATTR_SUPPORTED_ALGS 86
42 #define SECPKG_ATTR_CIPHER_STRENGTHS 87
43 #define SECPKG_ATTR_SUPPORTED_PROTOCOLS 88
48 ALG_ID* palgSupportedAlgs;
53 DWORD dwMinimumCipherStrength;
54 DWORD dwMaximumCipherStrength;
62 enum eTlsSignatureAlgorithm
64 TlsSignatureAlgorithm_Anonymous = 0,
65 TlsSignatureAlgorithm_Rsa = 1,
66 TlsSignatureAlgorithm_Dsa = 2,
67 TlsSignatureAlgorithm_Ecdsa = 3
70 enum eTlsHashAlgorithm
72 TlsHashAlgorithm_None = 0,
73 TlsHashAlgorithm_Md5 = 1,
74 TlsHashAlgorithm_Sha1 = 2,
75 TlsHashAlgorithm_Sha224 = 3,
76 TlsHashAlgorithm_Sha256 = 4,
77 TlsHashAlgorithm_Sha384 = 5,
78 TlsHashAlgorithm_Sha512 = 6
81 #define SCH_CRED_V1 0x00000001
82 #define SCH_CRED_V2 0x00000002
83 #define SCH_CRED_VERSION 0x00000002
84 #define SCH_CRED_V3 0x00000003
85 #define SCHANNEL_CRED_VERSION 0x00000004
92 HCERTSTORE hRootStore;
95 ALG_ID* palgSupportedAlgs;
97 DWORD grbitEnabledProtocols;
98 DWORD dwMinimumCipherStrength;
99 DWORD dwMaximumCipherStrength;
100 DWORD dwSessionLifespan;
105 #define SCH_CRED_FORMAT_CERT_CONTEXT 0x00000000
106 #define SCH_CRED_FORMAT_CERT_HASH 0x00000001
107 #define SCH_CRED_FORMAT_CERT_HASH_STORE 0x00000002
109 #define SCH_CRED_MAX_STORE_NAME_SIZE 128
110 #define SCH_CRED_MAX_SUPPORTED_ALGS 256
111 #define SCH_CRED_MAX_SUPPORTED_CERTS 100
127 WCHAR pwszStoreName[SCH_CRED_MAX_STORE_NAME_SIZE];
130 #define SCH_MACHINE_CERT_HASH 0x00000001
132 #define SCH_CRED_NO_SYSTEM_MAPPER 0x00000002
133 #define SCH_CRED_NO_SERVERNAME_CHECK 0x00000004
134 #define SCH_CRED_MANUAL_CRED_VALIDATION 0x00000008
135 #define SCH_CRED_NO_DEFAULT_CREDS 0x00000010
136 #define SCH_CRED_AUTO_CRED_VALIDATION 0x00000020
137 #define SCH_CRED_USE_DEFAULT_CREDS 0x00000040
138 #define SCH_CRED_DISABLE_RECONNECTS 0x00000080
140 #define SCH_CRED_REVOCATION_CHECK_END_CERT 0x00000100
141 #define SCH_CRED_REVOCATION_CHECK_CHAIN 0x00000200
142 #define SCH_CRED_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT 0x00000400
143 #define SCH_CRED_IGNORE_NO_REVOCATION_CHECK 0x00000800
144 #define SCH_CRED_IGNORE_REVOCATION_OFFLINE 0x00001000
146 #define SCH_CRED_RESTRICTED_ROOTS 0x00002000
147 #define SCH_CRED_REVOCATION_CHECK_CACHE_ONLY 0x00004000
148 #define SCH_CRED_CACHE_ONLY_URL_RETRIEVAL 0x00008000
150 #define SCH_CRED_MEMORY_STORE_CERT 0x00010000
152 #define SCH_CRED_CACHE_ONLY_URL_RETRIEVAL_ON_CREATE 0x00020000
154 #define SCH_SEND_ROOT_CERT 0x00040000
155 #define SCH_CRED_SNI_CREDENTIAL 0x00080000
156 #define SCH_CRED_SNI_ENABLE_OCSP 0x00100000
157 #define SCH_SEND_AUX_RECORD 0x00200000
159 #define SCHANNEL_RENEGOTIATE 0
160 #define SCHANNEL_SHUTDOWN 1
161 #define SCHANNEL_ALERT 2
162 #define SCHANNEL_SESSION 3
171 #define TLS1_ALERT_WARNING 1
172 #define TLS1_ALERT_FATAL 2
174 #define TLS1_ALERT_CLOSE_NOTIFY 0
175 #define TLS1_ALERT_UNEXPECTED_MESSAGE 10
176 #define TLS1_ALERT_BAD_RECORD_MAC 20
177 #define TLS1_ALERT_DECRYPTION_FAILED 21
178 #define TLS1_ALERT_RECORD_OVERFLOW 22
179 #define TLS1_ALERT_DECOMPRESSION_FAIL 30
180 #define TLS1_ALERT_HANDSHAKE_FAILURE 40
181 #define TLS1_ALERT_BAD_CERTIFICATE 42
182 #define TLS1_ALERT_UNSUPPORTED_CERT 43
183 #define TLS1_ALERT_CERTIFICATE_REVOKED 44
184 #define TLS1_ALERT_CERTIFICATE_EXPIRED 45
185 #define TLS1_ALERT_CERTIFICATE_UNKNOWN 46
186 #define TLS1_ALERT_ILLEGAL_PARAMETER 47
187 #define TLS1_ALERT_UNKNOWN_CA 48
188 #define TLS1_ALERT_ACCESS_DENIED 49
189 #define TLS1_ALERT_DECODE_ERROR 50
190 #define TLS1_ALERT_DECRYPT_ERROR 51
191 #define TLS1_ALERT_EXPORT_RESTRICTION 60
192 #define TLS1_ALERT_PROTOCOL_VERSION 70
193 #define TLS1_ALERT_INSUFFIENT_SECURITY 71
194 #define TLS1_ALERT_INTERNAL_ERROR 80
195 #define TLS1_ALERT_USER_CANCELED 90
196 #define TLS1_ALERT_NO_RENEGOTIATION 100
197 #define TLS1_ALERT_UNSUPPORTED_EXT 110
199 #define SSL_SESSION_ENABLE_RECONNECTS 1
200 #define SSL_SESSION_DISABLE_RECONNECTS 2
214 BYTE CertThumbprint[20];
217 #define SP_PROT_SSL3_SERVER 0x00000010
218 #define SP_PROT_SSL3_CLIENT 0x00000020
219 #define SP_PROT_SSL3 (SP_PROT_SSL3_SERVER | SP_PROT_SSL3_CLIENT)
221 #define SP_PROT_TLS1_SERVER 0x00000040
222 #define SP_PROT_TLS1_CLIENT 0x00000080
223 #define SP_PROT_TLS1 (SP_PROT_TLS1_SERVER | SP_PROT_TLS1_CLIENT)
225 #define SP_PROT_SSL3TLS1_CLIENTS (SP_PROT_TLS1_CLIENT | SP_PROT_SSL3_CLIENT)
226 #define SP_PROT_SSL3TLS1_SERVERS (SP_PROT_TLS1_SERVER | SP_PROT_SSL3_SERVER)
227 #define SP_PROT_SSL3TLS1 (SP_PROT_SSL3 | SP_PROT_TLS1)
229 #define SP_PROT_UNI_SERVER 0x40000000
230 #define SP_PROT_UNI_CLIENT 0x80000000
231 #define SP_PROT_UNI (SP_PROT_UNI_SERVER | SP_PROT_UNI_CLIENT)
233 #define SP_PROT_ALL 0xFFFFFFFF
234 #define SP_PROT_NONE 0
235 #define SP_PROT_CLIENTS (SP_PROT_SSL3_CLIENT | SP_PROT_UNI_CLIENT | SP_PROT_TLS1_CLIENT)
236 #define SP_PROT_SERVERS (SP_PROT_SSL3_SERVER | SP_PROT_UNI_SERVER | SP_PROT_TLS1_SERVER)
238 #define SP_PROT_TLS1_0_SERVER SP_PROT_TLS1_SERVER
239 #define SP_PROT_TLS1_0_CLIENT SP_PROT_TLS1_CLIENT
240 #define SP_PROT_TLS1_0 (SP_PROT_TLS1_0_SERVER | SP_PROT_TLS1_0_CLIENT)
242 #define SP_PROT_TLS1_1_SERVER 0x00000100
243 #define SP_PROT_TLS1_1_CLIENT 0x00000200
244 #define SP_PROT_TLS1_1 (SP_PROT_TLS1_1_SERVER | SP_PROT_TLS1_1_CLIENT)
246 #define SP_PROT_TLS1_2_SERVER 0x00000400
247 #define SP_PROT_TLS1_2_CLIENT 0x00000800
248 #define SP_PROT_TLS1_2 (SP_PROT_TLS1_2_SERVER | SP_PROT_TLS1_2_CLIENT)
250 #define SP_PROT_DTLS_SERVER 0x00010000
251 #define SP_PROT_DTLS_CLIENT 0x00020000
252 #define SP_PROT_DTLS (SP_PROT_DTLS_SERVER | SP_PROT_DTLS_CLIENT)
254 #define SP_PROT_DTLS1_0_SERVER SP_PROT_DTLS_SERVER
255 #define SP_PROT_DTLS1_0_CLIENT SP_PROT_DTLS_CLIENT
256 #define SP_PROT_DTLS1_0 (SP_PROT_DTLS1_0_SERVER | SP_PROT_DTLS1_0_CLIENT)
258 #define SP_PROT_DTLS1_X_SERVER SP_PROT_DTLS1_0_SERVER
260 #define SP_PROT_DTLS1_X_CLIENT SP_PROT_DTLS1_0_CLIENT
262 #define SP_PROT_DTLS1_X (SP_PROT_DTLS1_X_SERVER | SP_PROT_DTLS1_X_CLIENT)
264 #define SP_PROT_TLS1_1PLUS_SERVER (SP_PROT_TLS1_1_SERVER | SP_PROT_TLS1_2_SERVER)
265 #define SP_PROT_TLS1_1PLUS_CLIENT (SP_PROT_TLS1_1_CLIENT | SP_PROT_TLS1_2_CLIENT)
267 #define SP_PROT_TLS1_1PLUS (SP_PROT_TLS1_1PLUS_SERVER | SP_PROT_TLS1_1PLUS_CLIENT)
269 #define SP_PROT_TLS1_X_SERVER \
270 (SP_PROT_TLS1_0_SERVER | SP_PROT_TLS1_1_SERVER | SP_PROT_TLS1_2_SERVER)
271 #define SP_PROT_TLS1_X_CLIENT \
272 (SP_PROT_TLS1_0_CLIENT | SP_PROT_TLS1_1_CLIENT | SP_PROT_TLS1_2_CLIENT)
273 #define SP_PROT_TLS1_X (SP_PROT_TLS1_X_SERVER | SP_PROT_TLS1_X_CLIENT)
275 #define SP_PROT_SSL3TLS1_X_CLIENTS (SP_PROT_TLS1_X_CLIENT | SP_PROT_SSL3_CLIENT)
276 #define SP_PROT_SSL3TLS1_X_SERVERS (SP_PROT_TLS1_X_SERVER | SP_PROT_SSL3_SERVER)
277 #define SP_PROT_SSL3TLS1_X (SP_PROT_SSL3 | SP_PROT_TLS1_X)
279 #define SP_PROT_X_CLIENTS (SP_PROT_CLIENTS | SP_PROT_TLS1_X_CLIENT | SP_PROT_DTLS1_X_CLIENT)
280 #define SP_PROT_X_SERVERS (SP_PROT_SERVERS | SP_PROT_TLS1_X_SERVER | SP_PROT_DTLS1_X_SERVER)