martinpaljak / GlobalPlatformPro

🌐 🔐 Manage applets and keys on JavaCard-s like a pro (via command line or from your Java project)
https://javacard.pro/globalplatform
GNU Lesser General Public License v3.0
673 stars 210 forks source link

Request: add option to not reset card at end of invocation #295

Closed gwachob closed 2 years ago

gwachob commented 2 years ago

See https://github.com/martinpaljak/apdu4j/issues/67 for more context.

When invoking the cli, there seems to be a noticeable delay (up to around a second) after completing any operation.

I have traced it to the c.disconnect(true) invocation in GPTool.java - the "true" value here causes the smartcardio libraries to invoke SCardDisconnect with the SCARD_RESET_CARD option (see https://github.com/frohoff/jdk8u-jdk/blob/da0da73ab82ed714dc5be94acd2f0d00fbdfe2e9/src/share/classes/sun/security/smartcardio/CardImpl.java#L260 ). In fact, for my use case, that delay slows my scripts down (yes, I need to write the tool in java and not a series of shell commands... but not there yet) significantly, and I don't think the SCARD_RESET_CARD is the option I actually want.

The feature request is to somehow (command line option?) make the disconnect method be called with false instead of true, letting the CLI exit significantly more quickly. I'd be happy with a command line switch, but if there's a better way, I'd be open to that too.

Happy to provide a PR if you think thats the right approach.