需要在C#代码中设置密码套件 [英] Need to set cipher suite at the code in C#

查看:438
本文介绍了需要在C#代码中设置密码套件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi Team,

         每当我进行TLS / SSL调用时,我都试图用C#代码强制执行一些首选的密码套件。但是C#中没有能力在C#代码中设置密码套件列表。但是对于java和C ++,可以选择在代码中强制执行
密码套件列表。

          I am trying to enforce some preferred cipher suite, in C# code whenever i make TLS/SSL call. But there is no capability in C# to set the list of cipher suite in the C# code. But for java and C++ have option to enforce list of cipher suite in the code.

java中的示例:

我期待C#代码中类似的设置密码套件。但是,microsoft建议的选项是在注册表级别进行更改,例如使用PowerShell脚本禁用不需要的密码套件。但是这会影响在同一台机器上运行的其他应用程序

I am expecting the similar kind of setting cipher suites in the C# code. But there is option suggested by microsoft is to change at the registry level, like disabling the unwanted cipher suites using powershell scripts. But this will affect the other application running in the same machine.

您能告诉我是否可以选择在C#代码中设置密码套件列表

Could you please let me know is there option to set list of cipher suites in C# code

推荐答案

内置类  HttpWebRequest和sort都使用Windows本机SChannel来实现SSL加密,因此没有编程方式来控制密码套件列表。

The build-in classes HttpWebRequest and the sort all uses Windows native SChannel to implement SSL encryption, therefore has no programmatic way to control the cipher suite list.

然而,没有什么可以阻止您使用 Bouncy Castle
OpenSSL  带有包装器,就像在Java / C ++中一样。

However nothing stops you from using Bouncy Castle or OpenSSL with a wrapper as you would in Java/C++.

可以找到基于BC的示例
here

BC based example can be found here.


这篇关于需要在C#代码中设置密码套件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆