" GET处理方式];总是6700(错误LC或乐) [英] "GET PROCESSING OPTIONS" always 6700(wrong Lc or Le)

查看:418
本文介绍了" GET处理方式];总是6700(错误LC或乐)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过我的LG P710的Optimus L7 2.结果读取智能卡
我下面这个教程

我可以选择1PAY.SYS.DDF01目录结果
我可以选择应用

但我不能执行GET处理选项
它总是导致6700错误(LC或乐错了)

这是我的code

  NfcAdapter mNFCAdapter;
意图意图;
的PendingIntent的PendingIntent;
私人TextView的mTextView;
的String [] [] techList;
的IntentFilter []过滤器=新的IntentFilter [3];@覆盖
保护无效的onCreate(捆绑savedInstanceState){
    super.onCreate(savedInstanceState);
    的setContentView(R.layout.main);
    mTextView =(的TextView)findViewById(R.id.title);    mNFCAdapter = NfcAdapter.getDefaultAdapter(本);    意图=新意图(getApplicationContext()的getClass());
    intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);    的PendingIntent = PendingIntent.getActivity(getApplicationContext(),0,意向,0);
    techList =新的String [] [] {
            新的String []
                    {MifareClassic.class.getName()},
            新的String []
                    {IsoDep.class.getName()}
            };    过滤器[0] =新的IntentFilter();
    过滤器[0] .addAction(NfcAdapter.ACTION_NDEF_DISCOVERED);
    过滤器[0] .addCategory(Intent.CATEGORY_DEFAULT);
    //添加标签数据的类型你想拥有 - 在这里NDEF - >纯文本
    尝试{
        过滤器[0] .addDataType(MIME_TEXT_PLAIN);
    }赶上(MalformedMimeTypeException E){
        e.printStackTrace();
    }    滤波器[1] =新的IntentFilter();
    滤波器[1] .addAction(NfcAdapter.ACTION_TAG_DISCOVERED);
    滤波器[1] .addCategory(Intent.CATEGORY_DEFAULT);    滤波器[2] =新的IntentFilter();
    滤波器[2] .addAction(NfcAdapter.ACTION_TECH_DISCOVERED);
    滤波器[2] .addCategory(Intent.CATEGORY_DEFAULT);}@覆盖
保护无效onNewIntent(意向意图){
    super.onNewIntent(意向);
    字符串行动= intent.getAction();
    mTextView.setText(动作);
    Toast.makeText(getApplicationContext(),动作,Toast.LENGTH_SHORT).show();    标签tagFromIntent = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
    IsoDep tagIsoDep;    如果((tagIsoDep = IsoDep.get(tagFromIntent))!= NULL)
        如果(handleIsoDep(tagIsoDep))
            返回;}
     私人布尔handleIsoDep(IsoDep标签){
    尝试{
        tag.connect();
        tag.setTimeout(20);
        字节[] responseAPDU;
        //2PAY.SYS.DDF01
        字节[] = select_Dir新的字节[] {
                (字节)为0x00(字节)0xa4(字节)0x04的(字节)为0x00(字节)0x0E的,
                (字节)0x32(字节)为0x50(字节)×41(字节)0x59(字节)0x2E之间,
                (字节)0x53(字节)0x59(字节)0x53(字节)0x2E之间,(字节)0x44进行,
                (字节)0x44进行,(字节)0×46,(字节)为0x30,(字节)0X31
        };        //选择CC的Applet
        字节[] = select_Applet新的字节[] {
                (字节)为0x00(字节)0xa4(字节)0x04的(字节)为0x00,(字节)7,
                (字节)0XA0,(字节)为0x00(字节)为0x00(字节)为0x00(字节)0×04,
                (字节)为0x30,(字节)0x60的
        };        //发送GET处理选项命令
        字节[] = Send_Get新的字节[] {
                (字节)0x80的,(字节)0xA8(字节)为0x00(字节)为0x00(字节)0×02,
                (字节)0X83(字节)为0x00,
                (字节)为0x00
        };
        responseAPDU = tag.transceive(select_Dir);
        mTextView.setText(mTextView.getText()+用handleResponse(responseAPDU));

这将返回APDU,状态字9000 - >成功

  responseAPDU = tag.transceive(select_Applet);
        mTextView.setText(mTextView.getText()+用handleResponse(responseAPDU));

这将返回APDU,状态字9000 - >成功

  responseAPDU = tag.transceive(Send_Get);
        mTextView.setText(mTextView.getText()+用handleResponse(responseAPDU));

和这个人是决策问题:它会返回6700 - >错误LC或乐

  mTextView.setText(mTextView.getText()+\\ n \\ nDone);
        tag.close();     }赶上(IOException异常五){
            e.printStackTrace();
            返回false;
    }
    返回true;
}

功能用handleResponse只是解析responseAPDU从二进制到十六进制的亮点状态字

谁能告诉我是怎么回事了?
或者只是帮助我吗?

PS SRY坏英语;)


作为回应我的应用程序选择,我得到:

<$p$p><$c$c>6f298407a0000000043060a51e50074d41455354524f5f2d046465656e9f38039f5c08bf0c059f4d020b0a90006F - &GT; FCI模板29
84 - &GT; DF名07 A0 00 00 00 04 30 60
A5 - &GT; FCI Properietary模板1E
50 - &GT;应用拉布勒07 4D 41 45 53 54 52 4F 5F 2D 04 64 65 6E
9F38 - &GT; PDOL 03 9F 5C 08
BF0C - &GT; FCI发卡行数据05
9F4D - &GT;日志条目02 0B
0A附加发行人的数据

但我不知道是什么香港专业教育学院插入到从GET处理选项的数据FILD。结果
Iv'e红EMV书3章的指导方针5.4规则使用数据对象列表(DOL)。结果
所以,不要我只需要设置数据字段83 03 5C 9F 08结果
和LC = 5?


将需要
解决方案

为了帮助你,整个ADPU对话框(命令/响应)。

不过,根据您的code:你的硬编码和select_Dir命令select_Applet是正确的,但您不能硬code中的GET处理选项命令的语法取决于响应的卡(ICC)您select_Applet命令。

EMV 4.3册,的表45:SELECT响应信息数据字段(FCI )的ADF的的解释说,一个成功的卡片响应SELECT命令包含了一个处理选项数据对象列表(PDOL,标签9F38)。这是由卡处理交易所需的字段列表(例如:量,...)。这些字段的值是通过在GET处理选项命令数据域(标签83)终端(手机)返还到卡上,为的 EMV 4.3书3 ,部分的6.5.8.3数据字段发送命令消息的:


  

命令消息的数据字段是一个数据对象codeD 根据国际刑事法院提供的PDOL,如第5.4节中定义,并通过标签引入 83'。当不通过IC卡提供的数据对象列表,该终端设置模板为零的长度字段。否则,该模板的长度字段是传输到IC卡中的数据对象的值字段的总长度。


知道了:


  • 您选择的AID(A0 00 00 00 04 30 60)是万事达大师之一,它是不可能有一个空PDOL

  • 但是,你的GET处理选项命令不会在其数据字段
  • 列出任何价值
  • 您可能有的GET PROCESSING OPTIONS数据字段的长度并通过在PDOL卡询问域的总长度之间的不匹配,因此,通过将卡返回的6700检查出错(EMV书1, 表33:GET RESPONSE错误条件的)

您已经确定由卡要求为PDOL:9F38 - > 03 9F 5C 08。
03告诉你PDOL是3个字节长。 9F5C是所请求的域的标签,08是字段值是由电话被返回的长度。

标签9F5C在EMV非接触式定义2.3 书C2内核2规范,部分的 A.1.59 DS要求运营商ID的。要求运营商ID的DS被定义为


  

包含终端确定运营商标识数据
  存储。它被发送到卡在GET PROCESSING
  OPTIONS命令。


我不熟悉这个标签,所以我不能告诉你一个适当的值是多少。
然而,这里是GET PROCESSING OPTIONS命令的数据字段应该是什么样子,假设DS请求的操作员ID已经值01 02 03 04 05 06 07 08,并给出了数据对象列表格式准则的 EMV书3 ,部分5.4规则使用数据对象列表(DOL):


  

83 08 01 02 03 04 05 06 07 08


和LC = 10

I'm trying to read a smartcard via my LG P710 Optimus L7 2.
I'm following this tutorial

I can select the "1PAY.SYS.DDF01" directory
I can select the Application

But I can't perform an "GET PROCESSING OPTIONS" It always result in an 6700 error (Lc or Le wrong)

here is my code

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));

this returns the APDU-Statusword 9000 -> success

        responseAPDU = tag.transceive(select_Applet); 
        mTextView.setText(mTextView.getText() + handleResponse(responseAPDU));

this returns the APDU-Statusword 9000 -> success

        responseAPDU = tag.transceive(Send_Get); 
        mTextView.setText(mTextView.getText() + handleResponse(responseAPDU));

and this one is making problems: it returns 6700 -> wrong Lc or Le

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

     } catch (IOException e) {
            e.printStackTrace();
            return false;
    }
    return true;
}

The function handleResponse just parses the "responseAPDU" from Binary to Hex an highlights the Statusword

Can anybody tell my what is going wrong? or just help me out?

PS sry for bad english ;)


As response to my application-select I get:

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

But I don't know what ive to insert into the Data fild from the GET PROCESSING OPTIONS.
Iv'e red the guidelines in EMV Book 3, section "5.4 Rules for Using a Data Object List (DOL)".
So do I just have to set the data field 83 03 9F 5C 08
and Lc = 5?

解决方案

In order to help you, the entire ADPU dialog (commands/responses) would be needed.

However, based on your code : hardcoding your select_Dir and select_Applet commands is correct, but you can't hardcode the GET PROCESSING OPTIONS command whose syntax depends on the response of the card (ICC) to your select_Applet command.

EMV 4.3 Book 1, "Table 45: SELECT Response Message Data Field (FCI) of an ADF", explains that a successful card response to the SELECT command contains a "Processing Options Data Object List" (PDOL, tag 9F38). That's the list of fields required by the card to process the transaction (ex : amount, ...). These fields values are to be returned to the card by the terminal (your phone) through the GET PROCESSING OPTIONS command data field (tag 83), as documented in EMV 4.3 book 3, section "6.5.8.3 Data Field Sent in the Command Message" :

The data field of the command message is a data object coded according to the PDOL provided by the ICC, as defined in section 5.4, and is introduced by the tag '83'. When the data object list is not provided by the ICC, the terminal sets the length field of the template to zero. Otherwise, the length field of the template is the total length of the value fields of the data objects transmitted to the ICC.

Knowing that :

  • Your selected AID (A0 00 00 00 04 30 60) is a Mastercard Maestro one, which is unlikely to have an empty PDOL
  • But your GET PROCESSING OPTIONS command does not list any value in its data field
  • You probably have a mismatch between the length of your GET PROCESSING OPTIONS data field and the total length of the fields asked by the card in the PDOL, hence the 6700 checking error returned by the card (EMV Book 1, "Table 33: GET RESPONSE Error Conditions").

You have identified the PDOL requested by the card as : 9F38 -> 03 9F 5C 08. The 03 tells you the PDOL is 3 bytes long. 9F5C is the tag of the requested field, 08 is the length of the field value that is to be returned by the phone.

Tag 9F5C is defined in EMV Contactless 2.3 Book C2 kernel 2 specification, section "A.1.59 DS Requested Operator ID". The DS Requested Operator ID is defined as

Contains the Terminal determined operator identifier for data storage. It is sent to the Card in the GET PROCESSING OPTIONS command.

I'm not familiar with this tag, so I can't tell you what a proper value is. However, here is what the data field of the GET PROCESSING OPTIONS command should look like, assuming a DS Requested Operator ID has value 01 02 03 04 05 06 07 08, and given the Data Object List formatting guidelines in EMV Book 3, section "5.4 Rules for Using a Data Object List (DOL)" :

83 08 01 02 03 04 05 06 07 08

and Lc = 10

这篇关于&QUOT; GET处理方式];总是6700(错误LC或乐)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆