JavacardOS will not accept order any more, please contact our partner Feitian online Store:
https://ftsafe.en.alibaba.com/index.html
https://ftsafe.en.alibaba.com/index.html
proccess() function isn't receive full apdu command from host?
proccess() function isn't receive full apdu command from host?
The host send the command bellow to applet to select EF file:
apdu : "00 A4 02 00 02 40 01".
The purpose is select EF file with ID = "40 01" which specify in data field of the command. But when I debug at process() function, the buffer of apdu only consist 5 first- bytes "00 A4 02 00 02", data field set to "00 00". So my applet can not select the EF using EF ID.
Could you tell me what is wrong in apdu command above? Many thanks
apdu : "00 A4 02 00 02 40 01".
The purpose is select EF file with ID = "40 01" which specify in data field of the command. But when I debug at process() function, the buffer of apdu only consist 5 first- bytes "00 A4 02 00 02", data field set to "00 00". So my applet can not select the EF using EF ID.
Could you tell me what is wrong in apdu command above? Many thanks
You do not have the required permissions to view the files attached to this post. Please login first.
Re: proccess() function isn't receive full apdu command from host?
Perhaps the protocol you are using is T0.
Generally, you need to call setIncomingAndReceive () function. It will help you get as many bytes as will fit without buffer overflow in the APDU buffer following the header. It gets all the incoming bytes if they fit.
You can check your source code and the using protocol.
Generally, you need to call setIncomingAndReceive () function. It will help you get as many bytes as will fit without buffer overflow in the APDU buffer following the header. It gets all the incoming bytes if they fit.
You can check your source code and the using protocol.
Re: proccess() function isn't receive full apdu command from host?
predators wrote:Perhaps the protocol you are using is T0.
Generally, you need to call setIncomingAndReceive () function. It will help you get as many bytes as will fit without buffer overflow in the APDU buffer following the header. It gets all the incoming bytes if they fit.
You can check your source code and the using protocol.
Thanks for your help!
In process() function, I call apdu.setIncomingAndReceive(). It get as many bytes as fit without buffer as you said. My applet successful select EF.
But could you help me solve one more problem?
After select EF, host send command bellow to read record "0x10" with "0x05" byte length of current EF.
command: 00 B2 10 04 05
Applet suppose to call readRecord() function when receive this command.
But in process() function, applet just run to setIncomingAndReceive() then don't run any more, don't return any SW bytes and also don't call readRecord() function.
When I comment out setIncomingAndReceive() function, it work and execute the readRecord() function.
- UNKNwYSHSA
- Posts: 630
- Joined: Thu May 21, 2015 4:05 am
- Points :3055
- Contact:
Re: proccess() function isn't receive full apdu command from host?
This method APDU.setIncomingAndReceive() should only be called on a case 3 or case 4 command.
The command "00 B2 10 04 05" is case 2.
So you need not invoke this method in this command processing.
The command "00 B2 10 04 05" is case 2.
So you need not invoke this method in this command processing.
sense and simplicity
- UNKNwYSHSA
- Posts: 630
- Joined: Thu May 21, 2015 4:05 am
- Points :3055
- Contact:
Re: proccess() function isn't receive full apdu command from host?
The code is as following:
Notice: When you coding, you must understand CASE of the APDU command which you are coding for.
Code: Select all
byte ins = buf[ISO7816.OFFSET_INS];
switch (ins)
{
case (byte)0xA4:
{
short lc = apdu.setIncomingAndReceive(...);
// Command processing;
// ...;
} break;
case (byte)0xB2:
{
// Command processing;
// ...;
} break;
}
Notice: When you coding, you must understand CASE of the APDU command which you are coding for.
sense and simplicity
Who is online
Users browsing this forum: No registered users and 48 guests