Forum › MIFARE SDK › DESFire Authentication with Advanced SDK › Re: DESFire Authentication with Advanced SDK
Let me answer my own question!!
To use the SDK to read data from a DESFire EV1 Card:
Step 1: Create a soft Key Store into which you place your Card Key. Here, I have my byte array key in MY_CARD_KEY:
Step 2 : Connect to the Card and Select the Application AID using the mDESFire object from the @Override of onDESFireCardDetected()
Step 3 : Authenticate using a reference to the soft Key Store Key we set up earlier and on the Card Key we are using. Here, I use Card Key 1:
Step 4 : Read Data (here I read 32 bytes from File 1)
Step 5 : Tidy Up
To use the SDK to read data from a DESFire EV1 Card:
Step 1: Create a soft Key Store into which you place your Card Key. Here, I have my byte array key in MY_CARD_KEY:
private IKeyStore ks = null;
ks = KeyStoreFactory.getInstance().getSoftwareKeyStore();
ks.formatKeyEntry(0, IKeyConstants.KeyType.KEYSTORE_KEY_TYPE_2K3DES);
ks.setKey(0, (byte) 0, IKeyConstants.KeyType.KEYSTORE_KEY_TYPE_2K3DES, MY_CARD_KEY);
libInstance.loadKeyStore(ks);
Step 2 : Connect to the Card and Select the Application AID using the mDESFire object from the @Override of onDESFireCardDetected()
mDESFire.connectL4();
mDESFire.selectApplication(MY_CARD_AID);
Step 3 : Authenticate using a reference to the soft Key Store Key we set up earlier and on the Card Key we are using. Here, I use Card Key 1:
mDESFire.authenticate(AuthType.Native, 0, (byte) 0, 1, (byte)IKeyConstants.DIV_OPTION_NODIVERSIFICATION, null);
Step 4 : Read Data (here I read 32 bytes from File 1)
mDESFire.setTimeout(2000);
mDESFire.readData(1, 0, 32, DESFire.CommunicationType.Enciphered, 32));
Step 5 : Tidy Up
mDESFire.closeL4();
+ 0
|
- 0