/// <summary> /// 返回狗状态 /// </summary> //public static bool GetBogState() //{ // //if (Util.GetNow() < Convert.ToDateTime("2017-01-01")) return true; // if (CommonValue.WorkStation.Equals("XIAO") && CommonValue.CpuID.Equals("BFEBFBFF000306A9")) return true; // try // { // GetBogID(); // //foreach (string key in CommonValue.DogList) // //{ // // string[] str = key.Split('_'); // // if (CommonValue.CpuID.Equals(str[1]) && CommonValue.DogID.Equals(str[0])) return true; // //} // //WXDMessageBox.Show("没有检测到可用的加密狗"); // //return false; // return (CommonValue.DogID != ""); // } // catch (Exception) // { // return false; // } //} public static bool GetBogID(out string dogId) { dogId = string.Empty; byte[] buffer = new byte[1000]; ushort handle = 0; ushort function = 0; ushort p1 = 0x70ef; ushort p2 = 0x738c; ushort p3 = 0; ushort p4 = 0; uint lp1 = 0; uint lp2 = 0; Rockey4ND R4nd = new Rockey4ND(); R4nd.Rockey(function, ref handle, ref lp1, ref lp2, ref p1, ref p2, ref p3, ref p4, buffer); ushort ret = R4nd.Rockey((ushort)Ry4Cmd.RY_FIND, ref handle, ref lp1, ref lp2, ref p1, ref p2, ref p3, ref p4, buffer); if (lp1 < 1) { return(false); } else { dogId = lp1.ToString(); return(true); } }
public static void GetBogID() { byte[] buffer = new byte[1000]; ushort handle = 0; ushort function = 0; ushort p1 = 0x70ef; ushort p2 = 0x738c; ushort p3 = 0; ushort p4 = 0; uint lp1 = 0; uint lp2 = 0; Rockey4ND R4nd = new Rockey4ND(); R4nd.Rockey(function, ref handle, ref lp1, ref lp2, ref p1, ref p2, ref p3, ref p4, buffer); ushort ret = R4nd.Rockey((ushort)Ry4Cmd.RY_FIND, ref handle, ref lp1, ref lp2, ref p1, ref p2, ref p3, ref p4, buffer); if (lp1 < 1) { CommonValue.DogID = ""; } else { CommonValue.DogID = lp1.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { if (!X.IsAjaxRequest) { GetBrandName(); GridPanelBind(); string License = ConfigurationManager.AppSettings["1PageCount"].ToString(); Rockey4ND rockey = new Rockey4ND(); if (License.Length < 32) // keypro { string hid = rockey.open(); } string sSQL = "SELECT genst_desc FROM general_setup WHERE genst_ctg='License' AND genst_code='Plate'"; DataTable dt = db.Query(sSQL); if (dt.Rows.Count > 0) { JiaMiJieMi aeskey = new JiaMiJieMi(); Authorize.Text = aeskey.AES_Decrypt(aeskey.Base64Decrypt(dt.Rows[0]["genst_desc"].ToString().Substring(32, 32))); } if (License.Length < 32) // keypro { rockey.close(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!X.IsAjaxRequest) { if (Session["USER_ID"] == null) { X.Redirect("login.aspx"); } else { Rockey4ND rockey = new Rockey4ND(); string hid = rockey.open(); string keystr = rockey.ReadKey(); string sSQL = "SELECT genst_desc FROM general_setup WHERE genst_ctg='License' AND genst_code='Plate'"; DataTable dt = db.Query(sSQL); if (dt.Rows.Count > 0) { Keyid.Text = aeskey.AES_Decrypt(aeskey.Base64Decrypt(dt.Rows[0]["genst_desc"].ToString().Substring(0, 32))); Bedno.Text = aeskey.AES_Decrypt(aeskey.Base64Decrypt(dt.Rows[0]["genst_desc"].ToString().Substring(32, 32))); window1.Title = hid; } try { New_Keyid.Text = aeskey.AES_Decrypt(aeskey.Base64Decrypt(keystr.Substring(0, 32))); New_Bedno.Text = aeskey.AES_Decrypt(aeskey.Base64Decrypt(keystr.Substring(32, 32))); } catch (Exception ex) { Common._ErrorMsgShow(ex.Message.ToString()); } rockey.close(); } } }
protected void BtnNewKey_Click(object sender, DirectEventArgs e) { Rockey4ND rockey = new Rockey4ND(); string hid = rockey.open(); string hidencode = aeskey.Base64Encrypt(aeskey.AES_Encrypt(New_Keyid.Text)); string bedencode = aeskey.Base64Encrypt(aeskey.AES_Encrypt(New_Bedno.Text)); rockey.WriteKey(hidencode + bedencode); rockey.close(); Common._NotificationShow("Write Successed for New Key..."); }
protected void Page_Load(object sender, EventArgs e) { if (!X.IsAjaxRequest) { Rockey4ND rockey = new Rockey4ND(); hid = rockey.open(); if (hid != "") { Window1.Title = "登入窗口: " + hid; Window1.Show(); txtUsername.Focus(true, 100); } } }
protected void BtnOK_Click(object sender, DirectEventArgs e) { Rockey4ND rockey = new Rockey4ND(); string hid = rockey.open(); string hidencode = aeskey.Base64Encrypt(aeskey.AES_Encrypt(Keyid.Text)); string bedencode = aeskey.Base64Encrypt(aeskey.AES_Encrypt(Bedno.Text)); rockey.WriteKey(hidencode + bedencode); rockey.close(); string sSQL = "UPDATE general_setup SET genst_desc='" + hidencode + bedencode + "' "; sSQL += "WHERE genst_ctg='License' AND genst_code='Plate'"; db.Excute(sSQL); Common._NotificationShow("Update Successed..."); }
protected void BtnRead_Click(object sender, DirectEventArgs e) { Rockey4ND rockey = new Rockey4ND(); string hid = rockey.open(); string keystr = rockey.ReadKey(); try { New_Keyid.Text = aeskey.AES_Decrypt(aeskey.Base64Decrypt(keystr.Substring(0, 32))); New_Bedno.Text = aeskey.AES_Decrypt(aeskey.Base64Decrypt(keystr.Substring(32, 32))); } catch (Exception ex) { Common._ErrorMsgShow(ex.Message.ToString()); } rockey.close(); }
public static ushort Write(int index) { byte[] buffer = new byte[10]; buffer = System.BitConverter.GetBytes(index); ushort handle = 0; ushort p1 = 0; ushort p2 = 10; ushort p3 = 0; ushort p4 = 0; uint lp1 = 0; uint lp2 = 0; Rockey4ND R4nd = new Rockey4ND(); //R4nd.Rockey(0, ref handle, ref lp1, ref lp2, ref p1, ref p2, ref p3, ref p4, buffer); ushort ret = R4nd.Rockey((ushort)Ry4Cmd.RY_WRITE, ref handle, ref lp1, ref lp2, ref p1, ref p2, ref p3, ref p4, buffer); return(ret); }
protected void Page_Load(object sender, EventArgs e) { if (!X.IsAjaxRequest) { JiaMiJieMi aeskey = new JiaMiJieMi(); string plocal = ""; if (License.Length < 32) // keypro { Rockey4ND rockey = new Rockey4ND(); hid = rockey.open(); if (hid != "") { string sSQL = "SELECT genst_desc FROM general_setup WHERE genst_ctg='License' AND genst_code='Plate'"; DataTable dt = db.Query(sSQL); if (dt.Rows.Count > 0) { plocal = dt.Rows[0]["genst_desc"].ToString(); } if (rockey.verify(hid, plocal)) { string totalbed = aeskey.AES_Decrypt(aeskey.Base64Decrypt(plocal.Substring(32, 32))); Window1.Title = "登入窗口: " + hid + "-" + totalbed; Window1.Show(); } else { Common._ErrorMsgShow("USB授权钥匙,认证编号不符合!"); } } else { Window1.Hide(); } rockey.close(); } else // softkey { try { //RegistryKey regkey = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Datacom\Product\DCS42"); //string[] n = regkey.GetValueNames(); //string hid = regkey.GetValue(n[0]).ToString(); string hid = License; if (hid.Length == 32) { hid = aeskey.AES_Decrypt(aeskey.Base64Decrypt(hid)); if (hid != "") { string sSQL = "SELECT genst_desc FROM general_setup WHERE genst_ctg='License' AND genst_code='Plate'"; DataTable dt = db.Query(sSQL); if (dt.Rows.Count > 0) { plocal = dt.Rows[0]["genst_desc"].ToString(); } string sid = aeskey.AES_Decrypt(aeskey.Base64Decrypt(plocal.Substring(0, 32))); if (hid == sid) { string totalbed = aeskey.AES_Decrypt(aeskey.Base64Decrypt(plocal.Substring(32, 32))); Window1.Title = "登入窗口: " + hid + "-" + totalbed; Window1.Show(); } else { Common._ErrorMsgShow("授权钥匙,认证编号不符合!"); } } else { Window1.Hide(); } } else { Common._ErrorMsgShow("授权钥匙,认证编号不符合!"); Window1.Hide(); } } catch (Exception ex) { Common._ErrorMsgShow(ex.Message.ToString()); } } if (!string.IsNullOrEmpty(Request.QueryString["url"])) { txtUrl.Text = Request.QueryString["url"]; } txtUsername.Focus(true, 100); } }