setkey question

Forum / MIFARE SDK / setkey question

  • 2. June 2015 at 15:37
    I read at documentation:

    ks.setKey(0, (byte) 0, IKeyConstants.KeyType.KEYSTORE_KEY_TYPE_MIFARE, KEY_DEFAULT_1, (byte) 0);

    But what is KEY_DEFAULT_1?

    And why the method setKey(int, byte, IKeyConstants.KeyType, byte[]) in the type IKeyStore is not applicable for the arguments (int, byte, IKeyConstants.KeyType, byte[], byte); ??

    The method has 5 parameters not 4, i'm using :

    import com.nxp.nfclib.Interface.NxpNfcLib;

    For the Advanced library.
    + 0  |  - 0

    Re: setkey question

    2. June 2015 at 16:17
    For the Advanced library you use only 4 parameters:

    (int, byte KeyVersion, KeyType, newKey)

    The KEY_DEFAULT_1 is probably the new Key, which can be whatever you come up with (I think it is 6 bytes long in my case).
    You can set up more KEYs in KeyStore, and different Types. I use in my case MIFARE type Key, it's easiest but probably not the most secured.
    Later, you will authenticate using one of those keys, reffering to them with the integer (keyNumber), which you also enter here as one of the parameters.

    Just put for example:

    byte[] KEY_DEFAULT_1 = {(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF};

    And it should work.

    Best,
    David
    + 0  |  - 0

    Re: setkey question

    3. June 2015 at 8:52
    Thank you, ¿ is there any example about Desfire ?
    + 0  |  - 0

    Re: setkey question

    4. June 2015 at 10:35
    If by example, you mean an Example DESFire application - yes there exists a Sample App which you get for free together with the LITE SDK.
    It should be inside the folder where you downloaded your LITE SDK (Sample Apps folder).
    Look into that one in
    MainActivity.java
    and check for
    desfireCardLogic
    method inside it. There you can find several use-cases that you can do with Desfire on LITE SDK.

    Best,
    David
    + 0  |  - 0
Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.