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

            alertOnFailure(ret, WysWrapper.SAMPLE_CODE_SUCCESS, "WYS", "WYS operations failed");
        }
Beispiel #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");
        }
Beispiel #3
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
        }