Wednesday, April 27, 2022

30 shades of PC/SC

In 2010 I started to write about the different programming languages you can use to talk to a smart card and a smart card reader.

12 years later I have 30 languages in the list.

They are, in alphabetical order:

  1. Ada
  2. C
  3. C#
  4. C for UEFI
  5. Common Lisp
  6. Elixir
  7. Erlang
  8. Flutter/Dart
  9. Free Pascal (Lazarus)
  10. go
  11. Java
  12. JavaScript (Node.js)
  13. Java using intarsys smartcard-io
  14. Kotlin
  15. lua
  16. Objective-C (synchronous)
  17. Objective-C (using Crypto Token Kit)
  18. OCaml
  19. Perl
  20. PHP5
  21. PHP (dead upstream as 11 January 2015)
  22. Prolog
  23. Python
  24. Python (using python-pcsclite)
  25. Ruby
  26. Rust
  27. Scala
  28. scriptor
  29. Smart Card Connector on Chromebook
  30. Swift (using Crypto Token Kit)

Top Computer Languages

Different lists exist for the top computer languages popularity. I will use the TIOBE Index for April 2022.

The "support" column indicates if the language has a smart card API available.

#
Language support
1 Python Yes
2 C Yes
3 Java Yes
4 C++ Yes
5 C# Yes
6 Visual Basic ?
7 JavaScript Yes
8 Assembly ?
9 SQL ?
10 PHP Yes
11 R ?
12 Pascal Yes
13 Go Yes
14 Swift Yes
15 Ruby Yes
16 Classic Visual Basic ?
17 Objective-C Yes
18 Perl Yes
19 Lua Yes
20 Mathlab ?
21 SAS ?
22 Prolog Yes
23 (Visual) FoxPro ?
24 Scratch ?
25 COBOL ?
26 Julia ?
27 Kotlin Yes
28 Rust Yes
29 Ada Yes
30 Lisp Yes
31 Fortran ?
32 Groovy ?
33 VBScript ?
34 PL/SQL ?
35 D ?
36 Scala Yes
37 Haskell ?
38 Dart Yes


Comments

It should be easy to call the C WinSCard API from assembly language. So the answer could be "yes". I learned assembly language with a Motorola 6809 and then a Motorola 68000. I am not a fan of the Intel x86 assembly language with its very strange register names (to be backward compatible). Yes, I could also use ARM or RISC-V CPUs. I let the exercise to write an example in assembly language to the readers.

Not listed

Some programming languages are not listed in the TIOBE index but do provide a PC/SC wrapper:

  • Elixir
  • Erlang
  • OCaml

Windows technologies

Some languages are specific to the Microsoft Windows system. I can't use them since I do not use Windows. They are:

  • Visual Basic
  • Classic Visual Basic
  • VBScript
  • Visual FoxPro.

It looks like Visual Basic is also available for GNU/Linux. But I don't want to invest time in these technologies.

Also note that all the computer languages with PC/SC support exist in a Free Software implementation. I am not sure for the Microsoft languages.

Language I would be surprised to get PC/SC support

R and SAS are languages used for statistics.

Scratch is used for education.

Mathlab is for numeric computing.

COBOL is very old. I do not expect any COBOL program needing access to smart cards. Same remark for Fortran. COBOL and Fortran are still used and it looks like it is possible to call C functions from both of them. So there is hope .

Languages that could have a PC/SC wrapper

What I had not yet found

SQL: (SQL Server) PC/SC List Smart Card Readers (and USB Tokens)

This is for SQL Server, so may be limited to the Microsoft product and not the SQL language.

Conclusion

It was a lot of fun to discover and write a sample codes for all the 30 languages.

For some (4) of the PC/SC wrappers I am the maintainer so writing a sample code was easy.

The list is not finished and may never be as new programming languages are created from time to time. If you want me to add a new language please contact me.