.NET's SslStream is always negotiating to the least secure cipher I have. How can I change this?

不羁的心 提交于 2019-12-05 10:49:14

You can select which protocols are available for selection by making some simple registry changes. We remove the ability to select RC4, for example. You only need to make the change at one end of the connection (eg server) because the client and server negotiate to find commonly supported algorithm

http://msdn.microsoft.com/en-us/library/ms925716.aspx

Best wishes James

SSLStream uses Schannel that is supplied with the operating system. The suites are listed in the default order in which they are chosen by the Microsoft Schannel Provider for :

Windows Vista:

RSA WITH AES_128 CBC SHA
RSA WITH AES_256 CBC SHA
RSA WITH RC4_128 SHA

...

Windows XP:

RSA WITH RC4 128 MD5
RSA WITH RC4 128 SHA

RSA WITH 3DES CBC SHA

....

You can also modify the list of cipher suites by configuring the SSL Cipher Suite Order group policy settings using the Group Policy Object snap-in in Microsoft Management Console (Windows Vista)

But the issue is that Windows XP doesn't include AES in the list of ciphers available for SSLStream. However, it's possible to change Registry settings in Windows XP: HKLM\System\CurrentControlSet\Control\Lsa\FIPSAlgorithmPolicy 1 for getting 3DES cipher.

It should be using the most secure set of algorithms that were in both lists. I find it hard to believe that it isn't, because SslStream is wrapping the SChannel SSPI, and if that were broken then Internet Explorer, IIS and everything else on Windows would be broken too.

It could be that you have an outdated version of SChannel.dll/Secur32.dll. What OS and Internet Explorer version do you have installed?

It is possible to disable protocols in SCHANNEL. Could you check that this hasn't been done?

I'm using XP SP3 and IE7 with all updates. The registry seems configured with everything enabled.

In Java you can order the various algorithms/ciphers according to your needs and preferences. May be there is a similar API in .NET...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!