Пример #1
0
        private void BtnCreateUserRootKey_Click(object sender, EventArgs e)
        {
            int selected = this.Dongles.SelectedIndex;

            byte[] userRootKey = HexString.FromHexString(this.UserRootKey.Text.Trim(), "-");
            String userId      = this.UserID.Text.Trim();

            DongleUserInfo keyInfo = DongleUserInfo.CreateTestDongleKeyInfo(DongleType.USER_ROOT, userId);

            ResultArgs arg = this.dongle.CreateUserRootDongle(userId, userRootKey, keyInfo);

            if (arg.Succ)
            {
                this.TraceMsg.Trace(String.Format("Create user root key ok! "), true);
                UserRootDongleResult res = (UserRootDongleResult)arg.Result;

                this.TraceMsg.Trace(res.ToString());
                logger.Debug(res.ToString());
            }
            else
            {
                this.TraceMsg.Trace(String.Format("Create user root key Error! err msg = {0}", this.dongle.LastErrorMessage), true);
            }

            // refresh dongle
            RefreshDongle(false);
        }
Пример #2
0
        private void BtnConvert2Json_Click(object sender, EventArgs e)
        {
            DongleUserInfo keyInfo = DongleUserInfo.CreateTestDongleKeyInfo(DongleType.USER_ROOT, "01234567");

            String jsonData = JsonConvert.SerializeObject(keyInfo);

            this.Trace.Trace(jsonData, true);
        }
Пример #3
0
        private void BtnCreateAuthenKey_Click(object sender, EventArgs e)
        {
            int    selected = this.Dongles.SelectedIndex;
            String userId   = this.UserID.Text.Trim();

            DongleUserInfo keyInfo = DongleUserInfo.CreateTestDongleKeyInfo(DongleType.AUTHEN, userId);
            ResultArgs     arg     = this.dongle.CreateAppAuthenDongle(userId, keyInfo);

            if (arg.Succ)
            {
                this.TraceMsg.Trace(String.Format("Create Authen key ok! "), true);
                AppAuthenDongleResult res = (AppAuthenDongleResult)arg.Result;

                this.TraceMsg.Trace(res.ToString());
                logger.Debug(res.ToString());
            }
            else
            {
                this.TraceMsg.Trace(String.Format("Create Authen key Error! err msg = {0}", this.dongle.LastErrorMessage), true);
            }

            // refresh dongle
            RefreshDongle(false);
        }