Description
I need to activate TLS1.2 in Casablanca on Windows. The only way I have found to do this is actually recompile the cpprest120_2_7.dll with the following lines in the open() function of winhttp_client:
// Open session and connection with the server.
unsigned long open()
{
..........
DWORD protocols = WINHTTP_FLAG_SECURE_PROTOCOL_SSL3 | WINHTTP_FLAG_SECURE_PROTOCOL_TLS1 | WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_1 | WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2;
if(!WinHttpSetOption(m_hSession, WINHTTP_OPTION_SECURE_PROTOCOLS, &protocols, sizeof(protocols)))
{
return report_failure(_XPLATSTR("Error setting protocols"));
}
........
}
This works, so far so good, but it needs recompilation of cpprest120_2_7.dll and this is surely not right way to go when it concerns future updates of the SDK.
I have also tried to use the set_nativehandle_options to do these settings so I don't have to recompile the cpprest120_2_7.dll, but unfortunately this native handle concerns only the request handle (in the send_request function) and not the session handle.
Is there any way to enable TLS1.2 without recompilation of cpprest120_2_7.dll? And if not, can also a callback function like set_nativehandle_options in the open function be implemented in the standard release of the SDK that exposes the session handle and I can use WinHttpSetOption in my own software on this session handle?