I want to read a file from a smartcard which is larger than 32k. I know that the READ BINARY command APDU can have an offset in P1 and P2 of up to 32767. But what if my file is larger? Is there any way I can read the complete file? Thank you!
The newer revisions of ISO 7816, part 4 offer an odd INStruction variant (i. e. INS=0xB1), where one has to supply an offset DO (tag 0x54) in the command data field. Fortunately the length of this DO is variable, so really big offsets can be specified. The odd instruction commands have still an exotic touch however, where no strict specification asks for them, but surely a card supporting large files will likely support this instruction variant too.
The only fallback I'm aware of is specifying 0x7FFF as starting offset and as large an (extended length) LE as the card permits, but this may be insufficent for significantly larger files.