Reply To: Trying to read DESFire EV1 Card, requires Authentication.

Forum MIFARE SDK Trying to read DESFire EV1 Card, requires Authentication. Reply To: Trying to read DESFire EV1 Card, requires Authentication.

Re: Trying to read DESFire EV1 Card, requires Authentication.

25. April 2016 at 13:58
Hello,

I've managed to read a plain file in one my applications thanks to the advanced SDK (getApplicationIDs, selectApplication and readData). Thanks!

Now I need to read a file in an other application which requires authentication.

My PICC master key has an AES 128 method.
I have the 16 bits long key.

I also have keys for files in the application.

Can you confirm that before being able to call authenticate() I need to initialize the software keystore with the PICC master key?
I've tried:
            ks = KeyStoreFactory.getInstance().getSoftwareKeyStore();

ks.setKey(0, (byte) 0,
IKeyConstants.KeyType.KEYSTORE_KEY_TYPE_AES128, KEY_AES128);

But got the error:
com.nxp.nfclib.exceptions.SmartCardException: Specified Key type is different from the formatted one.


My goal is to call:
objDESFireEV1.authenticate(DESFireEV1.AuthType.Native, keyNo, version, 0,
(byte) 0, null);

data = objDESFireEV1.readData(1, 0, data.length, DESFireEV1.CommunicationType.Enciphered);


Thanks.
+ 0  |  - 0