}
private void loginIntoSector(MfClassicAccess access, int memoryKeyId) throws IOException {
byte blockNumber = (byte)memoryLayout.getBlockNumber(access.getSector(), access.getBlock());
byte keyTypeToUse = access.getKeyValue().getKey() == Key.A ? Acs.KEY_A : Acs.KEY_B;
Command auth = new Command(Apdu.INS_INTERNAL_AUTHENTICATE_ACS, 0, 0, new byte[] { 0x01, 0x00, blockNumber,
keyTypeToUse, (byte)memoryKeyId });
Response authResponse = apduTag.transmit(auth);
if (!authResponse.isSuccess()) {
loginKeyHandler.resetCurrentKeys();
throw new MfLoginException("Login failed. Sector: " + access.getSector() + ", Block: " + access.getBlock()