public void ParseTlsRecord(string filename) { var path = PacketProvider.GetFullPath(filename); var bytes = File.ReadAllBytes(path); var tlsPacket = new TlsPacket(new KaitaiStream(bytes)); switch (tlsPacket.Fragment) { case TlsPacket.TlsHandshake handshake: switch (handshake.Body) { case TlsPacket.TlsCertificate tlscert: var x509cert = new X509Certificate2(tlscert.Certificates.First().Body); break; } break; case TlsPacket.TlsClientHello clientHello: foreach (var suite in clientHello.CipherSuites.Items) { Console.WriteLine($"{(TlsCipherSuite)suite}"); } break; } }
public void ParseSslRecord(string filename) { var path = PacketProvider.GetFullPath(filename); var bytes = File.ReadAllBytes(path); var sslPacket = new SslPacket(new KaitaiStream(bytes)); switch (sslPacket.Record.Message) { case SslPacket.SslClientHello clientHello: foreach (var suite in clientHello.CipherSpecs.Entries) { var suiteNumber = (uint)EndianBitConverter.Big.ToUInt16(suite.CipherBytes, 1) + (suite.CipherBytes[0] << 16); var suiteName1 = (TlsCipherSuite)suiteNumber; } break; } }
public void ParseMqttMessage(string filename) { var path = PacketProvider.GetFullPath(filename); var bytes = File.ReadAllBytes(path); var tlsPacket = new MqttPacket(new KaitaiStream(bytes)); }