1

私は今、DESFire カードの値ファイルを扱っています。次のコマンドを使用して、DESFire カードに値ファイルを作成しました。

byte[] cmdCreateValueFile = new byte[]{
        //cmd
        (byte)0xCC,
        //file no
        (byte)0x01, 
        //com.sett.
        (byte)0x00 ,
        //access rights
        (byte)0x44 , (byte)0x44,
        //lower limit
        (byte)0x00 ,(byte)0x00 ,(byte)0x00 ,(byte)0x00 ,
        //upper limit
        (byte)0x00 ,(byte)0x0F ,(byte)0x42 ,(byte)0x40 ,
        //initial value
        (byte)0x00 ,(byte)0x00 ,(byte)0x00 ,(byte)0x00 ,
        //limited credit enabled
        (byte)0x00
};

次に、次のコマンドを使用して file の値をクレジットします。

//select my app first
...
doAuthenticate(); //authenticate with key #4 of my application

//credit in value file
tagResponse_cmdcredit = isodep.transceive(Utils.wrapMessage(
        (byte)0x0C, new byte[]{(byte) 0x01 , 
        //data
        (byte)0x00,(byte)0x00, (byte)0x03 , (byte)0xE8}));
Log.d("credittttttttttt", "111 "+Utils.bytesToHex(tagResponse_cmdcredit));

//do commit transaction
tagResponse_cmdCommitTransaction = isodep.transceive(Utils.wrapMessage(
        (byte)0xC7, null));
Log.d("committtttttttt", "111 "+Utils.bytesToHex(tagResponse_cmdCommitTransaction));

私の wrapMessage ヘルパー メソッドは次のようになります。

public static byte[] wrapMessage (byte command, byte[] parameters) throws Exception {
    ByteArrayOutputStream stream = new ByteArrayOutputStream();

    stream.write((byte) 0x90);
    stream.write(command);
    stream.write((byte) 0x00);
    stream.write((byte) 0x00);
    if (parameters != null) {
        stream.write((byte) parameters.length);
        stream.write(parameters);
    }
    stream.write((byte) 0x00);

    byte[] b = stream.toByteArray();
    return b;
}

しかし、私は91 9Eエラーを受け取ります。何が問題なのですか?

4

1 に答える 1