static void ReadBlock(Crypto1 crapto1, byte b) { abtRead[1] = b; Iso14443aCrcAppend(abtRead, 2); var enAbtRead = abtRead.ToArray(); var enAbtReadParity = new byte[4]; crapto1.Encrypt(enAbtRead, enAbtReadParity, 0, 4); device.InitiatorTransceiveBits(enAbtRead, 32, enAbtReadParity, abtRx, MAX_FRAME_LEN, null); var block = new byte[18]; // 16byte data + 2byte crc for (int i = 0; i < 18; i++) { block[i] = (byte)(abtRx[i] ^ crapto1.Crypto1Byte()); } Write(" Block{0,2}: ", b); PrintHex(block, 16); }
public byte[] ReadBlock(byte b) { if (b / 4 != _sector || Crypto1 == null) { throw new Exception("Not auth"); } var read = new byte[4] { 0x30, b, 0, 0 }; Iso14443aCrcAppend(read, 2); var readParity = new byte[4]; Crypto1.Encrypt(read, readParity, 0, 4); Device.InitiatorTransceiveBits(read, 32, readParity, rxBuffer, MAX_FRAME_LEN, null); for (int i = 0; i < 18; i++) // 16byte data + 2byte crc { rxBuffer[i] ^= Crypto1.Crypto1Byte(); } return(rxBuffer.Take(16).ToArray()); }