예제 #1
0
        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;
            }
        }
예제 #2
0
        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;
            }
        }
예제 #3
0
 public void ParseMqttMessage(string filename)
 {
     var path      = PacketProvider.GetFullPath(filename);
     var bytes     = File.ReadAllBytes(path);
     var tlsPacket = new MqttPacket(new KaitaiStream(bytes));
 }