public void changePass(string strNewPass) { Byte[] keya = new Byte[6] { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe }; Byte[] ctrlbyte = new Byte[4] { 0xff, 0x7, 0x80, 0x69 }; Byte[] keyb = new Byte[6] { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe }; Byte[] bNewPassHex = passToHex(strNewPass); int sauth = E7Lib.fw_authentication(iDevice, 0, sectorNumber); //fw_change3 int state = E7Lib.fw_changeb3(iDevice, sectorNumber, ref keya[0], ref ctrlbyte[0], 0, ref keyb[0]); }
public bool validatePass(string cardPass) { Byte[] keya = new Byte[6] { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe }; string stNewPassHex = StrToHex(cardPass).Replace(" ", ""); Byte[] pass = passToHex(cardPass); int iLoad = E7Lib.fw_load_key(iDevice, 0, sectorNumber, ref keya[0]); int iResult = E7Lib.fw_authentication(iDevice, 0, sectorNumber); if (0 == iResult) { return(true); } return(false); }
public string readCardID() { uint icard = 0; int result = E7Lib.fw_card(iDevice, 1, ref icard); Byte[] pass = new Byte[6] { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; int iLoad = E7Lib.fw_load_key(iDevice, 0, sectorNumber, ref pass[0]); int ipass = E7Lib.fw_authentication(iDevice, 0, sectorNumber); if (0 == result) { return(icard.ToString()); } else { return(""); } }
public string readCard() { StringBuilder str = new StringBuilder(); int au = E7Lib.fw_authentication(iDevice, 0, sectorNumber); int result = E7Lib.fw_read_hex(iDevice, sectorNumber * 4, str); if (str.Length > 32) { str = str.Remove(32, 1); } if (0 == result) { return(HexToStr(str.ToString())); } else { return(""); } }
public string openDevice() { try { Int32 tmphdev = 0; Int32[] devs = new Int32[100]; int i = 0; do { tmphdev = E7Lib.fw_init(100, 0); if (tmphdev > 0) { devs[i] = tmphdev; } else { //TODO:写入程序通知,让用户插入设备 //等待设备 1*100秒 Thread.Sleep(100); } i++; }while (i < 25 && tmphdev < 0); iDevice = devs[i - 1]; //打开LCD setLCDBright(true); //配置卡类型 int state = E7Lib.fw_config_card(iDevice, 0x41); int stateAuth = E7Lib.fw_authentication(iDevice, 0, sectorNumber); //E7Lib.fw_beep(iDevice, 10); return(iDevice.ToString()); } catch (Exception ex) { return(ex.Message); } }