I'm using a GEMALTO IDBRIDGE K30 connected over USB to an Android device.
First I'm sending a PC_to_RDR_IccPowerOff message like this.
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)));
As response i get
Message received of lengths 64 and content: [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]
After this i wait 5 seconds and than i try to send an APDU Select command with PC_to_RDR_XfrBlock.
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,};
As Response I get this what is an Error F4 with the Description PROCEDURE BYTE CONFLICT:
Message received of lengths 64 and content: [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]
Can anybody help me? I don´t understand what i am doing wrong.
PROCEDURE BYTE CONFLICT
error is a little bit tricky because it happens inside the reader's firmware and is escalated to you via CCID. Basically it means that the reader talks to the smartcard via T=1 protocol and some T=1 procedure byte were not received or sent correctly between reader and smartcard. In my opinion there is nothing you can do in your application. What you can do:
Maybe your smartcard is broken, try another one of identical type (or a newer version of it)
Also here it states sometimes there can be problems with some USB ports. Try to connect your reader to a USB hub to the Android device.
Your smart card reader GEMALTO IDBRIDGE K30
reports TPDU exchange level (see here). Since in TPDU exchange level all data sent to the reader is forwarded to the smart card as-is, you have to handle T=1 protocol inside your software. Normally a driver would take care of this task, but in your case you are communicating directly to the smart card reader on USB level. So there is no driver in between. So you will have to implement and handle T=1 protocol by yourself in your code or find an existing Java implementation. The ISO-7816-3
is the standard which defines the T=1 protocol. Unfortunately it is not available for free so I cannot provide links to it (try Google search). You can find an existing implementation of T=1 protocol in C language in the opensource Linux CCID driver.
If you are not bound to GEMALTO IDBRIDGE K30
reader, you can get an other reader which has extended APDU or short APDU exchange level. In these cases you don't have to care about the protocol in your software.