Пример #1
0
 public TlsConversationModelBuilder(TlsConversationContext modelContext)
 {
     m_conversationModel = new TlsConversationModel
     {
         Records = new List <TlsRecordModel>()
     };
     modelContext.Add(m_conversationModel);
     m_modelContext = modelContext;
 }
Пример #2
0
        public void SetServerCertificate(TlsPacket.TlsCertificate certificate, TlsPacketContext packetContext)
        {
            TlsCertificateModel CreateCertificate(X509Certificate2 cert)
            {
                var newCertificateModel = new TlsCertificateModel
                {
                    SubjectName = cert.SubjectName.Name,
                    IssuerName  = cert.IssuerName.Name,
                    NotBefore   = cert.NotBefore,
                    NotAfter    = cert.NotAfter
                };

                m_modelContext.Add(newCertificateModel);
                return(newCertificateModel);
            }

            var x509Certificates = certificate.Certificates.Select(x => new X509Certificate2(x.Body));

            m_conversationModel.ServerCertificates = x509Certificates.Select(CreateCertificate).ToList();
        }