How to access the host filesystem from Java Card API

457 views Asked by At

I want to access the host filesystem from my Java Card, I have been through the java.io and javacardx.external package definitions however it has been of little help. My goal is to check whether a certain path on the host device (Android Phone) is a valid dir or not.

1

There are 1 answers

7
Maarten Bodewes On BEST ANSWER

The code in Java Card is run on the SIM, the SIM provides a (security) related service to the phone, not the other way around. There are no direct methods for reading data from the host filesystem to the SIM.

To get the file system information you would have to encode such a service in your host and use it to provide the data to the SIM card (which obviously must be programmed to request and / or receive the information).

There are ways of requesting information from the handset profile, but those do not extend to any possible host file systems. You can find the related constants in the MEProfile which is part of the on card SIM API. These pieces of information can be requested through the ProactiveHandler interface.

The above also shows a way how to retrieve information from the host, by reversing the half-duplex APDU communication protocol, which only handles commands initiated by the terminal.