A small example of using the Windows Internet (WinINet) API to interrogate open internet handles for negotiated security protocols and ciphers.
Usage:
IntPtr internetHandle = InternetServices.InternetOpen("Debug", 1, null, null, 0);
internetHandle = InternetServices.InternetOpenUrl(
internetHandle, @"https://www.google.com/", null, 0, 2147483648, IntPtr.Zero);
SecurityInfo securityInfo = InternetServices.GetSecurityInfo(internetHandle);
// When creating internet handles make sure to free them once they are no longer needed.
InternetServices.InternetCloseHandle(internetHandle);
All necessary functions have been wrapped for you and further documentation can be found below:
- https://docs.microsoft.com/en-us/windows/win32/api/wininet/nf-wininet-internetopenw
- https://docs.microsoft.com/en-us/windows/win32/api/wininet/nf-wininet-internetopenurlw
- https://docs.microsoft.com/en-us/windows/win32/api/wininet/nf-wininet-internetclosehandle
- https://docs.microsoft.com/en-us/windows/win32/api/wininet/nf-wininet-internetqueryoptionw
- https://docs.microsoft.com/en-us/windows/win32/wininet/setting-and-retrieving-internet-options