Esempio n. 1
0
        public Form1()
        {
            InitializeComponent();
            UInt32 ret = WysWrapper.doWysSequence(panel_wysView.Handle, getWysImageType());

            alertOnFailure(ret, WysWrapper.SAMPLE_CODE_SUCCESS, "WYS", "WYS operations failed");
        }
Esempio n. 2
0
        /// <summary>
        /// Performs initialization of the JHI/WYS libraries and renders
        /// the WYS image using the selected radio button as the image type.
        /// </summary>
        private void button_initAndRender_Click(object sender, EventArgs e)
        {
            //Grey out the GUI:



            UInt32 ret = WysWrapper.doWysSequence(panel_wysView.Handle, getWysImageType());

            alertOnFailure(ret, WysWrapper.SAMPLE_CODE_SUCCESS, "WYS", "WYS operations failed");
        }
Esempio n. 3
0
        /// <summary>
        /// Handles a "clear" request. The request will be passed on to the WYS library.
        /// Exact behavior depends on the selected WYS image type.
        /// </summary>
        private void button_clear_Click(object sender, EventArgs e)
        {
            if (getWysImageType() == WysWrapper.WYS_IMAGE_TYPE_CAPTCHA)
            {
                MessageBox.Show("This operation is not supported in CAPTCHA mode.");
            }
            else
            {
                bool   ret = WysWrapper.onClickClear();
                String msg;

                if (!ret)
                {
                    msg = "Success!";
                }
                else
                {
                    msg = "Failed!";
                }
                MessageBox.Show(msg);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Handles a "submit" request. The request will be passed on to the WYS library.
        /// Exact behavior depends on the selected WYS image type.
        /// </summary>
        private void button_submit_Click(object sender, EventArgs e)
        {
            bool ret;

            if (getWysImageType() == WysWrapper.WYS_IMAGE_TYPE_CAPTCHA)
            {
                // string userInput = textBox_captchaInput.Text;
                //UInt16 inputLength = (UInt16)userInput.Length;
                //To be called on "submit" events, when in CAPTCHA mode. The user's input is passed as parameter.

                ///ret = WysWrapper.onClickSubmit(userInput, inputLength);
            }
            else
            {
                //To be called on "submit" events. Not to be used in CAPTCHA mode.
                ret = WysWrapper.onClickSubmit(null, 0);
            }
            byte[] output = new byte[128];

            const int otpLength = 256;

            byte[] otpBytes = new byte[otpLength];
            IntPtr outArr   = Marshal.AllocHGlobal(otpLength);

            if (WysWrapper.getOtp(outArr, otpLength))
            {
                Marshal.Copy(outArr, otpBytes, 0, otpLength);
                Marshal.FreeHGlobal(outArr);
                string otp  = BitConverter.ToString(otpBytes).Replace("-", "");
                int    size = Gate.sendAndReciveFromDal("192.168.1.16", otpBytes, output);
                Gate.checkAndDoFromServer(output);
                string a = "";
                for (int i = 0; i < size; i++)
                {
                    a += output[i].ToString();
                }
                UInt32 ret1 = WysWrapper.doWysSequence(panel_wysView.Handle, getWysImageType());
                alertOnFailure(ret1, WysWrapper.SAMPLE_CODE_SUCCESS, "WYS", "WYS operations failed");

                // MessageBox.Show(a);
                //         MessageBox.Show(string.Format("Success! The generated OTP is: {0}", otp));
            }
            else
            {
                MessageBox.Show("Failed to verify user input.");
            }

//            radioButton_captcha.Visible = true;
//            radioButton_okButton.Visible = true;
//            radioButton_pinPad.Visible = true;
//            radioButton_pinPad.Checked = true;
//            textBox_captchaInput.Text = null;
//#if AMULET
//            radioButton_captcha.Enabled = true;
//            radioButton_okButton.Enabled = true;
//            radioButton_pinPad.Enabled = true;
//#else
//        radioButton_captcha.Enabled = false;
//            radioButton_okButton.Enabled = false;
//            radioButton_pinPad.Enabled = false;
//            button_clear.Enabled = false;
//            button_initAndRender.Enabled = false;
//            button_submit.Enabled = false;
//#endif
        }
Esempio n. 5
0
 /// <summary>
 /// Handles mouse-up events on the WYS image area.
 /// </summary>
 private void panel_wysView_MouseUp(object sender, MouseEventArgs e)
 {
     UInt16 x   = (UInt16)e.X;
     UInt16 y   = (UInt16)e.Y;
     bool   ret = WysWrapper.onMouseUp(x, y);
 }
Esempio n. 6
0
 /// <summary>
 /// Called when the form is closing. De-inits the libraries used.
 /// </summary>
 private void Form1_FormClosing(object sender, FormClosingEventArgs e)
 {
     Hide();
     WysWrapper.Close();
     Application.Exit();
 }