示例#1
0
        private void btnXem_Click(object sender, EventArgs e)
        {
            CaVO   ca = new CaVO(dgvThongtinCA.CurrentRow.Cells[0].Value.ToString(), connect.UserID, dgvThongtinCA.CurrentRow.Cells[4].Value.ToString(), dgvThongtinCA.CurrentRow.Cells[5].Value.ToString(), dgvThongtinCA.CurrentRow.Cells[6].Value.ToString(), dgvThongtinCA.CurrentRow.Cells[7].Value.ToString(), "", dgvThongtinCA.CurrentRow.Cells[9].Value.ToString());
            string kq = Lib.ca2string(ca);

            MessageBox.Show(kq);
        }
示例#2
0
文件: Lib.cs 项目: TuanKiet2309/bmtt
        public static string ca2string(CaVO ca)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("Certificate:\n");
            builder.Append("    Data:\n");
            builder.Append("        Version: ");
            builder.Append(ca.Version1);
            builder.Append('\n');
            builder.Append("        Serial Number: ");
            builder.Append(ca.SerialNumber1);
            builder.Append('\n');
            builder.Append("        Signature Algorithm: ");
            builder.Append(ca.SignatureAlgorithm1);
            builder.Append('\n');
            builder.Append("        Issuer Name: ");
            builder.Append(ca.IssuerName1);
            builder.Append('\n');
            builder.Append("        Validity:\n");
            builder.Append("            Not before:");
            builder.Append(ca.ValidityPeriod_before1);
            builder.Append('\n');
            builder.Append("            Not after :");
            builder.Append(ca.ValidityPeriod_after1);
            builder.Append('\n');
            builder.Append("        Subject: ");
            builder.Append(ca.SubjectName1);
            builder.Append('\n');
            builder.Append("        PublicKey: ");
            builder.Append(ca.PublicKey1);
            builder.Append('\n');
            builder.Append("        Extensions: ");
            builder.Append(ca.Extensions1);
            builder.Append('\n');
            builder.Append("    Signature Algorithm: ");
            builder.Append(ca.SignatureAlgorithm1);
            builder.Append('\n');
            builder.Append(ca.SignatureCA1);
            return(builder.ToString());
        }
示例#3
0
        private void btnLuu_Click(object sender, EventArgs e)
        {
            CaVO   ca  = new CaVO(dgvThongtinCA.CurrentRow.Cells[0].Value.ToString(), connect.UserID, dgvThongtinCA.CurrentRow.Cells[4].Value.ToString(), dgvThongtinCA.CurrentRow.Cells[5].Value.ToString(), dgvThongtinCA.CurrentRow.Cells[7].Value.ToString(), dgvThongtinCA.CurrentRow.Cells[8].Value.ToString(), "", dgvThongtinCA.CurrentRow.Cells[10].Value.ToString());
            string kq  = Lib.ca2string(ca);
            bool   bl1 = false;

            do
            {
                MessageBox.Show("Chọn nơi lưu file");
                string curentDirectory = System.IO.Directory.GetCurrentDirectory();
                string filter1         = "txt files (*.txt)|*.txt";
                string path            = Lib.SaveFile(curentDirectory, filter1);
                bl1 = Lib.WriteTextFile_CSymm4(path, kq);
                if (bl1)
                {
                    MessageBox.Show("Lưu thành công!");
                }
                else
                {
                    MessageBox.Show("Lưu thất bại!");
                }
            } while (!bl1);
        }