One the goals of the Mono project is to make Microsoft .NET applications runnable on Unix systems. Using Mono, it is therefore now possible to maintain a single C#/.NET code base, that runs on Linux, Mac OS X and Windows.
In this context, SpringCard’s PC/SC SDK (https://www.springcard.com/en/download/find/file/pcsc-sdk) has been updated, so that it now enables developers to write PC/SC applications in C#/.NET, that can execute on Windows, as well as on Linux and Mac OS X platforms.
Targeted devices
This functionnality extends to all SpringCard PC/SC coupling devices (CrazyWriter, Prox’n’Roll, NFC Roll, CSB HSP, etc …)
Downloads
“SpringCardPCSC.cs” is the Springcard’s file that detects the operating system, and wraps the PC/SC commands around the “winscard” or “pcsc-lite” native library. This file is included in the SpringCard’s PC/SC SDK (https://www.springcard.com/en/download/find/file/pcsc-sdk).
In order to run C#/.NET applications on Linux and Mac OS X, Mono must be correctly installed on the target system (http://www.mono-project.com).
If the source code must also be compiled on a Unix platform, using “MonoDevelop” is highly recommended (http://www.monodevelop.com/).
Coding the application
The source code enabling portability between operating systems is located in full in “SpringCardPCSC.cs”. This means that, using this file, a developer shouldn’t even bother with the portability issue.
As a basic example, the following source code connects to a specific PC/SC coupling device and sends “FFCA000000” to a smartcard :
SCardReader reader = new ScardReader(“SpringCard Reader name”);
SCardChannel channel = new ScardChannel(reader);
if (channel.Connect())
{
CAPDU capdu = new CAPDU(“FFCA000000”);
RAPDU rapdu = channel.Transmit(capdu);
if (rapdu != null)
Console.WriteLine(“rapdu:” + rapdu.AsString(” “));
}
As long as “SpringCardPCSC.cs” comes from an SDK dating from may 2016 (or newer), this code should run on all Windows and Unix systems.
In a similar manner, replacing this particular file in an already-existant application is the only thing needed, to make it run on Linux and Mac OS X (provided Mono is installed)
Screenshots
Below are some screenshots, showing that PC/SC Windows Forms applications run on Mac OS X and Linux alike.