C# 检测https流量,然后通过sslstream进行握手
我有一个函数,通过从流中读取一些字节来检测Ssl流量:C# 检测https流量,然后通过sslstream进行握手,c#,.net,ssl,C#,.net,Ssl,我有一个函数,通过从流中读取一些字节来检测Ssl流量: private bool IsSslContent(Stream stream) { var firstLineBytes = new byte[1]; firstLineBytes = stream.ReadByte(); if (firstLineBytes != null) { if ((firstLineBytes[0] == 0x80)
private bool IsSslContent(Stream stream)
{
var firstLineBytes = new byte[1];
firstLineBytes = stream.ReadByte();
if (firstLineBytes != null)
{
if ((firstLineBytes[0] == 0x80)||(firstLineBytes[0] == 0x16))
{
return true;
}
}
return false;
}
如果是ssl,那么我们必须进行握手,但是如果没有这个字节,握手就不会发生
如何解决这个问题?问题是什么?如何检测SSL连接或如何实现握手?如何检测SSL流量,然后使用.net中的sslstream类成功握手。