網路城邦
上一篇 回創作列表 下一篇   字體:
Windows 10 App follows TLS1.2
2016/02/13 15:49:11瀏覽279|回應0|推薦3

My Windows 10 App have to log into a TLS1.2 protected server within my LAN. I have to use a StreamSocket class to accept a private IP as the SERVERNAME. But I have a "real" CA on the server already and I don't want that pop-up dialogue box shows up (because I must accept the private IP as the server name which is differs from the certificate authorized). For example, I have to accept "https://192.168.0.101" rather than "https://someone.somewhere" ....


so here is the solution:

using (StreamSocket socket = new StreamSocket())
{
.....
socket.Control.IgnorableServerCertificateErrors.Clear();
socket.Control.IgnorableServerCertificateErrors..Add(ChainValidationResult.InvalidName);
..........

And I verified the subject of the server's certificated to see whether my App connected to the right server. If so, go on to to it's job otherwise just drop the connection.


https://plus.google.com/u/0/communities/110758963058461649351


( 知識學習科學百科 )
回應 推薦文章 列印 加入我的文摘
上一篇 回創作列表 下一篇

引用
引用網址:https://classic-blog.udn.com/article/trackback.jsp?uid=wisejet&aid=46705360