3 Replies Latest reply on Jun 26, 2013 7:01 AM by yuZ

    Load keys to Mifare desfire card

      i am new to nfc related development.i want to read and write data from the MIFARE DESFIRE EV1 card using java.for the movement i have created some methods and i got the UID using SCL010 reader.but the problem is the document for the authenticate using key is not clear and not enough.these are the my code

      // these is the key i want to store in card
      //NfcTerminal.KEY_B is defined in here
      *byte[] key = new byte[]{(byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0,*
      *(byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0,*
      *(byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0,*
      *(byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0};*

      *public String loadKey(byte[] key, char keyType) throws CardException {*
      String res = null;

      System.out.println("Load Key");

      CommandAPDU apdu = this.reader.loadKey(this.decoder.decode(key), keyType);
      ResponseAPDU r = send(apdu);

      res = APDUtoJSON(r).toString();

      return res;
      *public CommandAPDU loadKey(byte[] key, char keyType){*
      *byte[] cmd = new byte[]{(byte)0xff, (byte)0x82, 0x00, mapKeyType(keyType), 0x06};*
      cmd = ArrayUtils.addAll(cmd,key);

      return new CommandAPDU(cmd);

      after i run this code it give that type of error

      Exception in thread "main" java.lang.IllegalArgumentException: Invalid APDU: length=21, b1=6

      if anyone did these type of project please help.