I am trying to read blocks with mifare classic card 1k and android nfc (on galaxy nexus).
private final int mMaxSize = 64;
mClassic.connect();
boolean success = mClassic.authenticateSectorWithKeyA(1, MifareClassic.KEY_DEFAULT );
final ByteArrayBuffer b = new ByteArrayBuffer(mMaxSize);
if (success)
{
b.append(mClassic.readBlock(0), 0, 16);
b.append(mClassic.readBlock(1), 0, 16);
b.append(mClassic.readBlock(2), 0, 16);
b.append(mClassic.readBlock(3), 0, 16);
}
If I want to read sector 0, that's all ok.
But if I want to read a different sector (for example sector 1), success has true value, but when the app go to readBlock()
, an IOException
is triggered and I have returned tranceiver failed.
What I am doing wrong?