简体   繁体   English

TLS 1.2 如何调试/重现

[英]TLS 1.2 how to debug/reproduce

I have an excel plugin written in c# that connects to a website hosted as an Azure app service with the following settings我有一个用 c# 编写的 excel 插件,它连接到作为 Azure 应用服务托管的网站,具有以下设置Azure 应用服务 TLS 设置

The plugin tries to download some content from the webapp using the following code该插件尝试使用以下代码从 webapp 下载一些内容

public static string HttpPost(string URI, string Parameters)
        {
            System.Net.WebRequest req = System.Net.WebRequest.Create(URI);
            req.Proxy = GetProxyForConnection();
            //Add these, as we're doing a POST
            req.ContentType = "application/json";
            req.Method = "POST";
            //We need to count how many bytes we're sending. Post'ed Faked Forms should be name=value&
            byte[] bytes = System.Text.Encoding.ASCII.GetBytes(Parameters);
            req.ContentLength = bytes.Length;
                System.IO.Stream os = req.GetRequestStream();
            os.Write(bytes, 0, bytes.Length); //Push it out there
            os.Close();
            System.Net.WebResponse resp = req.GetResponse();
            if (resp == null) return null;
            System.IO.StreamReader sr = new System.IO.StreamReader(resp.GetResponseStream());
            return sr.ReadToEnd().Trim();
        }

this works perfectly on many computers, but we have a client who uses exclusively TLS 1.2 connection, this is what they wrote这在许多计算机上都能完美运行,但我们有一个专门使用 TLS 1.2 连接的客户端,这就是他们写的

Our IT Security team have been removing TLS 1.1 from our environment – Microsoft's recommendation.我们的 IT 安全团队一直在从我们的环境中删除 TLS 1.1 - Microsoft 的建议。

My question is how to reproduce this, how to make our dev environment TLS 1.2, and any hints on how to fix the issue?我的问题是如何重现这一点,如何使我们的开发环境 TLS 1.2,以及有关如何解决该问题的任何提示?

thanks谢谢

PS the plugin is written in .net 4.0 PS插件是用.net 4.0编写的

The .NET 4.0 doesn't support TLS 1.1 or TLS 1.2, is the why your code doesnt works. .NET 4.0 不支持 TLS 1.1 或 TLS 1.2,这就是您的代码不起作用的原因。

Your applcation should be target to .NET Framework 4.7, better if it is 4.8.您的应用程序应该以 .NET Framework 4.7 为目标,如果是 4.8 则更好。

As @jdweng said, the SSL, TLS 1.0, and TLS 1.1 are obsolete and has been disabled asap.正如@jdweng 所说,SSL、TLS 1.0 和 TLS 1.1 已过时并已尽快禁用。

To simulate the issue its quite simple, use the IISCrypto and uncheck the protocols, server and client side, see:要模拟非常简单的问题,请使用IISCrypto并取消选中协议、服务器和客户端,请参阅:

在此处输入图像描述

The changes made on IISCrypto , changes the regedit, if you wanna know more about it, look at Transport Layer Security (TLS) registry settingsIISCrypto所做的更改,更改了注册表编辑器,如果您想了解更多信息,请查看传输层安全性 (TLS) 注册表设置

Regards问候

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM