如何使用C#.net在Windows服务中实现TLS [英] How to implement TLS in windows services using C#.net

查看:463
本文介绍了如何使用C#.net在Windows服务中实现TLS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



可以任何人给我一个解决方案,如何使用C#.net通过套接字通信使用CLS提供Windows服务的安全性,而不是SSL。



如果有人在Windows服务中通过套接字知道MLLP并通过示例分享细节。





提前致谢



Guru

Hi All,

Could any one give me a solution on this,how to provide security in windows services using C#.net with TLS via socket communicaiton, instead of SSL.

If anyone knows about MLLP via socket in windows services and share the details with examples.


Thanks in advance

Guru

推荐答案

检查 MSDN上的SslProtocols [ ^ ]。文档末尾有一个例子。
Check SslProtocols on MSDN[^]. There is an example at the end of the document.


大家好



感谢您的支持,通过使用解决了我的自我TLS1.2。



首先在MMC中注册证书。



var fileName = ConfigurationSettings.AppSettings [证书];

var password = ConfigurationSettings.AppSettings [密码];

certificate = new X509Certificate2(strCertificateFile,密码);



sslStream = new SslStream(client.GetStream(),false);

尝试

{

sslStream.AuthenticateAsServer(证书) ,false,SslProtocols.Tls12,true);

}

catch(AuthenticationException e)

{

}



if(sslStream.IsAuthenticated)

{}
Hi All

Thank you for support, resolved my self by using TLS1.2.

First Register the Certificate in MMC.

var fileName = ConfigurationSettings.AppSettings[certificate];
var password = ConfigurationSettings.AppSettings[password];
certificate = new X509Certificate2(strCertificateFile, password);

sslStream = new SslStream(client.GetStream(), false);
try
{
sslStream.AuthenticateAsServer(certificate, false, SslProtocols.Tls12, true);
}
catch (AuthenticationException e)
{
}

if (sslStream.IsAuthenticated)
{}


这篇关于如何使用C#.net在Windows服务中实现TLS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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