Forum Replies Created

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

    19. May 2016 at 19:08
    in reply to: Trying to read DESFire EV1 Card, requires Authentication.
    I can select the app.
    I would like to readData but need to authenticate before (am I right?).
    Is the the right way to do it?
    objDESFireEV1.selectApplication(65536);

    objDESFireEV1.authenticate(DESFireEV1.AuthType.AES, keyNo, version, cardkeyNo, IKeyConstants.DIV_OPTION_NODIVERSIFICATION, null);

    dataCashlessCode = objDESFireEV1.readData(fileNo, 0, 0, DESFireEV1.CommunicationType.Enciphered, dataCashlessCode.length);
    Thanks.
    + 0  |  - 0

    Re: Reply To: Authentication to Mifare DesFire EV1 tag fails at PICC level with Master key..

    18. May 2016 at 11:57
    in reply to: Authentication to Mifare DesFire EV1 tag fails at PICC level with Master key..
    I have made some changes in my authenticate with keyNo and cardkeyNo and now it doesn't fail!
    But that's the case in the readData now :D
    data = objDESFireEV1.readData(fileNo, 0, data.length, DESFireEV1.CommunicationType.Enciphered);

    + 0  |  - 0

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

    18. May 2016 at 11:19
    in reply to: Trying to read DESFire EV1 Card, requires Authentication.
    In authenticate, what is the difference between
    keyNo - key to use for authentication.
    and
    cardkeyNo - defines key to authenticate with.
    ?
    + 0  |  - 0

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

    18. May 2016 at 8:37
    in reply to: Trying to read DESFire EV1 Card, requires Authentication.
    Thank you for the information. I will continue.
    + 0  |  - 0

    Re: Reply To: Authentication to Mifare DesFire EV1 tag fails at PICC level with Master key..

    18. May 2016 at 8:32
    in reply to: Authentication to Mifare DesFire EV1 tag fails at PICC level with Master key..
    Hi,
    I have an authentication error on objDESFireEV1.authenticate.
    It's not easy to understand what is the source of the problem (wrong key, wrong method, ...).
    Best regards.
    + 0  |  - 0

    Re: Reply To: Authentication to Mifare DesFire EV1 tag fails at PICC level with Master key..

    17. May 2016 at 16:43
    in reply to: Authentication to Mifare DesFire EV1 tag fails at PICC level with Master key..
    Why do you need to default key with 00 bytes?
    I don't understand the "format" logic. Why not just "setting" the key?
    My initializeLibrary method works:
            KeyStoreFactory.KeyStoreType kst = libInstance.getKeyStoreType();

    try {

    IKeyStore iks= libInstance.getKeyStore();

    ks = KeyStoreFactory.getInstance().getSoftwareKeyStore();

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

    ks.formatKeyEntry(1, IKeyConstants.KeyType.KEYSTORE_KEY_TYPE_AES128);
    ks.setKey(1, (byte) 0,
    IKeyConstants.KeyType.KEYSTORE_KEY_TYPE_AES128, KEY_CASHLESSCODE_APP);


    } catch (SmartCardException e) {
    showMessage(e.getMessage(), 'l');
    showMessage("SmartCardException in init Keystore ... check LogCat",
    't');
    e.printStackTrace();
    }
    libInstance.loadKeyStore(ks);

    But not my desfireEV1CardLogic:
            int keyNo = 1;
    byte version = 0;

    int[] appids;

    try {

    DESFireEV1.CardDetails details = objDESFireEV1.getCardDetails();
    TextView txtUid = (TextView) findViewById(R.id.txtUid);
    txtUid.setText(Utilities.dumpBytesAscii(details.uid));

    //appids = objDESFireEV1.getApplicationIDs();

    objDESFireEV1.selectApplication(131072);
    // OK

    byte[] dataCustomerCode = new byte[13];

    dataCustomerCode = objDESFireEV1.readData(1, 0, dataCustomerCode.length, DESFireEV1.CommunicationType.Plain);
    // OK for the plain data in this app !

    TextView txtCustomerCode = (TextView) findViewById(R.id.txtCustomerCode);
    txtCustomerCode.setText(Utilities.dumpBytesAscii(dataCustomerCode));

    byte[] dataCashlessCode = new byte[12];

    objDESFireEV1.selectApplication(65536);
    // select the other app: OK

    objDESFireEV1.authenticate(DESFireEV1.AuthType.AES, keyNo, version, 0, (byte) 0, null);
    //
    // authenticate KO !
    //

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


    } catch (IOException e) {
    e.printStackTrace();
    } catch (DESFireException e) {
    e.printStackTrace();
    } catch (GeneralSecurityException e) {
    e.printStackTrace();
    } catch (SmartCardException e) {
    e.printStackTrace();
    }

    + 0  |  - 0

    Re: Reply To: Authentication to Mifare DesFire EV1 tag fails at PICC level with Master key..

    17. May 2016 at 15:26
    in reply to: Authentication to Mifare DesFire EV1 tag fails at PICC level with Master key..
    Thanks.
    The first part is the same as mine. I'm able to read the content of a plain file.
    But I have a 2nd application with a file which need authentication.
    I don't want to write, just to read an enciphered data.
    Do you have a sample of the part with the keystore initialization please?
    + 0  |  - 0

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

    17. May 2016 at 15:10
    in reply to: Trying to read DESFire EV1 Card, requires Authentication.
    Hi,
    Thanks. I read it.
    My questions:
    1
    I don't understand the meaning of "format" and "set" in formatKeyEntry and setKey? Does it alter the card?
    I know the application and the file. I have the AES key. I just want to authenticate to read the content.
    2
    I don't understand why I got
    com.nxp.nfclib.exceptions.SmartCardException: Specified Key type is different from the formatted one.

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

    My key is 16 bytes long:
        public static final byte[] MY_KEY_APP = {(byte) 0x**, (byte) 0x**,
    (byte) 0x**, (byte) 0x**, (byte) 0x**, (byte) 0x2A, (byte) 0xC1,
    (byte) 0xEF, (byte) 0x**, (byte) 0x**, (byte) 0x**, (byte) 0x**,
    (byte) 0x**, (byte) 0x**, (byte) 0x**, (byte) 0x49};

    I
    3
    The post deals with AuthenticateAES, I just have Authenticate.
    Best regards.
    + 0  |  - 0

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

    16. May 2016 at 16:31
    in reply to: Trying to read DESFire EV1 Card, requires Authentication.
    Thanks but I'm still stuck on authentication errors.
    + 0  |  - 0

    Re: Reply To: Authentication to Mifare DesFire EV1 tag fails at PICC level with Master key..

    16. May 2016 at 16:29
    in reply to: Authentication to Mifare DesFire EV1 tag fails at PICC level with Master key..
    Hello,
    I can't see an AuthenticateAES method on the class DESFireEV1.
    Best regards.
    + 0  |  - 0

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

    10. May 2016 at 12:15
    in reply to: Trying to read DESFire EV1 Card, requires Authentication.
    Hello,
    In authenticate() how do the parameters keyNo and cardkeyNo interact with the key added previously to the keystore?
    Thanks.
    + 0  |  - 0

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

    29. April 2016 at 12:17
    in reply to: Trying to read DESFire EV1 Card, requires Authentication.
    Hello,
    Thanks to your answer I'm using the application master key (and not the PICC master key).
    The initialization of the keystore doesn't throw any exception now:
            libInstance = NxpNfcLib.getInstance();
    libInstance.registerActivity(this, packageKey);

    KeyStoreFactory.KeyStoreType kst = libInstance.getKeyStoreType();

    try {

    IKeyStore iks= libInstance.getKeyStore();

    ks = KeyStoreFactory.getInstance().getSoftwareKeyStore();

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


    } catch (SmartCardException e) {
    showMessage(e.getMessage(), 'l');
    showMessage("SmartCardException in init Keystore ... check LogCat",
    't');
    e.printStackTrace();
    }
    libInstance.loadKeyStore(ks);

    But I had to switch the type to KEYSTORE_KEY_TYPE_2K3DES. I don't understand why: my Mifare application was documented as "AES 128 bits method".
    My next step is to call authenticate on my objDESFireEV1.
    I've tried DESFireEV1.AuthType.AES in the first parameter. No success.
    Best regards.
    + 0  |  - 0

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

    25. April 2016 at 13:58
    in reply to: Trying to read DESFire EV1 Card, requires Authentication.
    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

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

    15. April 2016 at 11:04
    in reply to: Trying to read DESFire EV1 Card, requires Authentication.
    I'm lost!
    I cannot sign in, I cannot reset my password. I'm sorry but the website isn't working.
    I don't want to use the personal account I'm using here on this forum (even if I would have wanted, it doesn't work either).
    I've tried to connect with my team account (equipesoft@) on https://inspire.nxp.com/mifare/login.html and got: Invalid username / password.
    I don't have any e-mails in my spam folder.
    Are you sure your e-mail server is sending something (activation, password reset)?
    My project is stuck just because I can't register or sign in :(.
    Thanks.
    + 0  |  - 0

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

    14. April 2016 at 16:52
    in reply to: Trying to read DESFire EV1 Card, requires Authentication.
    Thanks for you help.
    I've checked my spam folder.

    The problem is that my password is now invalid and I still can't ask for a reset.
    And foremost I would like to subscribe to the advanced sdk with an other e-mail address (for mydev team, "equipesoft" on the same domain).
    + 0  |  - 0
Viewing 15 posts - 1 through 15 (of 20 total)