LudovicRousseau / CCID

CCID driver
https://ccid.apdu.fr/
GNU Lesser General Public License v2.1
229 stars 79 forks source link

Support for quasi(?)-CCID compliant EZ100PU card reader #131

Closed drinkcat closed 5 months ago

drinkcat commented 5 months ago

Not really an issue, more of a progress report, and looking for advise/ideas on next steps.

EZ100PU smartcard readers are still very popular in Taiwan, and commonly used to read NHI (health insurance) cards to access services (tax payment, health insurance data, etc.).

There is (was?) a binary driver at this URL, but the link is now dead (it's, however, possible to find at least one mirror). And I thought it'd still be nice to have an opensource driver, e.g. to be able to support non-x86 platforms.

My goal is just to replicate enough of the driver to support the basic features required by the NHI service mLNHIICC.

I started an implementation from scratch in this repo, but as I was going, I started to realize that a lot of the protocol looks very similar to standard USB CCID.

So instead, I went and hacked the CCID code to make it support the reader. The fork is here, dirty branch. Changes I had to make:

And that's... basically it. With those changes, I could get pcsc_scan -s to work with a bunch of random cards I have, and, most importantly for my purpose, the NHI service appears to work and I can login on one of the websites.

I also dumped USB traces and compared logs between the binary driver and my hacked driver when using pcsc_scan. Some minor differences (see gist for details):

So now, I'm not quite sure what to do as next steps:

drinkcat commented 5 months ago

(pushed a few commits on my master branch with some possible way to support this somewhat cleanly: https://github.com/drinkcat/CCID/commits/master/)

LudovicRousseau commented 5 months ago

It is fine for me if you have your driver as a fork of my CCID driver. I don't like to include code I can't test myself in a project I maintain.

ACS also has its own fork for their "custom" readers at https://github.com/acshk/acsccid

drinkcat commented 5 months ago

Sounds good, thanks! I'll keep opening PRs if I find things that can be useful for both projects, thanks for merging the few I sent over.

Renamed my repo, added a bit of documentation, and made the fork able to coexist with this driver: https://github.com/drinkcat/ezCCID .

I'd also be happy to ship you a couple of those readers if you are interested (they literally sell them like candies here ,-P), let me know and we can coordinate.

Closing this for now. Thanks!

LudovicRousseau commented 5 months ago

I already have a lot of readers :-) But if you think that could help to have a EZ100PU you can contact me privately. My email is available from https://blog.apdu.fr/articles/about_me/