コード例 #1
0
        private void btnZtDataDecrypt_Click(object sender, EventArgs e)
        {
            string org = this.txtZtOrgData.Text.Trim();

            this.SetParam();
            if (org.Length == 0)
            {
                MessageBox.Show("源字符串的长度必须大于0!");
                this.txtZtOrgData.Focus();
                return;
            }
            if (org.Length % 16 != 0)
            {
                MessageBox.Show("源字符串的长度必须是16的倍数!");
                this.txtZtOrgData.Focus();
                return;
            }
            Zt598Importer.ZT_EPP_ActivWorkPin(this.ztMainId, this.ztWorkId);
            StringBuilder dest = new StringBuilder(255);
            int           ret  = Zt598Importer.ZT_EPP_PinUnAdd(this.ztPEAMode, 0, org, dest);

            this.lbZtHint.Text        = "解密数据返回code:" + ret;
            this.txtZtResultData.Text = dest.ToString();
            if (ret == 0)
            {
                this.txtZtResultData.Text = dest.ToString();
            }
        }
コード例 #2
0
        private void ZtPwdEncryptInput()
        {
            int           result = 0;
            StringBuilder msg    = new StringBuilder(32);

            while (AllowZtInput)
            {
                result = Zt598Importer.ZT_EPP_PinReportPressed(msg, 100);
                // this.txtZtUserPwd.Text += msg.ToString();
                if (result == 0)
                {
                    if (msg.ToString()[0] == 0x08)//更正8
                    {
                        this.txtZtUserPwd.Text = "";
                        this.txtZtUserPwdEncryptResult.Text = "";
                        this.pwdNowLen = 0;
                    }
                    else if (msg.ToString()[0] == 0x0D)//确认13
                    {
                        AllowZtInput = false;
                        if (ztPinMode == 0)
                        {
                            Zt598Importer.ZT_EPP_PinLoadCardNo(this.txtZtEncryptPan.Text);
                            Zt598Importer.ZT_EPP_ActivWorkPin(this.ztMainId, this.ztWorkId);
                            Zt598Importer.ZT_EPP_SetDesPara(0x04, 0x00);
                        }
                        Zt598Importer.ZT_EPP_PinReadPin(ztPinMode == 0 ? this.ztPEAMode : 0, msg);
                        this.txtZtUserPwdEncryptResult.Text = msg.ToString();
                    }
                    else if (msg.ToString()[0] == 0x1B)//取消27
                    {
                        AllowZtInput           = false;
                        this.txtZtUserPwd.Text = "";
                        this.txtZtUserPwdEncryptResult.Text = "";
                    }
                    else
                    {
                        this.txtZtUserPwd.Text += msg.ToString();
                        pwdNowLen++;
                        if (pwdNowLen == pwdLen)
                        {
                            AllowZtInput = false;
                            if (ztPinMode == 0)
                            {
                                Zt598Importer.ZT_EPP_PinLoadCardNo(this.txtZtEncryptPan.Text);
                                Zt598Importer.ZT_EPP_ActivWorkPin(this.ztMainId, this.ztWorkId);
                                Zt598Importer.ZT_EPP_SetDesPara(0x04, 0x00);
                            }
                            Zt598Importer.ZT_EPP_PinReadPin(ztPinMode == 0 ? this.ztPEAMode : 0, msg);
                            this.txtZtUserPwdEncryptResult.Text = msg.ToString();
                        }
                    }
                }
            }
        }
コード例 #3
0
        private void btnZtMAC_Click(object sender, EventArgs e)
        {
            string org = this.txtZtOrgData.Text.Trim();

            this.SetParam();
            Zt598Importer.ZT_EPP_ActivWorkPin(this.ztMainId, this.ztWorkId);
            StringBuilder dest = new StringBuilder(255);
            int           ret  = Zt598Importer.ZT_EPP_PinCalMAC(this.ztPEAMode, 1, org, dest);

            this.lbZtHint.Text = "MAC运算数据返回code:" + ret;
            if (ret == 0)
            {
                this.txtZtResultData.Text = dest.ToString();
            }
        }
コード例 #4
0
        private void btnZtInputUserPwd_Click(object sender, EventArgs e)
        {
            this.SetParam();
            this.txtZtUserPwd.Text = "";

            this.AllowZtInput = true;

            pwdLen    = Convert.ToInt32(this.txtZtEncryptLength.Text);
            pwdNowLen = 0;
            ztPinMode = this.rbZtFrontEncrypt.Checked ? 1 : 0;
            if (ztPinMode == 1)
            {
                Zt598Importer.ZT_EPP_PinLoadCardNo(this.txtZtEncryptPan.Text);
                Zt598Importer.ZT_EPP_ActivWorkPin(this.ztMainId, this.ztWorkId);
            }
            Zt598Importer.ZT_EPP_OpenKeyVoic(2);
            Zt598Importer.ZT_EPP_PinStartAdd(Convert.ToInt32(this.txtZtEncryptLength.Text), 1, ztPinMode, 0, this.ztTimeout);
            ThreadExecutor thread = new ThreadExecutor(ZtPwdEncryptInput);

            thread.BeginInvoke(null, null);
        }
コード例 #5
0
        private void btnZtGetEncryptData_Click(object sender, EventArgs e)
        {
            //int ret=0x08;//8
            // int ret2 = 0x0D;//13
            // int ret3 = 0x1B;//27
            // this.txtZtInputData.Text = ret.ToString()+"-"+ret2.ToString()+"-"+ret3.ToString();

            string org = this.txtZtUserPwdEncryptResult.Text.Trim();

            this.SetParam();

            Zt598Importer.ZT_EPP_ActivWorkPin(this.ztMainId, this.ztWorkId);
            StringBuilder dest = new StringBuilder(255);
            int           ret  = Zt598Importer.ZT_EPP_PinUnAdd(this.ztPEAMode, 0, org, dest);

            this.lbZtHint.Text = "解密数据返回code:" + ret;

            if (ret == 0)
            {
                this.txtZtUserPwdOrg.Text = dest.ToString().Substring(2).Replace("F", "");
            }
        }
コード例 #6
0
        private void btnZtActiveWorkKey_Click(object sender, EventArgs e)
        {
            int ret = Zt598Importer.ZT_EPP_ActivWorkPin(Convert.ToInt32(this.txtZtActiveWorkKeyMasterKeyIndex.Text), Convert.ToInt32(this.txtZtActiveWorkKeyWorkKeyIndex.Text));

            this.lbZtHint.Text = "激活工作密钥返回code:" + ret;
        }