Ejemplo n.º 1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (Totp.CheckBase32(textBoxSecret.Text))
     {
         secret = textBoxSecret.Text;
         t1     = (int)numericUpDown2.Value;
         digit  = (int)numericUpDown1.Value;
         totp   = new Totp(secret, t1, digit);
         qrCodeImgControl.Text = "otpauth://totp/" + textBoxLable.Text + ":" + textBoxUser.Text + "?secret=" +
                                 textBoxSecret.Text + "&issuer=" + textBoxLable.Text;
         toolTip1.SetToolTip(qrCodeImgControl, qrCodeImgControl.Text);
     }
     else
     {
         MessageBox.Show("The secret is not Base32 encoded", "TOTP GUI", MessageBoxButtons.OK,
                         MessageBoxIcon.Error);
     }
 }