-
Notifications
You must be signed in to change notification settings - Fork 225
Description
I've successfully integrated jcardsim with vsmartcard on windows/mac/linux, with a "blue-eyed implementation", where a single simulator instance is exposed to a single reader, and can be used via the PC/SC interface. All is fine.
But trying to make the implementation more robust and most importantly, with the assumption that the single PC/SC interface is not the only interface towards the simulator (for example, to enforce a "contact interface" and "contactless interface" distinction that run commands interleaved in isolated sessions, even on different vsmartcard "ports"), things break.
For this I would need to lock the simulator for an "adapter" (that enforces a specific protocol towards the simulator like T=1 or T=CL), and this is where troubles arise:
- on Linux (Debian 12), the "virtual card" received proper "powerup" and "powerdown" messages, that allow to lock the simulator for the adapter session just fine.
- on macOS (15.5), there are RESET messages followed by APDU-s, with a POWERDOWN after 5 seconds of no use.
- on Windows (11), there are RESET messages followed by APDU-s and no POWERDOWN
So there's no clean "start of session" and "end of session" markers on non-linux.
I'm thinking of making a hack around it (for Windows) by detecting successful applet selection and/or opportunistic locking with a 3 second timeout or something similar, but eventually it would be nice if the behaviour of vsmartcard could be harmonized across platforms, as much as possible. It might also help to transmit more "metadata" from the PC/SC side towards the virtual card, like the protocol being connected with (T=0/T=1) or if possible, exclusive access flags (also transactions from PC/SC level)
The 1-per-second ATR polling seems something that might be nice to reduce, if feasible.