Reputation: 119
I have an applet (taken from this HelloSTK2 repo) I've compiled and installed on a SysmoISIM-SJA2 card and I've lightly modified it to respond to a SELECT APDU. The modification looks like this:
public void process(APDU arg0) throws ISOException {
showHello();
}
private void showHello() {
ProactiveHandler proHdlr = ProactiveHandler.getTheHandler();
proHdlr.initDisplayText((byte)0, DCS_8_BIT_DATA, welcomeMsg, (short)0,
(short)(welcomeMsg.length));
proHdlr.send();
return;
}
All I did was move the existing showHello()
function to the function that handles APDUs. It's my understanding from the Javacard documentation that the process()
function should run and then return a status word of 9000, or an error code if applicable.
To SELECT
the file I have an Android application I've written that uses iccOpenLogicalChannel
and takes the AID as an argument. Using GlobalPlatformPro I can see that the applet is installed properly on the UICC and that it is listed as SELECTABLE
, however when I run my Android application I get a STATUS_NO_SUCH_ELEMENT
response which according to the iccOpenLogicalChannelResponse source means the AID is not found on the UICC.
The code for the Android app is very simple and looks like this:
val inputView: EditText = findViewById<EditText>(R.id.AID_INPUT)
val input: String = inputView.text.toString()
val ch = mTelephonyManager.iccOpenLogicalChannel(input)
Toast.makeText(this, ch.toString(), Toast.LENGTH_LONG).show()
mTelephonyManager.iccCloseLogicalChannel(ch.channel)
and the output of listing the applets on the card looks like this (truncated):
AID: d07002ca44, State: 01, Privs: 00
Instance AID: d07002ca44900102
I've tried both d07002ca44 and d07002ca44900102 and get the same response for both AIDs.
My question then: what steps do I need to take to ensure this applet is able to be selected by my Android application?
Worth noting probably that my Android app does have carrier privileges and I'm able to send APDUs to other applications such as the USIM and ISIM applets.
Upvotes: 0
Views: 280