I am trying to read a smartcard(German Gesundheitskarte) using javax.smartcardio
In the definition of the EF \"PD\" its length is specified as 850 bytes. The conten
The offset is in P1 & P2, although the highest bit is used to indicate that you want to select something with a given SFI. So you can use P1 as well for the bytes. After that you will have to move towards READ BINARY with an odd INS (B1).
So you can read up to 2^15 - 1 bytes using the normal read binary. That's 32Ki - 1. And of course an additional few bytes because of the returned bytes by the APDU.
I would always read out files from smart cards using the following method: 1 determine file size, e.g. using the FCI (File Control Information) returned with a SELECT by FILE ID (00 A4 02 00 02 ${FILE_ID}), you need to parse the response. Then increase the offset by the number of returned bytes each time. Never ask more than the maximum file size, as the behaviour of most cards differs, is not defined or just plain wrong).
Advanced topic:
If you use READ BINARY with ODD INS, you need to substract the header of the DO each time you increase the offset. In that case reading up to the end becomes a bit troublesome because you would need to add the overhead of the header to the Le byte.