Android &引用;“获取处理选项”;始终为6700(错误的信用证或Le)
我正试图通过LG P710 Optimus L7 2读取智能卡。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[]
我正在关注这个 我可以选择“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响应错误条件”)
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响应错误条件”)