Authentication Problem Desfire EV1 with AES

Forum / MIFARE SDK / Authentication Problem Desfire EV1 with AES

  • 11. January 2017 at 17:44
    Hello,

    I'm getting following error at trying to authenticate:

    error:0606508A:digital envelope routines:EVP_DecryptFinal_ex:data not multiple of block length

    My Android project is very close to the sample application mifare provides.
    I try to authenticate in the following way:

    desFireEV1.selectApplication(1);
    Key key = new SecretKeySpec(KEY_AES,"AES");
    KeyData keyData = new KeyData();
    keyData.setKey(key);
    desFireEV1.authenticate(0,IDESFireEV1.AuthType.AES,KeyType.AES128,keyData);

    any Ideas

    Greetings

    Ingo
    + 0  |  - 0

    Re: Authentication Problem Desfire EV1 with AES

    13. January 2017 at 16:59
    Hi Ingo,

    Do you use the TapLinx SDK? The function EVP_DecryptFinal_ex() is no part of TapLinx.

    The TapLinx Team

    + 0  |  - 0

    Re: Authentication Problem Desfire EV1 with AES

    14. January 2017 at 9:21
    Hello,

    yes I'm using the TapLinx SDK. I'm providing a little bit more of my code. Just changed the key value for this post.
    The error (error:0606508A:digital envelope routines:EVP_DecryptFinal_ex:data not multiple of block length)
    occurs at the all of the authenticate method.

    I'm testing on a Samsung Galaxy s5 mini(SM-G800F) with android 5.1.1

    mCardType = CardType.DESFireEV1;
    desFireEV1 = DESFireFactory.getInstance().getDESFire(m_libInstance.getCustomModules());

    try {

    desFireEV1.getReader().connect();
    desFireEV1.getReader().setTimeout(2000);
    desFireEV1.selectApplication(1);

    byte[] KEY_AES = {
    (byte) 0x00,
    (byte) 0x00,
    (byte) 0x00,
    (byte) 0x00,
    (byte) 0x00,
    (byte) 0x00,
    (byte) 0x00,
    (byte) 0x00,
    (byte) 0x00,
    (byte) 0x00,
    (byte) 0x00,
    (byte) 0x00,
    (byte) 0x00,
    (byte) 0x00,
    (byte) 0x00,
    (byte) 0x00,

    };


    Key key = new SecretKeySpec(KEY_AES, "AES");
    KeyData keyData = new KeyData();
    keyData.setKey(key);
    desFireEV1.authenticate(0, IDESFireEV1.AuthType.AES, KeyType.AES128, keyData);
    showMessage("authenticated", 't');


    } catch (NxpNfcLibException ex ){
    showMessage(ex.getMessage(),'t');
    }
    break;
    + 0  |  - 0

    Re: Authentication Problem Desfire EV1 with AES

    16. January 2017 at 9:46
    Hi Ingo,

    I recommend to use TapLinx version 1.1. We had some issues in 1.0.

    The TapLinx Team

    + 0  |  - 0

    Re: Authentication Problem Desfire EV1 with AES

    16. January 2017 at 11:20
    Hi,

    thanks for the hint with the sdk version.
    But after changing the version I'm getting the following error:

    com.nxp.nfclib.exceptions.InvalidResponseLengthException: Incomplete response

    with the same code at desFireEV1.selectApplication(1) or desFireEV1.getApplicationIDs();




    + 0  |  - 0
Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.