示例#1
0
        private bool KeyRecovery_func()
        {
            string certname = "";
            string pass     = "";
            bool   result   = false;


            certname = Path.GetFullPath(p12TextBox.Text);

            if (!File.Exists(certname))
            {
                MessageBox.Show(TrayApp.Properties.Resources.secretPathInvalid, TrayApp.Properties.Resources.resetPassphraseError, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            pass = passwdDomainTextBox.Text;

            X509Certificate2 xcert;

            try
            {
                xcert = new X509Certificate2(certname, pass);

                Inner_keyRecovery inner = new Inner_keyRecovery();
                inner.ProcessInputKeyFile(this.inputFilePath, this.outputFilePath, pass, xcert, false, null);
                result = true;
            }

            catch (Exception e)
            {
                log.Info("Message {0}, type {1}, trace {2} ", e.Message, e.GetType(), e.StackTrace);
                MessageBox.Show(TrayApp.Properties.Resources.importErrorMesg, TrayApp.Properties.Resources.resetPassphraseError, MessageBoxButtons.OK, MessageBoxIcon.Error);
                result = false;
            }


            return(result);
        }
示例#2
0
 private bool KeyRecovery_func()
 {
     string certname = "";
     string pass = "";
     bool result = false;
     certname = Path.GetFullPath(p12TextBox.Text);
     if (!File.Exists(certname))
     {
         MessageBox.Show(TrayApp.Properties.Resources.secretPathInvalid,TrayApp.Properties.Resources.resetPassphraseError,MessageBoxButtons.OK,MessageBoxIcon.Error);
         return false;
     }
     pass = passwdDomainTextBox.Text;
     X509Certificate2 xcert;
     try
     {
         xcert = new X509Certificate2(certname, pass);
         Inner_keyRecovery inner = new Inner_keyRecovery();
         inner.ProcessInputKeyFile(this.inputFilePath, this.outputFilePath, pass, xcert, false, null);
         result = true;
     }
     catch(Exception e)
     {
         log.Info("Message {0}, type {1}, trace {2} ", e.Message, e.GetType(), e.StackTrace);
         MessageBox.Show(TrayApp.Properties.Resources.importErrorMesg, TrayApp.Properties.Resources.resetPassphraseError, MessageBoxButtons.OK, MessageBoxIcon.Error);
        result = false;
     }
     return result;
 }
示例#3
0
 private bool KeyRecovery_func()
 {
     string certname = "";
     string pass = "";
     certname = Path.GetFullPath(p12TextBox.Text);
     if ((!File.Exists(certname)) || (!certname.EndsWith(".p12")))
     {
         MessageBox.Show("Private key path invalid");
         return false;
     }
     pass = passwdDomainTextBox.Text;
     X509Certificate2 xcert;
     try
     {
         if (pass.Length > 0)
             xcert = new X509Certificate2(certname, pass);
         else
             throw new ArgumentNullException("pass");
         Inner_keyRecovery inner = new Inner_keyRecovery();
         bool flag = false;
         inner.ProcessInputKeyFile(this.inputFilePath, this.outputFilePath, pass, xcert, flag, null);
     }
     catch
     {
     }
     return true;
 }
示例#4
0
 private bool KeyRecovery_func()
 {
     string certname = "";
     string pass = "";
     bool result = false;
     certname = Path.GetFullPath(p12TextBox.Text);
     if ((!File.Exists(certname)) || (!certname.EndsWith(".p12")))
     {
         MessageBox.Show(TrayApp.Properties.Resources.secretPathInvalid,TrayApp.Properties.Resources.resetPassphraseError,MessageBoxButtons.OK,MessageBoxIcon.Error);
         return false;
     }
     pass = passwdDomainTextBox.Text;
     X509Certificate2 xcert;
     try
     {
         xcert = new X509Certificate2(certname, pass);
         Inner_keyRecovery inner = new Inner_keyRecovery();
         inner.ProcessInputKeyFile(this.inputFilePath, this.outputFilePath, pass, xcert, false, null);
         result = true;
     }
     catch
     {
         MessageBox.Show(TrayApp.Properties.Resources.importErrorMesg, TrayApp.Properties.Resources.resetPassphraseError, MessageBoxButtons.OK, MessageBoxIcon.Error);
         return false;
     }
     return result;
 }