示例#1
0
 private void button1_Click_1(object sender, EventArgs e)
 {
     string pubKey=MerMail.Asymmetric.generateKeys(Convert.ToInt16(bytestrengthNum.Value));
     if (pubKey != null)
     {
         bool succes = true;
         try
         {
             public_key = MerMail.Asymmetric.parseKeyXML(System.IO.File.OpenText(pubKey).ReadToEnd());
         }
         catch (Exception err)
         {
             succes = false;
         }
         if (succes)
         {
             asymKeyFilename.Text = new System.IO.FileInfo(pubKey).Name;
             validAsymmetric = true;
         }
         else
         {
             validAsymmetric = false;
         }
     }
     updateControls();
 }
示例#2
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            string pubKey = MerMail.Asymmetric.generateKeys(Convert.ToInt16(bytestrengthNum.Value));

            if (pubKey != null)
            {
                bool succes = true;
                try
                {
                    public_key = MerMail.Asymmetric.parseKeyXML(System.IO.File.OpenText(pubKey).ReadToEnd());
                }
                catch (Exception err)
                {
                    succes = false;
                }
                if (succes)
                {
                    asymKeyFilename.Text = new System.IO.FileInfo(pubKey).Name;
                    validAsymmetric      = true;
                }
                else
                {
                    validAsymmetric = false;
                }
            }
            updateControls();
        }
示例#3
0
 private void loadAsymmetricFromFileBtn_Click(object sender, EventArgs e)
 {
     asymmetricFileRadio.Checked = true;
     MerMail.Program.MFile file = MerMail.Program.openFile("publickey.pke", "Open public key", "Private key (*.pke)", "*.pke");
     if (file.valid)
     {
         bool succes = true;
         try
         {
             public_key = MerMail.Asymmetric.parseKeyXML(file.data);
         }
         catch (Exception err)
         {
             succes = false;
         }
         if (succes)
         {
             asymKeyFilename.Text = file.filename;
             validAsymmetric      = true;
         }
         else
         {
             validAsymmetric = false;
         }
     }
     else
     {
         validAsymmetric = false;
     }
     updateControls();
 }
示例#4
0
 private void loadAsymmetricFromFileBtn_Click(object sender, EventArgs e)
 {
     asymmetricFileRadio.Checked = true;
     MerMail.Program.MFile file = MerMail.Program.openFile("publickey.pke", "Open public key", "Private key (*.pke)", "*.pke");
     if (file.valid)
     {
         bool succes = true;
         try
         {
             public_key = MerMail.Asymmetric.parseKeyXML(file.data);
         }
         catch (Exception err)
         {
             succes = false;
         }
         if (succes)
         {
             asymKeyFilename.Text = file.filename;
             validAsymmetric = true;
         }
         else
         {
             validAsymmetric = false;
         }
     }
     else
     {
         validAsymmetric = false;
     }
     updateControls();
 }