Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            var certs = CertificateFinder.GetCertificateLocations();

            certificate = CertificateSelecter.ShowSelectionDialog(certs, out string password);
            if (certificate == null)
            {
                MessageBox.Show("선택되지 않음", "오류", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            try
            {
                certificate.PrivateKeyInfo = CertificateLoader.DecryptPrivateKey(certificate, password);
            }
            catch (LibNPKI.Exceptions.IncorretPasswordException)
            {
                MessageBox.Show("잘못된 비밀번호입니다.", "오류", MessageBoxButtons.OK, MessageBoxIcon.Error);
                certificate = null;
                return;
            }
            groupBox1.Visible = true;
            groupBox1.Enabled = true;
        }