I am developing java project that communicates with smartcard. Project is based on jmrtd and scuba opensource libraries.
During development, I encountered issue when sending certain APDUs as secured messages. Debug process showed that sun.security.smartcardio.ChannelImpl class, process GetResponse APDU in a wrong way. In order to successfully communicate with smartcard, I need to change ChannelImpl class.
So, my project is using jmrtd and scuba libraries, which both refer to javax.smartcardio.
Furthermore, JavaSE-21 (which I am using) shows that java.smartcardio is used based on following module-info:
module java.smartcardio {
exports javax.smartcardio;
provides java.security.Provider with
sun.security.smartcardio.SunPCSC;
}
To summarize, libraries used by my project are using javax.smartcardio, which in turn is implemented with classes from sun.security.smartcardio package.
It is clear that I cannot change (and don’t want to change) jmrtd/scuba libraries.
My question: is there any way, that I can create my own implementation of ChannelImpl class, which will be recognized by jmrtd/scuba libraries, as well as by javax.smartcardio? (Have in mind, that CnannelImpl class is not directly called by any of my classes, or classes from jmrtd/scuba classes, but only from javax.smartcardio classes)
I tried to created my own implementation of ChannelImpl class, but I do not know if there is a way to instruct javax.smartcardio, to implement that class instead of sun.security.smartcardio.ChannelImpl class.
Milan Markovic is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.