Enable TLS 1.3 support (#5047)
* Enable TLS 1.3 support * Updated error message
This commit is contained in:
Родитель
1acf0ba6df
Коммит
92364dcee1
|
@ -1,6 +1,6 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
// cspell:words HCERTIFICATECHAIN PCCERT CCERT HCERTCHAINENGINE HCERTSTORE
|
||||
// cspell:words HCERTIFICATECHAIN PCCERT CCERT HCERTCHAINENGINE HCERTSTORE lpsz REFERER
|
||||
|
||||
#include "azure/core/base64.hpp"
|
||||
#include "azure/core/diagnostics/logger.hpp"
|
||||
|
@ -723,12 +723,16 @@ Azure::Core::_internal::UniqueHandle<HINTERNET> WinHttpTransport::CreateSessionH
|
|||
sizeof(tls_false_start));
|
||||
#endif
|
||||
|
||||
// Enforce TLS version 1.2
|
||||
// Enforce TLS version 1.2 or 1.3 (if available).
|
||||
#if defined(WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_3)
|
||||
auto tlsOption = WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2 | WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_3;
|
||||
#else
|
||||
auto tlsOption = WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2;
|
||||
#endif
|
||||
if (!WinHttpSetOption(
|
||||
sessionHandle.get(), WINHTTP_OPTION_SECURE_PROTOCOLS, &tlsOption, sizeof(tlsOption)))
|
||||
{
|
||||
GetErrorAndThrow("Error while enforcing TLS 1.2 for connection request.");
|
||||
GetErrorAndThrow("Error while enforcing TLS version for connection request.");
|
||||
}
|
||||
|
||||
return sessionHandle;
|
||||
|
|
Загрузка…
Ссылка в новой задаче