@Deprecated
public static ApplicationDirectory createApplicationDirectory(MfCard card, MfReaderWriter readerWriter,
Key createKey, byte[] createKeyValue, byte[] writeKeyValue) throws IOException {
if (card instanceof MfCard1k) {
TrailerBlock trailerBlock = new TrailerBlock();
trailerBlock.setKey(Key.A, MadConstants.DEFAULT_MAD_KEY);
trailerBlock.setKey(Key.B, writeKeyValue);
trailerBlock.setAccessConditions(MadConstants.READ_WRITE_ACCESS_CONDITIONS);
trailerBlock.setGeneralPurposeByte((byte)(MadConstants.GPB_MAD_AVAILABLE | MadConstants.GPB_MAD_V1));
MfAccess mfAccess = new MfAccess(card, 0, card.getTrailerBlockNumberForSector(0), createKey, createKeyValue);
readerWriter.writeBlock(mfAccess, trailerBlock);
MfAccess mfAccessDataBlock = new MfAccess(card, 0, 1, Key.B, writeKeyValue);
readerWriter.writeBlock(mfAccessDataBlock, new DataBlock(), new DataBlock());
Mad1 mad1 = new Mad1(null, null);
mad1.writeMad();
return mad1;
}
if (card instanceof MfCard4k) {
TrailerBlock trailerBlock = new TrailerBlock();
trailerBlock.setKey(Key.A, MadConstants.DEFAULT_MAD_KEY);
trailerBlock.setKey(Key.B, writeKeyValue);
trailerBlock.setAccessConditions(MadConstants.READ_WRITE_ACCESS_CONDITIONS);
trailerBlock.setGeneralPurposeByte((byte)(MadConstants.GPB_MAD_AVAILABLE | MadConstants.GPB_MAD_V2));
MfAccess mfAccess = new MfAccess(card, 0, card.getTrailerBlockNumberForSector(0), createKey, createKeyValue);
readerWriter.writeBlock(mfAccess, trailerBlock);
MfAccess mfAccessDataBlock = new MfAccess(card, 0, 1, Key.B, writeKeyValue);