Better pcsc_scan on Windows

Since pcsc-tools 1.5.0 (May 2017) it is possible to build and use pcsc_scan on Windows.
See my previous blog article "pcsc_scan on Windows".

New version

digitalentropy user reported a bug on Windows. So I had a look to fix the problem and also improved pcsc_scan on Windows at the same time.

New features

  • Color support
    The Windows terminal is now recognized and the output is in color.
    The colors may look ugly on a white on black terminal. Sorry for that.
  • Exit key
    You can now quit the program by pressing the shift key. The combination Ctrl-C does not work on Windows to send a signal to the process so I had to use something else.

Sample output


Binary download

You can download the Windows binary from the project page in the Windows section at the bottom of the web page.

I love Free Software

https://fsfe.org/campaigns/ilovefs/

I love Free Software


All the software projects I develop on my free time are Free Software. I also use a LOT of Free Software projects for many different things.

I created this blog just to talk about my activities in Free Software and document what I think is interesting to you.

User eXperience fixes for "Smart card ATR parsing"

Smart card ATR parsing

My web site/service "Smart card ATR parsing" is used to parse smart card ATR. You can read the previous article "Parsing an ATR: new web site URL" to get some background history.

If you have an ATR I do not already have in my database you can submit it with a description of the corresponding smart card.

Problem

I sometimes receive strange ATR to be added the list. For example I just received these 2 ATRs:
What is strange with these 2 ATRs is that:
  1. I already have a shorter version in my list
  • they have 4 extra bytes at the end
  • these 4 extra bytes "3B 02 14 50" look like another ATR
  • At first I thought of a corrupted ATR or a bogus reader or driver that mixes 2 ATRs.
    But then I realised that the value "3B 02 14 50" is the default value I use for the ATR input field. So if you copy & paste a new ATR value without removing the default value then the default value is appended to your ATR.


    Solution

    The solution is now obvious. The problem is with my web site.
    The value "3B 02 14 50" is now a placeholder= and not a value=. You can copy & paste a new ATR in the input field and the "3B 02 14 50" will disappear.

    Conclusion

    I was aware of this problem. I used to first select the default value "3B 02 14 50" to replace it with the real ATR. I thought every body would do the same as me. I was wrong and the User eXperience was bad.

    The web site should now be more useful to my users and also easier to use.
    Do not hesitate to complain if you find a bug or want to suggest a UX improvement.

    ATR statistics: TB4 - Global after T=15 in TDi–1

    Article from the series "ATR statistics".

    TB4 - Global after T=15 in TDi–1

    For T=15 protocol TBi the coding is defined in the document ETSI TS 102 221 V10.0.0 (2011-12) chapter "6.3.3 Global Interface byte".

    Table 6.7: Coding of the first TBi (i > 2) after T = 15 of the ATR

    b8 b7 b6 b5 b4 b3 b2 b1 Meaning
    0 0 0 0 0 0 0 0 No additional global interface parameters supported
    1 - - 1 - - - - Low Impedance drivers and protocol available on the I/O line available (see clause 7.2.1)
    1 1 - - - - - - Inter-Chip USB UICC-Terminal interface supported as defined in TS 102 60
    1 - 1 - - - - - UICC-CLF interface supported as defined in TS 102 613
    1 - - - 1 - - - Secure Channel supported as defined in TS 102 484
    1 - - - 1 1 - - Secured APDU - Platform to Platform required as defined in TS 102 484
    NOTE: Any other value is RFU.

    TB4 # %
    2070 99.90 %
    0x83 2 0.10 %


    Only 2 cards have a TB4 in the ATR. They are:
    The 2 cards use the same value for TB4: 0x83 that is RFU.

    GitHub Sponsors

    GitHub Sponsors

    GitHub now proposes a way to fund the Free Software projects you use. From their presentation page:
    A new way to contribute on GitHub
    Funding developers and organizations through GitHub Sponsors is one more way to contribute to open source projects you appreciate. Help projects get the resources they need, and recognize contributors working behind the scenes to make open source better for everyone.
    With Sponsors, any GitHub user can sponsor any open source developer or organization in the program.
    I am now part of the Sponsors project. You can sponsor my Free Software projects on github.
    You will find a Sponsor button in each project page. For example:
    https://github.com/LudovicRousseau/CCID

    I am really new to this program so I have no idea how it will work for me and my Free Software projects.
    I configured two options: 1 $ per month and 10 $ per month. Maybe I should configure more options. Just tell me.
    https://github.com/sponsors/LudovicRousseau

    Other funding systems

    I already tried other ways to receive some money.

    Flattr

    In 2010 I tried Flattr. See "How to help my projects?" but, as I explained in "My Flattr experience" 4 years later, all the money went to Flattr itself as "tax".
    It was not a positive experience.

    Bitcoin

    In 2014 I created a bitcoin account. See "How to help my projects? Send me bitcoins!". After 2 years (in 2016) I made a status in "Bitcoins received for this blog: 2 years later".

    Since the bitcoin blockchain is public you can see all the transactions I received so far. In 5 years I received 0.12837149 BTC (around 1000 €) for a total of 10 donations.
    That is ~200 € per year or ~15 € per month. That is enough to pay for the VPS I use to host the apdu.fr services.

    Maybe I should make more advertising about the possibility to send me bitcoin.

    Conclusion

    I have no idea how the GitHub (owned by Microsoft) Sponsors program will evolve. I propose to make a status in 2 or 3 years to see how it goes.

    Update: 1 Feb 2020

    You can access my Sponsor page at https://github.com/sponsors/LudovicRousseau.

    I added new options 2$, 4$ and 8$ per month in addition to the 1$ and 10$ per month to give you more flexibility. Maybe I should have used a Fibonacci suite instead? 🙂

    New generator for the CCID readers pages

    Since Python 2.x is no more maintained from 1st January 2020 I had to move the script to generate some CCID pages to Python 3.

    These pages are the famous ones available from https://ccid.apdu.fr/#readers:


    Technology update

    The previous Python script used templayer. templayer is no more maintained since 2009 and only works with Python 2.
    I now use Jinja2.

    Request for comments

    If you see a problem or want to propose a change to these web pages just email me or the pcsclite-muscle mailing list. It is the good time to make suggestions.
    It can be about the information provided on the pages or the graphical design of the pages (you may have noted that I am not a website designer).

    New version of pcsc-lite: 1.8.26

    I just released a new version of pcsc-lite 1.8.26.
    pcsc-lite is a Free Software implementation of the PC/SC (or WinSCard) API for Unix systems.

    Changes

    1.8.26: Ludovic Rousseau
    3 January 2020
    • Use poll() instead of select() to allow file descriptor higher than FD_SETSIZE
    • Enable reader filtering by default
    • pcsc-spy:
      • Do not read output buffer after error
      • Adjust code to handle autoallocated buffers
      • fix year-2038 issue by using long instead of int
    • Android: fix compilation
    • if client/server protocol mismatch:
      • log an explicit message
      • SCardEstablishContext() returns SCARD_E_SERVICE_STOPPED
    • polkit: log the error message if polkit_authority_get_sync() fails
    • Exit with EXIT_SUCCESS on shutdown to please systemd
    • Doxygen: fix minor issues in the documentation
    • Add --disable-documentation option
    • Fix a minor memory leak

    Motivation

    The major change is the use of reader filtering by default. No need to rebuild pcsc-lite using --enable-filter any more.
    The feature was introduced in 2015 and is documented at "Remove and/or customize PC/SC reader names".

    This feature is requested in packages by some users.

    To avoid that each GNU/Linux distribution changes the packaging configuration to enable the feature I decided to enable the feature by default in the upstream project.

    This change should not have any bad side effect. Only root can modify the configuration file /etc/default/pcscd or the systemd file /etc/systemd/system/pcscd.service.d/override.conf.

    For systemd use: sudo systemctl edit pcscd to add something like:
    [Service]
    Environment=PCSCLITE_FILTER_IGNORE_READER_NAMES=Nitrokey

    You can get the previous behaviour by using
    ./configure --disable-filter

    MUSCLE mailing list statistics for 2019

    As I did in 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017 and 2018 I propose some statistics of the MUSCLE mailing list usage.


    Evolution

    Year Total number of messages Progression
    2009 603
    2010 718 +19 %
    2011 999 +39 %
    2012 207 -79 %
    2013 198 -4 %
    2014 194 -2 %
    2014 194 -2 %
    2015 120 -38 %
    2016 125 +4 %
    2017 128 +2 %
    2018 66 -51 %
    2019 29 -56 %

    Comments

    Again a high decrease in number of messages.
    I note that I receive many messages directly by email instead of from the mailing list.

    My interpretation is (same as one year ago) that the development of pcsc-lite and related software is now complete. Only rare bugs are reported.
    Now users are asking for support or help and the easiest way to contact me is using one of my emails.

    Statistics from 3.1.2019 to 24.11.2019
    for pcsclite-muscle@lists.infradead.org



    People who have written most messages:


     Author   Msg   Percent
    1 ludovic.rousseau@gmail.com 16 55.17 %
    2 wrosenauer@gmail.com 3 10.34 %
    3 brice.gagnage@renault.com 2 6.90 %
    4 ertan@cronosmedikal.com 2 6.90 %
    5 frankmorgner@gmail.com 1 3.45 %
    6 =?iso-8859-1?Q?Ralph_Pr=FCtting_=40_Active_Key_GmbH_=26_Co=2E_KG?= 1 3.45 %
    7 00cpxxx@gmail.com 1 3.45 %
    8 godfreyhkchung@gmail.com 1 3.45 %
    9 pnickerson@cashstar.com 1 3.45 %
    10 gsvelto@mozilla.com 1 3.45 %
    other 0 0.00 %

    Best authors, by total size of their messages (w/o quoting):


     Author   KBytes
    1 ludovic.rousseau@gmail.com 1296.4
    2 =?iso-8859-1?Q?Ralph_Pr=FCtting_=40_Active_Key_GmbH_=26_Co=2E_KG?= 49.3
    3 frankmorgner@gmail.com 34.0
    4 ertan@cronosmedikal.com 12.3
    5 brice.gagnage@renault.com 11.1
    6 gsvelto@mozilla.com 9.5
    7 pnickerson@cashstar.com 8.1
    8 00cpxxx@gmail.com 8.0
    9 wrosenauer@gmail.com 7.5
    10 godfreyhkchung@gmail.com 2.6

    Best authors, by average size of their message (w/o quoting):


     Author   bytes
    1 ludovic.rousseau@gmail.com 82971
    2 =?iso-8859-1?Q?Ralph_Pr=FCtting_=40_Active_Key_GmbH_=26_Co=2E_KG?= 50467
    3 frankmorgner@gmail.com 34825
    4 gsvelto@mozilla.com 9716
    5 pnickerson@cashstar.com 8266
    6 00cpxxx@gmail.com 8219
    7 ertan@cronosmedikal.com 6300
    8 brice.gagnage@renault.com 5673
    9 godfreyhkchung@gmail.com 2658
    10 wrosenauer@gmail.com 2574

    Table showing the most successful subjects:


     Subject   Msg   Percent
    1 [Pcsclite-muscle] Interaction pcsc-lite and Yubikey 4 13.79 %
    2 [Pcsclite-muscle] Bug fix for ccid-1.4.31 3 10.34 %
    3 [Pcsclite-muscle] pcscd errors break https for chromium-based browsers 2 6.90 %
    4 [Pcsclite-muscle] Stuck in a CCID_Receive Overrun error loop 2 6.90 %
    5 [Pcsclite-muscle] Yubico YubiKey 5: RFInitializeReader() Open Port 1 3.45 %
    6 [Pcsclite-muscle] Yubico YubiKey 5: RFInitializeReader() Open 1 3.45 %
    7 [Pcsclite-muscle] Multiple command processing and card recognition 1 3.45 %
    8 [Pcsclite-muscle] Very low cost PCSC card reader 1 3.45 %
    9 [Pcsclite-muscle] Multiple command processing and card 1 3.45 %
    10 New version of pcsc-lite: 1.8.25 1 3.45 %
    11 [Pcsclite-muscle] What happened to the PC/SC workgroup (and site)? 1 3.45 %
    12 [Pcsclite-muscle] CCID driver release 1 3.45 %
    13 [Pcsclite-muscle] pcscd unable to handle second interface on ACS ACR1281U-C1 1 3.45 %
    14 [Muscle] Is there a way to know if a reader is contactless? 1 3.45 %
    15 [Pcsclite-muscle] [Muscle] Is there a way to know if a reader is contactless? 1 3.45 %
    16 [Pcsclite-muscle] acsccid 1.1.7 Released 1 3.45 %
    17 New version of libccid: 1.4.31 1 3.45 %
    18 [Pcsclite-muscle] Raise SCardTransmit timeout 1 3.45 %
    19 [Pcsclite-muscle] looking for fast ISO7816-3 card (clock and baud rates) 1 3.45 %
    20 [PATCH] Use poll() instead of select() 1 3.45 %
    21 [Pcsclite-muscle] select()-induced crashes (and attached 1 3.45 %
    22 [Pcsclite-muscle] NFC 1 3.45 %
    other 0 0.00 %

    Most used email clients:


     Mailer   Msg   Percent
    1 (unknown) 26 89.66 %
    2 Microsoft Outlook 16.0 2 6.90 %
    3 Mozilla/5.x 1 3.45 %
    other 0 0.00 %

    Table of maximal quoting:


     Author   Percent
    1 wrosenauer@gmail.com 39.19 %
    2 godfreyhkchung@gmail.com 16.23 %
    3 ertan@cronosmedikal.com 9.90 %
    4 00cpxxx@gmail.com 3.77 %
    5 ludovic.rousseau@gmail.com 2.78 %
    6 brice.gagnage@renault.com 0.87 %
    7 frankmorgner@gmail.com 0.00 %
    8 =?iso-8859-1?Q?Ralph_Pr=FCtting_=40_Active_Key_GmbH_=26_Co=2E_KG?= 0.00 %
    9 pnickerson@cashstar.com 0.00 %
    10 gsvelto@mozilla.com 0.00 %
    average 2.99 %

    Maximal quoting:


    Author : wrosenauer@gmail.com
    Subject : [Pcsclite-muscle] Interaction pcsc-lite and Yubikey

    Date : Thu, 31 Jan 2019 11:49:26 +0100

    Quote ratio: 78.91% / 4505 bytes

    Longest message:


    Author : ludovic.rousseau@gmail.com
    Subject : [Pcsclite-muscle] pcscd errors break https for chromium-based browsers
    Date : Tue, 26 Feb 2019 20:28:50 +0200
    Size : 363885 bytes

    Most successful subject:


    Subject : [Pcsclite-muscle] Interaction pcsc-lite and Yubikey
    No. of msgs: 4
    Total size : 19290 bytes

    Final summary:


    Total number of messages: 29
    Total number of different authors: 10
    Total number of different subjects: 22
    Total size of messages (w/o headers): 1518712 bytes
    Average size of a message: 52369 bytes



    Input file last updated: Wed Jan 1 16:53:58 2020 Generated by MailListStat v1.3

    Happy new year 2020

    Dear readers,

    I wish you a happy new year for 2020.

    In 2019 I published 25 articles on this blog (24 in 2018, 34 in 2017 and 49 in 2016 and 51 in 2015). It is stable compared to 2018.

    Audience

    The number of readers in 2019 is also stable compared to 2018.

    A large part of readers came from the USA. This year Germany is second followed by France.

    Most read articles

    Title # %
    PCSC sample in C 1 5.15 % =
    Blog homepage 2 4.80 % =
    PC/SC sample in different languages 3 4.62 % =
    Smart card integration in macOS Sierra: CryptoTokenKit plugin 4 3.42 % new
    PCSC sample in C# 5 3.02 % -1
    PCSC sample in Python 6 2,81 % -1
    pcscd auto start using systemd 7 2.80 % =
    PCSC sample in Java 8 2,19 % -2
    Linux NFC driver conflicts with CCID driver for ACS ACR122U 9 2.12 % +1
    PCSC sample in JavaScript (Node.js) 10 1.92 % -1

    PC/SC sample articles are always successful. I wrote them in 2010.

    The first article from those I wrote in 2019 is at position 20 and is "macOS Catalina and smart cards status".

    If I use the results for the previous month (Dec 2019) I find a different picture:
    We still have the old PC/SC samples (in C, Python, Java and C#) but also 4 articles about smart card and macOS.
    I am happy to see my blog is useful to macOS users, developers, etc.

    Thank you

    Thank you to you, readers.

    This blog has no advertising. If you want to support me you can send me some bitcoins. If you want to send $ or € instead of bitcoins then contact me.