Esempio n. 1
0
        public Form1()
        {
            InitializeComponent();
            var materialSkinManager = MaterialSkinManager.Instance;

            materialSkinManager.AddFormToManage(this);
            materialSkinManager.Theme       = MaterialSkinManager.Themes.LIGHT;
            materialSkinManager.ColorScheme = new ColorScheme(Primary.BlueGrey800, Primary.BlueGrey900, Primary.BlueGrey500, Accent.LightBlue200, TextShade.WHITE);
            CertManager = new CertManager();
        }
Esempio n. 2
0
 private void materialFlatButton1_Click(object sender, EventArgs e)
 {
     if (CheckFileExist())
     {
         try
         {
             var cert = CertManager.OpenCert(CertFile, Password);
             var hash = cert.GetCertHashString();
             MessageBox.Show($"密码正确,哈希为:{hash}");
         }
         catch (System.Security.Cryptography.CryptographicException ex)
         {
             errorProvider1.SetError(materialSingleLineTextField2, ex.Message);
         }
     }
 }
Esempio n. 3
0
        private void ImportCert()
        {
            if (CheckFileExist())
            {
                string hash = null;
                try
                {
                    var cert = CertManager.OpenCert(CertFile, Password);

                    hash = cert.GetCertHashString();
                    if (CertManager.Exist(cert))
                    {
                        //errorProvider1.SetError(materialRaisedButton1, "已经导入");

                        var choice = MessageBox.Show("已经存在该证书,是否重新导入\n选择是重新导入,选择否直接设置,选择取消终止操作", "证书已被导入", MessageBoxButtons.YesNoCancel);
                        if (choice == DialogResult.Cancel)
                        {
                            return;
                        }
                        if (choice == DialogResult.Yes)
                        {
                            CertManager.Remove(cert);
                            CertManager.ImportWithKey(cert);
                        }
                    }
                    else
                    {
                        CertManager.ImportWithKey(cert);
                    }


                    if (hash != null)
                    {
                        SetRdCertByHash(hash);
                    }
                }
                catch (Exception ex)
                {
                    errorProvider1.SetError(materialRaisedButton1, ex.Message);
                }
            }
        }
Esempio n. 4
0
 public List <CertInfo> GetData()
 {
     return(CertManager.GetMyCert());
 }