예제 #1
0
        // Token: 0x06000183 RID: 387 RVA: 0x00005BD8 File Offset: 0x00003DD8
        private bool isEncryptCard()
        {
            byte[] array = new byte[4];
            int    num   = 0;

            if (!RDIC100Reader.ATA_Access(0, 0, this.ADDR))
            {
                return(false);
            }
            RDIC100Reader.ATA_ReadCardRF32(array, ref num, this.ADDR);
            if (array[0] == 0 && array[1] == 8 && array[2] == 128 && array[3] == 232)
            {
                return(false);
            }
            this.pwd = base.getPassword(false);
            if (this.pwd == null)
            {
                return(false);
            }
            if (!RDIC100Reader.ATA_AccessPWD(0, 0, this.pwd, this.ADDR))
            {
                return(false);
            }
            RDIC100Reader.ATA_ReadCardRF32(array, ref num, this.ADDR);
            return(array[0] == 0 && array[1] == 8 && array[2] == 128 && array[3] == 56);
        }
예제 #2
0
        // Token: 0x06000181 RID: 385 RVA: 0x00005A38 File Offset: 0x00003C38
        public override int clearAllData(bool beep, bool initialize)
        {
            if (!this.checkDevice(true))
            {
                return(-2);
            }
            this.pwd = base.getPassword(beep);
            if (this.pwd == null)
            {
                return(-1);
            }
            byte[] data_card = new byte[28];
            int    num       = 0;

            if (!this.isEncryptCard())
            {
                return(0);
            }
            if (!RDIC100Reader.ATA_AccessPWD(0, 1, this.pwd, this.ADDR))
            {
                return(-1);
            }
            int num2 = RDIC100Reader.ATA_ReadCardRF32(data_card, ref num, this.ADDR);

            if (num2 != 1)
            {
                return(-1);
            }
            if (!RDIC100Reader.ATA_ProteWrite(0, 0, 0, new byte[]
            {
                0,
                8,
                128,
                232
            }, this.pwd, this.ADDR))
            {
                return(-1);
            }
            RDIC100Reader.ATA_StandWrite(0, 1, 0, new byte[4], this.ADDR);
            RDIC100Reader.ATA_StandWrite(0, 2, 0, new byte[4], this.ADDR);
            RDIC100Reader.ATA_StandWrite(0, 3, 0, new byte[4], this.ADDR);
            RDIC100Reader.ATA_StandWrite(0, 4, 0, new byte[4], this.ADDR);
            RDIC100Reader.ATA_StandWrite(0, 5, 0, new byte[4], this.ADDR);
            RDIC100Reader.ATA_StandWrite(0, 6, 0, new byte[4], this.ADDR);
            RDIC100Reader.ATA_StandWrite(0, 7, 0, new byte[4], this.ADDR);
            if (!this.isEncryptCard())
            {
                if (beep)
                {
                    RDIC100Reader.gSetBeep(100, this.ADDR);
                }
                if (initialize)
                {
                    this.initializeCard();
                }
                return(0);
            }
            WMMessageBox.Show(this.owner, "清除数据失败,请手工清除!");
            return(-1);
        }
예제 #3
0
        // Token: 0x0600017E RID: 382 RVA: 0x00005870 File Offset: 0x00003A70
        public override int isValidCard(bool silent)
        {
            if (!this.checkDevice(true))
            {
                return(-2);
            }
            this.pwd = base.getPassword(silent);
            if (this.pwd == null)
            {
                return(-1);
            }
            byte[] array = new byte[28];
            int    num   = 0;

            if (!this.isEncryptCard())
            {
                return(1);
            }
            bool flag = RDIC100Reader.ATA_AccessPWD(0, 0, this.pwd, this.ADDR);

            if (flag)
            {
                int num2 = RDIC100Reader.ATA_ReadCardRF32(array, ref num, this.ADDR);
                if (num2 == 1)
                {
                    if (array[0] == 0 && array[1] == 8 && array[2] == 128 && array[3] == 56)
                    {
                        return(2);
                    }
                    return(-1);
                }
                else if (num2 == 3)
                {
                    return(-2);
                }
            }
            return(-1);
        }
예제 #4
0
        // Token: 0x0600017C RID: 380 RVA: 0x000056B0 File Offset: 0x000038B0
        public override uint[] readCard(bool beep)
        {
            if (!this.checkDevice(true))
            {
                return(null);
            }
            uint num = this.getCardID(false);

            this.pwd = base.getPassword(false, num);
            if (this.pwd == null)
            {
                return(null);
            }
            byte[] array = new byte[24];
            if (!this.isEncryptCard())
            {
                WMMessageBox.Show(this.owner, "该卡为空白卡,请先初始化!");
                return(null);
            }
            for (byte b = 1; b < 7; b += 1)
            {
                byte[] array2 = new byte[4];
                int    num2   = 0;
                if (!RDIC100Reader.ATA_AccessPWD(0, b, this.pwd, this.ADDR))
                {
                    WMMessageBox.Show(this.owner, "读卡错误!");
                    return(null);
                }
                int num3 = RDIC100Reader.ATA_ReadCardRF32(array2, ref num2, this.ADDR);
                if (num3 != 1)
                {
                    WMMessageBox.Show(this.owner, "读卡错误!");
                    return(null);
                }
                array[(int)((b - 1) * 4)]     = array2[0];
                array[(int)((b - 1) * 4 + 1)] = array2[1];
                array[(int)((b - 1) * 4 + 2)] = array2[2];
                array[(int)((b - 1) * 4 + 3)] = array2[3];
            }
            if (beep)
            {
                RDIC100Reader.gSetBeep(100, this.ADDR);
            }
            uint[] array3 = base.byte2Uint32(array);
            uint[] array4 = new uint[]
            {
                array3[0],
                array3[1],
                array3[2],
                array3[3],
                array3[4],
                array3[5]
            };
            num = num * ICardReader.DATA_PASS1 + ICardReader.DATA_PASS2;
            for (int i = 0; i < array4.Length; i++)
            {
                array4[i] ^= num;
            }
            CRCUtil crcutil = new CRCUtil(array4);

            if (!crcutil.checkCRC())
            {
                WMMessageBox.Show(this.owner, "数据检查错误!");
                return(null);
            }
            return(array4);
        }
예제 #5
0
        // Token: 0x0600017B RID: 379 RVA: 0x000054AC File Offset: 0x000036AC
        public override int writeCard(uint[] datas)
        {
            if (!this.checkDevice(true))
            {
                return(-1);
            }
            uint num = this.getCardID(false);

            this.pwd = base.getPassword(false, num);
            if (this.pwd == null)
            {
                return(-2);
            }
            num = num * ICardReader.DATA_PASS1 + ICardReader.DATA_PASS2;
            for (int i = 0; i < datas.Length; i++)
            {
                datas[i] ^= num;
            }
            byte[] array  = base.uInt32tobyte(datas);
            byte[] array2 = new byte[4];
            bool   flag   = false;

            for (byte b = 1; b < 7; b += 1)
            {
                array2[0] = array[(int)((b - 1) * 4)];
                array2[1] = array[(int)((b - 1) * 4 + 1)];
                array2[2] = array[(int)((b - 1) * 4 + 2)];
                array2[3] = array[(int)((b - 1) * 4 + 3)];
                flag      = RDIC100Reader.ATA_ProteWrite(0, b, 0, array2, this.pwd, 0);
                if (!flag)
                {
                    return(-1);
                }
            }
            byte[] array3 = new byte[24];
            for (byte b2 = 1; b2 < 7; b2 += 1)
            {
                byte[] array4 = new byte[4];
                int    num2   = 0;
                if (!RDIC100Reader.ATA_AccessPWD(0, b2, this.pwd, this.ADDR))
                {
                    WMMessageBox.Show(this.owner, "读卡错误!");
                    return(-1);
                }
                int num3 = RDIC100Reader.ATA_ReadCardRF32(array4, ref num2, this.ADDR);
                if (num3 != 1)
                {
                    WMMessageBox.Show(this.owner, "读卡错误!");
                    return(-1);
                }
                array3[(int)((b2 - 1) * 4)]     = array4[0];
                array3[(int)((b2 - 1) * 4 + 1)] = array4[1];
                array3[(int)((b2 - 1) * 4 + 2)] = array4[2];
                array3[(int)((b2 - 1) * 4 + 3)] = array4[3];
            }
            uint[] array5 = base.byte2Uint32(array3);
            uint[] array6 = new uint[]
            {
                array5[0],
                array5[1],
                array5[2],
                array5[3],
                array5[4],
                array5[5]
            };
            if (datas.Length != array6.Length)
            {
                return(-1);
            }
            for (int j = 0; j < 6; j++)
            {
                if (datas[j] != array6[j])
                {
                    return(-1);
                }
            }
            if (flag)
            {
                RDIC100Reader.gSetBeep(100, this.ADDR);
                return(0);
            }
            return(-1);
        }