I am trying to learn the basics of smart card programming and I would like to add support for PKCS#11 to a card. The vendor does not provide any PKCS#11 module, so I would like to use OpenSC (the card is not listed as compatible with OpenSC).
As far as I know, the scenario should be this:
- The software on the computer uses PKCS#11 APIs implemented by OpenSC.
- OpenSC works together with PC/SC in order to build and send APDUs to the card.
- The card processes the command APDUs and replies with response APDUs.
I need to know if will be enough to implement an applet that is able to recognize and process all commands specified by ISO-7816 or not.
In particular I can't figure out if the entire OpenSC implementation relies only on the commands specified by ISO-7816 or if it uses also particular commands (the fact that OpenSC is not compatible with all smart cards makes me think that it uses proprietary commands).
The biggest problem with writing such implementations is how and where data is stored on the card. While the data typed and commands for accessing them are indeed standardised in ISO-7816, commands for writing are not. Further, the cards vary greatly in which file types the allow and they are also often requiring proprietary extensions to standard ISO commands.
What OpenSC is doing is trying to create a PKCS#15 application on the card to use for the PKCS#11 access. If you cannot write that or the data is already present in a proprietary format, things can get very complicated.