Some tools to be used with smart cards and PC/SC
================================================

This archive contains some tools useful for a PC/SC user.
PC/SC lite [1] from MUSCLE [2].

The tools provided are:

- pcsc_scan (Ludovic Rousseau <ludovic.rousseau@free.fr>)
    regularly scans every PC/SC reader connected to the host
    if a card is inserted or removed a "line" is printed

    For example:

     PC/SC device scanner
     V 1.4.5 (c) 2001-2006, Ludovic Rousseau <ludovic.rousseau@free.fr>
     PC/SC lite version: 1.3.1
     0: GemPC410 0 0
     1: GemPC430 0 0
     
     Wed Aug 21 10:08:02 2002
      Reader 0 (GemPC410 0 0)
             Card state: Card removed, 
     
     Wed Aug 21 10:08:09 2002
      Reader 0 (GemPC410 0 0)
             Card state: Card inserted, 
             ATR: 3B 6D 00 FF 00 31 80 71 8E 64 48 D5 02 00 82 90 00
     
     ATR: 3B 6D 00 FF 00 31 80 71 8E 64 48 D5 02 00 82 90 00
     + TS = 3B --> Direct Convention
     + T0 = 6D, Y(1): 0110, K: 13 (historical bytes)
       TB(1) = 00 --> Programming Param P: 0, I: 0
       TC(1) = FF --> Extra guard time: 255
     + Historical bytes: 00 31 80 71 8E 64 48 D5 02 00 82 90 00
       Category indicator byte: 00 (compact TLV data object)
         Tag: 3, len: 1 (card service data byte)
           Card service data byte: 80
             - Application selection: by full DF name
             - EF.DIR and EF.ATR access services: by GET RECORD(s) command
             - Card with MF
         Tag: 7, len: 1 (card capabilities)
           Selection methods: 8E
             - DF selection by full DF name
             - Implicit DF selection
             - Short EF identifier supported
             - Record number supported
         Tag: 6, len: 4 (pre-issuing data)
           Data: 48 D5 02 00
         Mandatory status indicator (3 last bytes)
           LCS (life card cycle): 82 (Proprietary)
           SW: 9000 (Normal processing.)
     
     Possibly identified card:
     3B 6D 00 FF 00 31 80 71 8E 64 48 D5 02 00 82 90 00
             Blue for Business, American Express@Business

     Wed Aug 21 10:09:57 2002
      Reader 0 (GemPC410 0 0)
             Card state: Card removed, 


- ATR_analysis (Christophe Levantis and Ludovic Rousseau)
    Perl script used to parse the smart card ATR.
    This script is called (by default) by pcsc_scan

    This code was originally written by Christophe in August 2000 for a
    Perl wrapper using "TLP driver" (and not PC/SC) to access the
    smartcard.


- smartcard_list.txt (Ludovic Rousseau)
    This list contains ATR of some cards. The list is used by
    ATR_analysis to find a card model corresponding to the ATR.
    I took the initial list from SCEZ by Matthias Bruestle.

    Please send me (<ludovic.rousseau@free.fr>) any ATR and card
    description not included in the list.


- scriptor (Lionel Victor <lionel.victor@unforgettable.com>)
    A Perl script to send commands to a smart card. You can use a file
    containing the commands or stdin.


- gscriptor (Lionel Victor <lionel.victor@unforgettable.com>)
    A Perl script to send commands to a smart card with GTK-based
    graphical interface.


You will need the package pcsc-perl [3] to be able to use scriptor and
gscriptor.

[1] https://pcsclite.apdu.fr/
[2] https://muscle.apdu.fr/
[3] https://pcsc-perl.apdu.fr/


Authors:
========

- Lionel VICTOR for scriptor and gscriptor
- Ludovic ROUSSEAU for pcsc_scan, ATR_analysis and debug of scriptor and
  gscriptor
- Christophe LEVANTIS for the original code of ATR_analysis


Licences:
=========

    pcsc-tools
    Copyright (C) 2001       Lionel VICTOR
    Copyright (C) 2001-2012  Ludovic ROUSSEAU

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA


History:
========

1.7.2 - 10 August 2024, Ludovic ROUSSEAU
    - 191 new ATRs
    - provide meson configuration file
    - improve pcsc_scan Windows support
      . Use Ctrl-C also on Windows
      . Windows can also use option -n
      . better output on Windows dumb terminals
    - minor fixes and improvements

1.7.1 - 30 December 2023, Ludovic ROUSSEAU
    - 64 new ATRs
    - configure: Use ATR_analysis by default on GNU/Linux
    - improve Windows support

1.7.0 - 7 October 2023, Ludovic ROUSSEAU
    - 182 new ATRs
    - pcsc_scan:
      . add debug option -d
      . add PnP option -p
    - gscriptor: i18n and l10n in English (default), French and Russian
    - configure: add --enable-ATRparser=foobar to specify an ATR parser
    - minor fixes and improvements

1.6.2 - 22 January 2023, Ludovic ROUSSEAU
    - 18 new ATRs
    - smartcard_list.txt moved to https://pcsc-tools.apdu.fr/smartcard_list.txt

1.6.1 - 30 December 2022, Ludovic ROUSSEAU
    - 196 new ATRs
    - use colors on NetBSD ("wsvt25" terminal)
    - pcsc_scan: always print the version in verbose mode

1.6.0 - 29 January 2022, Ludovic ROUSSEAU
    - 48 new ATRs
    - pcsc_scan:
     . drastically reduce the number of SCardGetStatusChange() calls
     . faster spinning animation
     . handle Ctrl-C on macOS

1.5.8 - 7 November 2021, Ludovic ROUSSEAU
    - 360 new ATRs
    - ATR_analysis:
     . fix TB2 parsing error
     . misc spelling fixes
    - pcsc_scan:
     . add maxtime option -t
     . add the option -c to list cards only once
     . no spinner in quiet mode (-q)
     . turn off colour if redirected output
     . Exit if no reader is found and -c or -r is used

1.5.7 - 7 July 2020, Ludovic ROUSSEAU
    - 116 new ATRs
    - ATR_analysis: Update URL of the online parser

1.5.6 - 8 March 2020, Ludovic ROUSSEAU
    - 62 new ATRs
    - pcsc_scan: better support of Windows

1.5.5 - 4 January 2020, Ludovic ROUSSEAU
    - 353 new ATRs
    - scriptor: add -u option to make stdout unbuffered

1.5.4 - 12 December 2018, Ludovic ROUSSEAU
    - 213 new ATRs
    - pcsc_scan: display the number of events
    - gscriptor: port from Gtk+2 to Gtk+3

1.5.3 - 15 April 2018, Ludovic ROUSSEAU
    - 253 new ATRs
    - pcsc_scan (thanks to Pascal J. Bourguignon):
     . add -v argument (default) for verbose
     . add -q argument for quiet
     . add -r argument to display the reader list
     . allow to use Control-C to break execution

1.5.2 - 28 May 2017, Ludovic ROUSSEAU
    - include gscriptor.desktop and test.script in the archive

1.5.1 - 28 May 2017, Ludovic ROUSSEAU
    - rename the archive pcsc-tools

1.5.0 - 28 May 2017, Ludovic ROUSSEAU
    - 221 new ATRs
    - pcsc_scan:
      . add APDU stress mode (-s) (send "Select MF" APDU in a loop)
      . display an animation while waiting for a card or reader event
    - use autoconf/automake
      . macOS support with no change
      . Windows support (using MSYS2 http://www.msys2.org/)

1.4.27 - 2 June 2016, Ludovic ROUSSEAU
    - 72 new ATRs
    - ATR_analysis: propose to submit the ATR if not known
    - pcsc_scan: Handle "simultaneous" readers removal

1.4.26 - 19 March 2016, Ludovic ROUSSEAU
    - 77 new ATRs
    - ATR_analysis: fix display the submission message
    - fix typos in pcsc_scan.1 and scriptor.1p man pages

1.4.25 - 8 November 2015, Ludovic ROUSSEAU
    - 44 new ATRs
    - ATR_analysis: fix the update of the local cache

1.4.24 - 7 August 2015, Ludovic ROUSSEAU
    - 253 new ATRs
    - ATR_analysis: better update of the local cache

1.4.23 - 13 September 2014, Ludovic ROUSSEAU
    - 137 new ATRs

1.4.22 - 17 January 2014, Ludovic ROUSSEAU
    - 215 new ATRs
    - Fetch a new ATR file if it was not upgraded in the last 10
      hours.
    - Propose to use http://smartcard-atr.appspot.com/parse to submit a
      new ATR
    - minor fixes

1.4.21 - 5 Dec 2012, Ludovic ROUSSEAU
    - Do not log the time every second on "old" PC/SC without support of
      \\?PnP?\Notification like on Mac OS X.
    - 79 new ATRS
    - minor fixes

1.4.20 - 16 June 2012, Ludovic ROUSSEAU
    - Makefile: Add arguments to CFLAGS instead of overwriting them
    - 3 new ATRs

1.4.19 - 13 June 2012, Ludovic ROUSSEAU
    - ATR_analysis: use XDG_CACHE_HOME env variable
      The smartcard_list.txt file is now searched in ~/.cache/ by default
    - 115 new ATRs

1.4.18 - 18 December 2011, Ludovic ROUSSEAU
    - gscriptor: Display hex dumps in lines of 16 bytes instead of 17
    - gscriptor: Display bytes of value 0x20 as ' ' instead of '.'
    - scriptor: Display lines of 16 bytes instead of 24
    - 223 new ATRs
    - pcsc_scan: Correctly detect reader Plug and Play support

1.4.17 - 18 August 2010, Ludovic ROUSSEAU
    - 153 new ATRs
    - Allow to build with pcsc-lite >= 1.6.2

1.4.16 - 12 January 2010, Ludovic ROUSSEAU
    - 153 new ATR
    - pcsc_scan.c: check for PnP support at run time instead of using a
      #define
    - ATR_analysis: use curl instead of wget on Darwin
    - gscriptor: ReaderConfig(): escape metacharacters []() in
      the reader name when using reader name as a pattern matching

1.4.15 - 9 January 2009, Ludovic ROUSSEAU
    - 68 new ATR
    - ATR_analysis:
     . truncate the ATR if extra bytes are present (like on Leopard with
     an ATR padded with 0 up to 33 bytes)
     . add value for Di=7 (7816-3:2006 page 19)
     . check if Fi is RFU when calculating baud rate
     . display the max frequency associated with Fi
    - pcsc_scan.c: use "\\?PnP?\Notification" mechanism when possible

1.4.14 - 11 May 2008, Ludovic ROUSSEAU
    - 24 new ATR
    - gscriptor, scriptor: use SCARD_SHARE_SHARED instead of
      SCARD_SHARE_EXCLUSIVE to not lock the card
    - ATR_analysis: add support for ATR with : as byte separator (ATR
      reported by "opensc-tool --atr" for example)

1.4.13 - 23 March 2008, Ludovic ROUSSEAU
    - 29 new ATR
    - pcsc_scan: avoid a bug when the last reader is removed

1.4.12 - 2 February 2008, Ludovic ROUSSEAU
    - 18 new ATR
    - handle SCARD_E_NO_READERS_AVAILABLE when no reader is found

1.4.11 - 30 October 2007, Ludovic ROUSSEAU
    - 69 new ATR
    - use /usr/bin/env perl to get the correct Perl
    - print card description in blue

1.4.10 - 10 August 2007, Ludovic ROUSSEAU
    - 25 new ATR
    - scriptor: correctly display the ISO7816 error code even when the
      line is split
    - gscriptor: the line continuation feature was broken

1.4.9 - 1 June 2007, Ludovic ROUSSEAU
    - 69 new ATR
    - pcsc_scan.c: use pcsc_stringify_error() to display a human
      readable error message
    - ATR_analysis: add colors
    - scriptor:  echo the lines read from a file (commands, comments and
      empty lines)

1.4.8 - 26 Novembre 2006, Ludovic ROUSSEAU
    - 14 new ATR
    - pcsc_scan: cleanly fail (instead of looping forever) if the pcscd
      daemon just dies
    - ATR_analysis:
      . add test for TC1=255
      . add case TB1=0: VPP is not electrically connected
      . add the communication speed according to TA1 and a clock at
        3.5712 MHz
      . use %g instead of %.3f to display the cycles/ETU value to have
        31 instead of 31.000

1.4.7 - 4 October 2006, Ludovic ROUSSEAU
    - 10 new ATR
    - pcsc_scan.c: add a couple of fflush(stdout); to force the display
      so that redirection works. Thanks to Johannes Becker for the bug
      report

1.4.6 - 12 August 2006, Ludovic ROUSSEAU
    - 28 new ATRs in smartcard_list.txt
    - scriptor/gscriptor: allow multi-lines input and wrap long output.
      lines ending with \ are to continue on the next line. More easy to
      use a 64K-bytes long APDU.

1.4.5 - 8 May 2006, Ludovic ROUSSEAU
    - 9 new ATR
    - improve ATR_analysis: add code to parse the historical bytes

1.4.4 - 25 Mar 2006, Ludovic ROUSSEAU
    - 4 new ATR
    - improve gscriptor GUI: add icons in the dialog boxes, use button boxes
    - improve ATR_analysis: display and check TCK

1.4.3 - 9 Mar 2006, Ludovic ROUSSEAU
    - the glibc do not accept double free() anymore and stops the
      process instead "*** glibc detected *** double free or corruption
      (fasttop): 0x0804b070 ***". So be sure not to call free() a second
      time on the same pointer.

1.4.2 - 7 Mar 2006, Ludovic ROUSSEAU
    - 58 new ATR in smartcard_list.txt
    - pcsc_scan: add color output support
    - add a freedesktop.org compatible menu entry for gscriptor (thanks
      to Ville Skyttä)

1.4.1 - 29 May 2005, Ludovic ROUSSEAU
    - 42 new ATR in smartcard_list.txt
    - ATR_analysis:
     . accept 3B A7 00 40 18 80 65 A2 08 01 01 52 and not just '3B A7 00
       40 18 80 65 A2 08 01 01 52' as command line argument
     . check ~/.smartcard_list.txt for known ATR
     . add instructions to download and install a new version of the list
    - gscriptor: if only one reader is found use it unconditionally

1.4.0 - 6 August 2004, Ludovic ROUSSEAU
    - 13 new ATR in smartcard_list.txt
    - rewrite of gscriptor using libgtk2-perl
    - if the command does not contains spaces (00A4030000) we expand it

1.3.4 - 4 July 2004, Ludovic ROUSSEAU
    - 5 new ATR in smartcard_list.txt
    - pcsc_scan.c: LPSTR -> LPTSTR for pcsc-lite 1.2.9 beta4
    - scriptor, gscriptor: only send the 5 last characters of the
      response to Chipcard::PCSC::Card::ISO7816Error()
      The SW was sometimes not correctly parsed.
    - Makefile: use 'pkg-config libpcsclite [--cflags|--libs]'

1.3.3 - 2 April 2004, Ludovic ROUSSEAU
    - use a dynamic table for readers to avoid any use of the deprecated
      PCSCLITE_MAX_CHANNELS constant
    - 11 new ATR in smartcard_list.txt
    - add support of PCSC MacOS X framework

1.3.2 - 17 December 2003, Ludovic ROUSSEAU
    - scriptor: by default let pcscd select the protocol among T=0 and T=1 
      . print the protocol actually used
      . print textual status word according to ISO 7816
    - gscriptor: change menu accelerator for Run so it can be used even
      if a text Text widget is selected
      . use paned windows to resize Script and Result frames
      . print textual status word according to ISO 7816
    - 16 new ATR in smartcard_list.txt

1.3.1 - 29 Octobre 2003, Ludovic ROUSSEAU
    - ATR_analysis: only ask to send me the ATR and card description if
      it is a microprocessor card. I am not (yet) interested in a list
      of memory cards.
    - scriptor, scriptor.1p: add -p argument to specify the ISO 7816
      protocol to use (T=0 or T=1)
    - 26 new ATR in smartcard_list.txt

1.3.0 - 31 May 2003, Ludovic ROUSSEAU
    - pcsc_scan.c: detect reader insertion/removal (USB) and adjust the
      reader list accordingly
    - 4 new ATR in smartcard_list.txt

1.2.5 - 25 May 2003, Ludovic ROUSSEAU
    - use new naming scheme from pcsc-perl Chipcard::PCSC instead of
      PCSC
    - 32 new ATR in smartcard_list.txt

1.2.4 - 28 Jan 2003, Ludovic ROUSSEAU
    - 20 new ATRs in the database
    - Makefile: use PCSCBASE to find libpcsclite library

1.2.3 - 16 Nov 2002, Ludovic ROUSSEAU
    - Add the URL of the latest smartcard_list.txt file in the error
      message printed if the ATR is not already known
    - use an updated version of smartcard_list.txt

1.2.2 - 15 Oct 2002, Ludovic ROUSSEAU
    - correct some compilation problems. See Makefile if you have a xBSD
      system
    - use an updated version of smartcard_list.txt. Thanks to all the
      contributors.

1.2.1 - 27 Aug 2002, Ludovic ROUSSEAU
    - add ATR to smartcard_list.txt
    - make the ATR match case insensitive

1.2.0 - 21 Aug 2002,  Ludovic ROUSSEAU
    - creation of smartcard_list.txt
    - exploitation of the ATR list by ATR_analysis

1.1.0 - 14 Jun 2002, Ludovic ROUSSEAU
    - include ATR_analysis and support for it in pcsc_scan
    - modify pcsc_scan.c to listen to all the readers at once (Lionel)

1.0.4 - 6 Mar 2002, Ludovic ROUSSEAU
    - gscriptor: case insensitive on "reset" command
    - scriptor: case insensitive on "exit" and "reset" commands
    - add the history, authors and licence in this README

1.0.3 - 8 Nov 2001, Ludovic ROUSSEAU
    - pcsc_scan.c: set the wait time to 0 to get all the events
    - Makefile: add automatic rules to compress man pages and other
      modifications

1.0.2 - 22 Oct 2001, Ludovic ROUSSEAU
    - add manpages
    - pcsc_scan.c: go to the next reader _after_ printing information
      for the current one

1.0.1 - 18 Oct 2001, Ludovic ROUSSEAU

 vim:ts=8:
