private void GetCertsFromServer(object sender, EventArgs e) { var asn1Cmd = Asn1Formatter.SetCommandAsn1((int)Cmd.certs); int.TryParse(textBox3.Text, out int port); handler = new ClientSocket(textBox2.Text, port); handler.Init(); handler.Send(asn1Cmd); data = handler.Recieve(); BERelement certsNames = BERelement.DecodePacket(data); CerificatesBox.DataSource = null; CerificatesBox.Items.Clear(); foreach (var cert in certsNames.Items) { CerificatesBox.Items.Add(Encoding.ASCII.GetString(cert.Value)); } CerificatesBox.SelectedIndex = 0; }