【发布时间】:2017-03-11 18:09:48
【问题描述】:
我正在使用通过 USB 连接到 Android 设备的金雅拓 IDBRIDGE K30。
首先我要发送这样的 PC_to_RDR_IccPowerOff 消息。
byte[] data= new byte[]{
(byte) 0x62,
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
(byte) 0x00,
(byte) 0x00,
(byte) 0x00,
(byte) 0x00, (byte) 0x00};
UsbInterface intf = _usbDevice.getInterface(0);
UsbEndpoint outputEndpoint = intf.getEndpoint(1);
UsbEndpoint inputEndpoint = intf.getEndpoint(0);
intf.getEndpointCount();
UsbDeviceConnection connection = _usbManager.openDevice(_usbDevice);
connection.claimInterface(intf, forceClaim);
//activate card for apdu
final int dataTransferred = connection.bulkTransfer(inputEndpoint, data, data.length, TIMEOUT);
Log.e(SIGNATURE_LOG, String.format("Written %s bytes to the dongle. Data written: %s", data.length, byteArrayToHexArrayString(data)));
作为回应,我得到了
收到长度为 64 且内容为:[80, 18, 00, 00, 00, 00, 00, 00, 00, 00, 3B, DF, 18, 00, 81, 31, FE, 58, 80, 31, 90, 52, 41, 01, 64, 05, C9, 03, AC, 73, B7, B1, D4, 44, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00]
在此之后,我等待 5 秒,然后尝试使用 PC_to_RDR_XfrBlock 发送 APDU 选择命令。
byte[] data2= new byte[]{
(byte) 0x6F,
(byte) 0x10, (byte) 0x00, (byte) 0x00, (byte) 0x00,
(byte) 0x00,
(byte) 0x01,
(byte) 0x00,
(byte) 0x00, (byte) 0x00,
(byte) 0x00,
(byte) 0x00,
(byte) 0x0C,
(byte) 0x00, (byte) 0xA4, (byte) 0x04, (byte) 0x00,
(byte) 0x07, (byte) 0xA0, (byte) 0x00, (byte) 0x00,
(byte) 0x01, (byte) 0x18, (byte) 0x45, (byte) 0x4E,
(byte) 0x15,};
作为响应,我得到这是一个错误 F4,描述为 PROCEDURE BYTE CONFLICT:
收到长度为 64 且内容为:[80, 00, 00, 00, 00, 00, 01, 40, F4, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00]
有人可以帮我吗?我不明白我做错了什么。
【问题讨论】:
标签: java android usb smartcard smartcard-reader