I'm using the JC-Emulator to test some changes to the
CardEdge applet, and I've discovered what I think to be an
"unfair" behaviour of the emulator.
After having installed my applet into the emulator using
installer.sh I was using muscleTool to format it, but
everytime I tried, the emulator hanged up reporting an
uncatched exception.
After a quite long debugging, I found that the problem was
in the JCManager::run() method. Here are the lines I refer
to:
------------------------------------
if(theJCRECore.getSelectedAID()==null) {
System.out.println("JCManager: fallimento selezione
AID applet");
// se nessuna applet è selezionata
ISOException.throwIt(ISO7816.SW_APPLET_SELECT_FAILED);
}
---------------------------------
As you can see the emulator correctly verifies if the
applet has been successfully selected, otherwise throws
the exception ISO7816.SW_APPLET_SELECT_FAILED. The problem
is that this exception isn't caught by anybody, causing
the emulator to crash without sending any error response
to the user application, and causing also the pcscd daemon
to lock in an apparently irreversible way (the
start-stop-daemon seems not to work: the only solution is
to manually "kill" the pcscd process).
I don't know exactly the internal architecture of the
emulator, so I'm not able, by now, to realize by myself
the proper patch, but the core of the problem seems quite
clear: the emulator should not throw such an uncatched
exception, but it should return to the application the
correct error-code without hanging-up (even a generic
"internal error" would be much better than a complete
lock).
Hoping my report can be of any help, best regards.
Riccardo Brigo
|