How to get further data from JavaCard after 0x6310 status?

1.3k views Asked by At

I'm trying to list applets/packages on a Java Card. I use the following APDU command to get the list:

80 F2 E0 00 02 4F 00 00

That command returns the status word 0x61xx, so I send a GET RESPONSE command for xx bytes:

00 C0 00 00 xx

This gives me xx data bytes and the status word 0x6310 ("more data available"). What should I send next to receive further data as indicated by the status word?

APDU trace:

[SEND]    80 F2 E0 00 02 4F 00 00
[RECEIVE] 61 F2
[SEND]    00 C0 00 00 F2
[RECEIVE] <F2 bytes of data> 63 10
[SEND]    ???
1

There are 1 answers

0
Michael Roland On BEST ANSWER

Looking at the command/response sequence that you showed in your question and the fact that you are listing applets/packages, I would assume that this is about GlobalPlatform card management.

The command you are using (INS = 0xF2) is the GET STATUS command. P1 = 0xE0 indicates that you want to list the Issuer Security Domain, Applications, including Security Domains, and Executable Load Files. P2 = 0x00 indicates that you want to get the first or all occurrences (i.e. you want to start searching).

You then get 0xF2 data bytes in response to the command. The status word '6310' is defined by the GP Card specification to indicate that more data is available. Hence, you need to repeat the GET STATUS command until you receive a no error ('9000') status word. For repeating the GET STATUS command after a '6310' warning condition, you will need to change P2 to 0x01 to indicate that you want to get the next occurrences. Hence, in response to receiving the status word '6310', you would issue the following command:

80 F2 E0 01 02 4F 00 00