Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/208.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android &引用;“获取处理选项”;始终为6700(错误的信用证或Le)_Android_Nfc_Smartcard_Apdu_Emv - Fatal编程技术网

Android &引用;“获取处理选项”;始终为6700(错误的信用证或Le)

Android &引用;“获取处理选项”;始终为6700(错误的信用证或Le),android,nfc,smartcard,apdu,emv,Android,Nfc,Smartcard,Apdu,Emv,我正试图通过LG P710 Optimus L7 2读取智能卡。 我正在关注这个 我可以选择“1PAY.SYS.DDF01”目录 我可以选择应用程序 但我无法执行“获取处理选项” 它总是导致6700错误(Lc或Le错误) 这是我的密码 NfcAdapter mNFCAdapter; Intent intent; PendingIntent pendingIntent; private TextView mTextView; String[][] techList; IntentFilter[]

我正试图通过LG P710 Optimus L7 2读取智能卡。
我正在关注这个

我可以选择“1PAY.SYS.DDF01”目录
我可以选择应用程序

但我无法执行“获取处理选项” 它总是导致6700错误(Lc或Le错误)

这是我的密码

NfcAdapter mNFCAdapter;
Intent intent;
PendingIntent pendingIntent;
private TextView mTextView;
String[][] techList;
IntentFilter[] filters = new IntentFilter[3];

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    mTextView = (TextView) findViewById(R.id.title);

    mNFCAdapter = NfcAdapter.getDefaultAdapter(this);

    intent = new Intent(getApplicationContext(), getClass());
    intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);

    pendingIntent = PendingIntent.getActivity(getApplicationContext(), 0, intent, 0);


    techList = new String[][]{
            new String[]
                    { MifareClassic.class.getName() },
            new String[]
                    { IsoDep.class.getName() }
            };

    filters[0] = new IntentFilter();
    filters[0].addAction(NfcAdapter.ACTION_NDEF_DISCOVERED);
    filters[0].addCategory(Intent.CATEGORY_DEFAULT);
    // add type of tag data you want to have - here ndef -> plain text
    try {
        filters[0].addDataType(MIME_TEXT_PLAIN);
    } catch (MalformedMimeTypeException e) {
        e.printStackTrace();
    }

    filters[1] = new IntentFilter();
    filters[1].addAction(NfcAdapter.ACTION_TAG_DISCOVERED);
    filters[1].addCategory(Intent.CATEGORY_DEFAULT);

    filters[2] = new IntentFilter();
    filters[2].addAction(NfcAdapter.ACTION_TECH_DISCOVERED);
    filters[2].addCategory(Intent.CATEGORY_DEFAULT);

}

@Override
protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);
    String action = intent.getAction();
    mTextView.setText(action);
    Toast.makeText(getApplicationContext(), action, Toast.LENGTH_SHORT).show();

    Tag tagFromIntent = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
    IsoDep tagIsoDep;

    if((tagIsoDep = IsoDep.get(tagFromIntent)) != null)
        if(handleIsoDep(tagIsoDep))
            return;

}
     private boolean handleIsoDep(IsoDep tag){
    try{ 
        tag.connect(); 
        tag.setTimeout(20); 
        byte[] responseAPDU;


        //2PAY.SYS.DDF01
        byte[] select_Dir = new byte[]{ 
                (byte)0x00, (byte)0xa4, (byte)0x04, (byte)0x00, (byte)0x0e,
                (byte)0x32, (byte)0x50, (byte)0x41, (byte)0x59, (byte)0x2e,
                (byte)0x53, (byte)0x59, (byte)0x53, (byte)0x2e, (byte)0x44, 
                (byte)0x44, (byte)0x46, (byte)0x30, (byte)0x31
        };

        //Select CC Applet
        byte[] select_Applet = new byte[]{ 
                (byte)0x00, (byte)0xa4, (byte)0x04, (byte)0x00, (byte)7, 
                (byte)0xa0, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x04,
                (byte)0x30, (byte)0x60
        };

        //Send GET PROCESSING OPTIONS command
        byte[] Send_Get = new byte[]{ 
                (byte)0x80,(byte)0xA8,(byte)0x00,(byte)0x00,(byte)0x02,
                (byte)0x83,(byte)0x00,
                (byte)0x00
        };


        responseAPDU = tag.transceive(select_Dir); 
        mTextView.setText(mTextView.getText() + handleResponse(responseAPDU));
返回APDU Statusword 9000->成功

        responseAPDU = tag.transceive(select_Applet); 
        mTextView.setText(mTextView.getText() + handleResponse(responseAPDU));
        responseAPDU = tag.transceive(Send_Get); 
        mTextView.setText(mTextView.getText() + handleResponse(responseAPDU));
这将返回APDU Statusword 9000->success

        responseAPDU = tag.transceive(select_Applet); 
        mTextView.setText(mTextView.getText() + handleResponse(responseAPDU));
        responseAPDU = tag.transceive(Send_Get); 
        mTextView.setText(mTextView.getText() + handleResponse(responseAPDU));
这一个正在制造问题:它返回6700->错误的Lc或Le

        mTextView.setText(mTextView.getText() + "\n\nDone");
        tag.close();

     } catch (IOException e) {
            e.printStackTrace();
            return false;
    }
    return true;
}
函数handleResponse只是将“responseADU”从二进制解析为十六进制,并突出显示状态字

有人能告诉我出了什么问题吗? 还是帮我

PS sry表示英语不好;)


作为对我的申请的回应,选择我得到:

6f298407a0000000043060a51e50074d41455354524f5f2d046465656e9f38039f5c08bf0c059f4d020b0a9000

6F -> FCI Template 29  
84 -> DF Name 07 A0 00 00 00 04 30 60  
A5 -> FCI Properietary Template 1E  
50 -> Application Lable 07 4D 41 45 53 54 52 4F 5F 2D 04 64 65 6E  
9F38 -> PDOL 03 9F 5C 08  
BF0C -> FCI Issuer Data 05  
9F4D -> Log Entry 02 0B  
0A Additional Issuer Data
但是我不知道我要从GET处理选项向数据文件中插入什么。
Iv'e遵守EMV第3册第5.4节“数据对象列表(DOL)使用规则”中的指南。
那么我是否只需要设置数据字段83 03 9F 5C 08

Lc=5?

为了帮助您,需要整个ADPU对话框(命令/响应)

但是,根据您的代码:硬编码select_Dir和select_小程序命令是正确的,但是不能硬编码GET PROCESSION OPTIONS命令,该命令的语法取决于卡(ICC)对select_小程序命令的响应

“表45:ADF的选择响应消息数据字段(FCI)”,说明成功响应SELECT命令的卡包含“处理选项数据对象列表”(PDOL,标记9F38)。这是卡处理交易所需的字段列表(例如:金额,…)。终端(您的手机)将通过GET PROCESSING OPTIONS(获取处理选项)命令数据字段(标记83)将这些字段值返回到卡中,如“6.5.8.3命令消息中发送的数据字段”一节所述:

命令消息的数据字段是根据ICC提供的PDOL编码的数据对象,如第5.4节所定义,并由标记“83”引入。当ICC未提供数据对象列表时,终端将模板的长度字段设置为零。否则,模板的长度字段是传输到ICC的数据对象的值字段的总长度

知道:

  • 您选择的援助(A000 00 04 30 60)是Mastercard Maestro援助,不太可能有空的PDOL
  • 但“获取处理选项”命令在其数据字段中未列出任何值
  • GET PROCESSION OPTIONS数据字段的长度与PDOL中卡请求的字段的总长度可能不匹配,因此卡返回6700检查错误(EMV手册1,“表33:GET响应错误条件”)
您已将卡请求的PDOL标识为:9F38->03 9F 5C 08。 03告诉您PDOL的长度为3字节。9F5C是请求字段的标签,08是手机返回的字段值的长度

标记9F5C在EMV非接触式2.3节“A.1.59 DS请求的操作员ID”中定义。DS请求的操作员ID定义为

包含数据的终端确定的操作员标识符 存储它在GET处理中被发送到卡 选项命令

我不熟悉这个标签,所以我无法告诉您什么是正确的值。 但是,假设DS请求的操作员ID的值为01 02 03 04 05 06 07 08,并且根据“5.4使用数据对象列表(DOL)的规则”一节中的数据对象列表格式指南,GET PROCESSION OPTIONS命令的数据字段应该是这样的:

83 08 01 02 03 04 05 06 07 08


Lc=10

为了帮助您,需要整个ADPU对话框(命令/响应)

但是,根据您的代码:硬编码select_Dir和select_小程序命令是正确的,但是不能硬编码GET PROCESSION OPTIONS命令,该命令的语法取决于卡(ICC)对select_小程序命令的响应

“表45:ADF的选择响应消息数据字段(FCI)”,说明成功响应SELECT命令的卡包含“处理选项数据对象列表”(PDOL,标记9F38)。这是卡处理交易所需的字段列表(例如:金额,…)。终端(您的手机)将通过GET PROCESSING OPTIONS(获取处理选项)命令数据字段(标记83)将这些字段值返回到卡中,如“6.5.8.3命令消息中发送的数据字段”一节所述:

命令消息的数据字段是根据ICC提供的PDOL编码的数据对象,如第5.4节所定义,并由标记“83”引入。当ICC未提供数据对象列表时,终端将模板的长度字段设置为零。否则,模板的长度字段是传输到ICC的数据对象的值字段的总长度

知道:

  • 您选择的援助(A000 00 04 30 60)是Mastercard Maestro援助,不太可能有空的PDOL
  • 但“获取处理选项”命令在其数据字段中未列出任何值
  • GET PROCESSION OPTIONS数据字段的长度与PDOL中卡请求的字段的总长度可能不匹配,因此卡返回6700检查错误(EMV手册1,“表33:GET响应错误条件”)
您已将卡请求的PDOL标识为:9F38->03 9F 5C 08。 03告诉您PDOL的长度为3字节。9F5C是请求字段的标签,08是手机返回的字段值的长度

标记9F5C在EMV非接触式2.3节“A.1.59 DS请求”中定义