Exemplo n.º 1
0
        public bool SetValueCounter(ushort counter, ref LIB_ERR error)
        {
            bool Result = false;

            error = LIB_ERR.NO_ERROR;

            byte[] value = new byte[2];
            RPTUtils.LEU16(counter, ref value, 0);

            byte[] capdu = new byte[] { 0xFF, 0xC2, 0x00, 0x01, 0x13, 0x5F, 0x46, 0x04, 0x40, 0x42, 0x0F, 0x00, 0x95, 0x0A, 0xA1, 0x22, value[0], (byte)(value[0] ^ 0xFF), value[1], 0x00, 0xFF, 0xFF, 0xFF, 0xFF };
            byte[] rapdu = new byte[32];

            try
            {
                Result = (reader.Transmit(capdu, ref rapdu) == SCardError.Success);

                Result = Result &&
                         (rapdu.Length >= 17) && (rapdu[12] == 0x97) && (rapdu[13] == 0x01) && (rapdu[14] == ACK);
            }
            catch
            {
                Result = false;
            }

            if (!Result)
            {
                error = LIB_ERR.CRT571_SET_VALUE_COUNTER;
            }

            return(Result);
        }
Exemplo n.º 2
0
        public byte[] ToBuffer()
        {
            byte[] Result = new byte[rptc.PERSO_DATA_PAGE_CNT * rptc.PAGE_LEN];

            int jj = 0;

            Array.Copy(BitConverter.GetBytes(stationNo), 0, Result, jj, sizeof(UInt16)); jj += sizeof(UInt16);
            Array.Copy(rfu, 0, Result, jj, rfu.Length); jj   += rfu.Length;
            Array.Copy(rfu1, 0, Result, jj, rfu1.Length); jj += rfu1.Length;
            Array.Copy(BitConverter.GetBytes(RPTUtils.DateTimeToUnix(validUntil)), 0, Result, jj, sizeof(UInt32));

            return(Result);
        }
Exemplo n.º 3
0
        public byte[] ToBuffer()
        {
            byte[] Result = new byte[rptc.PERSO_DATA_PAGE_CNT * rptc.PAGE_LEN];

            int jj = 0;

            Array.Copy(BitConverter.GetBytes(RPTUtils.DateTimeToUnix(startDT)), 0, Result, jj, sizeof(UInt32)); jj += sizeof(UInt32);
            Array.Copy(BitConverter.GetBytes(RPTUtils.DateTimeToUnix(endDT)), 0, Result, jj, sizeof(UInt32)); jj   += sizeof(UInt32);
            Array.Copy(BitConverter.GetBytes(stationNo), 0, Result, jj, sizeof(UInt16)); jj += sizeof(UInt16);
            Array.Copy(BitConverter.GetBytes(price), 0, Result, jj, sizeof(UInt16)); jj     += sizeof(UInt16);

            return(Result);
        }
Exemplo n.º 4
0
        public byte[] ToBuffer()
        {
            byte[] Result = new byte[rptc.TRAN_SEC_PAGE_CNT * rptc.PAGE_LEN];

            int jj = 0;

            Array.Copy(BitConverter.GetBytes(RPTUtils.DateTimeToUnix(this.dt)), 0, Result, jj, sizeof(uint)); jj += sizeof(uint);
            Array.Copy(BitConverter.GetBytes(this.stationNo), 0, Result, jj, sizeof(ushort)); jj += sizeof(ushort);
            Array.Copy(BitConverter.GetBytes(this.gateNo), 0, Result, jj, sizeof(ushort)); jj    += sizeof(ushort);
            Result[jj++] = this.direction;
            Result[jj++] = this.operationType;
            Array.Copy(BitConverter.GetBytes(this.usageCount), 0, Result, jj, sizeof(ushort)); jj += sizeof(ushort);
            Array.Copy(this.MAC, 0, Result, jj, this.MAC.Length);

            return(Result);
        }