1 (edited by tektlab 2014-05-13 21:16:55)

Topic: Changing PICC key on a Desfire

Hi there,
I was wondering if any of the example scripts are able to change the PICC key on a Desfire? If not, what are the important functions I should be calling from the API?
Cheers
Phil

Re: Changing PICC key on a Desfire

3DES or AES?

Re: Changing PICC key on a Desfire

i am trying to change the PICC key with DES and getting INTIGRITY ERROR. Below is the procedure am following

public static byte[] gen_piccKey(byte[] key) {

        byte[] rndA = new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
        byte[] rndB = new byte[] { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, (byte) 0x88, (byte) 0x99, (byte) 0xAA, (byte) 0xBB, (byte) 0xCC, (byte) 0xDD, (byte) 0xEE, (byte) 0xFF, (byte) 0xFF };
        byte[] rndAB = new byte[24];
        rndA = xorBytes(rndA, rndB);
        Log.v("xor length", String.valueOf(rndB.length));
        byte[] rndABC = iso14443a_crc(rndA);
        byte[] rndABB = iso14443a_crc(rndB);
        Log.v("rnd length", ByteArrayToHexString(rndABC)+"\n"+ByteArrayToHexString(rndABB));
        System.arraycopy(rndA, 0, rndAB, 0, 16);
        System.arraycopy(rndABC, 0, rndAB, 16, 2);
        System.arraycopy(rndABB, 0, rndAB, 18, 2);
        byte[] rndABCD = new byte[] { 0x00, 0x00, 0x00, 0x00};
        System.arraycopy(rndABCD, 0, rndAB, 20, 4);
        Log.v("final", ByteArrayToHexString(rndAB));
        rndAB = decrypt(key    , rndAB);
        return rndAB;

Please help me to solve this

Re: Changing PICC key on a Desfire

Hello

You find detailed communication examples and a link to the source code here:

stackoverflow.com/questions/38283998/desfire-ev1-communication-examples

P.D:
Why don't you allow to post links here ?