C#HttpWebRequest的日志安全协议
我有一个守护进程,它根据数据库中的信息发出出站WebRequests。它是使用.NET4.6用C#编写的。我已将进程的初始化修改为设置:C#HttpWebRequest的日志安全协议,c#,httpwebrequest,tls1.2,.net-4.6,C#,Httpwebrequest,Tls1.2,.net 4.6,我有一个守护进程,它根据数据库中的信息发出出站WebRequests。它是使用.NET4.6用C#编写的。我已将进程的初始化修改为设置: System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls | SecurityProtocolType.Ssl3; 这一切都正常工作。现在我想添加一些日
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls | SecurityProtocolType.Ssl3;
这一切都正常工作。现在我想添加一些日志,看看我在出站连接上使用的各种安全协议。我在想,“建立tls 1.2连接到”
我的问题是在HttpWebRequest级别,我似乎无法获得有关SecurityProtocol的信息。我可以获得有关服务器证书的信息:
ServicePointManager.ServerCertificateValidationCallback += new RemoteCertificateValidationCallback(ValidateRemoteCertificate);
因此,检查证书时,我可以记录以下内容:
FriendlyName "sha256RSA" string
Value "1.2.840.113549.1.1.11” string //I do not believe this version number corresponds to the TLS version, I believe this is the version of the SHA256 encryption algorithm.
是否可以获取有关安全协议的信息?另外,是否可以访问HttpWebRequest中的底层SslStream对象?我用一个使用经过身份验证的https请求的程序进行了测试。我知道它使用TLS1.1。查看HttpWebRequest对象,我看到ProtocolVersion变量设置为1.1。您正在查找的信息可能存储在那里。我将使用TLS1.2和SSL 3进行测试以验证。编辑:我想我可能错了。这是HTTP协议版本。将深入挖掘。是的,它是http协议版本,而不是底层安全协议。