Category Applications & Software tools

SpringCard PC/SC solution for Android has been released

SpringCard R&D team is proud to release a simple software solution to add support for SpringCard USB PC/SC Couplers to Android tablets (or smartphone).

nexus9-with-springcard-pcsc-reader

A Nexus 9 Android tablet, with a SpringCard Prox'N'Roll PC/SC reader on the USB port, and a Desfire contactless smartcard

The software is made of two parts:

googleplaystore

The SpringCard USB PC/SC Service's page on Google Play store

This software suite is compliant with all SpringCard USB PC/SC Couplers, for instance SpringCard Prox'N'Roll PC/SC, Prox'N'Roll HSP PC/SC, TwistyWriter HSP, CrazyWriter HSP, CSB HSP... Note that the current version of the Service and Library allows to work only with the Coupler's contactless slot. Don't hesitate to contact us if you have an interest into addressing the smartcard / SAM slots of the Couplers.

To communicate with a USB PC/SC Coupler -which is basically a USB device, the Android tablet (or smartphone) must provide a USB Host stack. This should be the case of all tablets running Android 3.1 and higher. We recommend Nexus 7 and Nexus 9 tablets, running Android 5.0 or 5.1, which are the reference platforms we use to develop and test the solution. An adapter cable is required to connect the Coupler if your tablet doesn't provide a full-size USB host connector.

usb-adapter-for-tablets-proxnroll

The USB adapter to use a SpringCard USB PC/SC smartcard reader with a tablet featuring only an USB on-the-go (OTG) mini type B female port

Tip: if you're not sure whether your tablet supports USB Host or not, just install the Service and the Demo application from Google Play, and check that your SpringCard Coupler is correctly activated by your tablet's system. Remember that the Coupler will be powered by the tablet's battery. Some tablets could be powered (by their mains adapter) even when an USB device is present, but most don't; choose your tablet accordingly if you're designing a kiosk or public-use system that should be mains-powered 24/7).

Icon of the SpringCard PC/SC Service for Android

Icon of the SpringCard PC/SC Service for Android

To develop your own application using a SpringCard Coupler from Android, download the library (and the sample Demo application) from GitHub, and follow the Quick Start Guide (ref. SpringCard PMD15240) which is included in the GitHub project, or available directly here.

github

The SpringCard SDK for PC/SC on Android is an open-source project hosted on GitHub

We welcome your feedback!

 

SpringCard introduces new SDK for NFC-enabled PC/SC readers

It's now the final countdown before the launch of new SpringCard NFC products, H512 and NFC'Roll. Both products are not only able to read/write NFC Tags, but they also introduce NFC peer-to-peer communication and an innovative Card emulation mode.

The developers who already have an early release of either product, or who want to start evaluating the development process, are welcomed to download the first version of the SDK, which has been made available today, together with its documentation.

The NFC SDK for PC/SC includes
- NFcTool, a Tag read/write Utility,
- NFcBeam, implementing the NFC Forum 'Simple NDEF Exchange Protocol' (SNEP) on top of NFC Forum LLCP (Logical Link Control Protocol), itself on top of NFC-DEP, i.e. the NFCIP1 peer-to-peer layer (ISO 18092 chapter 12). A typical use-case would be to retrieve a contact entry (VCard) from an Android smartphone, or to push a SmartPoster from the PC to the smartphone,
- NfcTagEmul, showing how easy it is for either H512 or NFC'Roll to emulate a NFC Forum Tag (type 2 or type 4). This makes it possible to push a SmartPoster, URI, Text, VCard... from the PC to the smartphone, as smoothly as if the phone was reading a static Tag,
- and much more!

Edit 15/10/2013: starting with PC/SC SDK version 2.12, the NFC extensions are now included in the PC/SC SDK itself. Please read this article for details.

Those software are available with complete source (C# for .NET) in the SDK. Please download and read PMD2228: NFC SDK for PC/SC - Getting Started Guide for a guided tour and a few technical details.

Click here to download SpringCard NFC SDK for PC/SC

The reference manual for operating the readers from PC/SC applications is here: PMD2176: H512 (and NFC'Roll) Developer's Reference Manual.

An installer is also available (SQ2211: QuickStart for H512 and NFC'Roll) for people who want to try the products but don't need the full SDK.

Warning: a few changes have been on the specifications since the Alpha version of the firmware (1.6x branch). Products shall be updated to firmware v1.70 in order to be compliant with the final specifications, and to work with this SDK. Current 1.7x branch doesn't include peer-to-peer in Target mode (only Initiator mode is currently implemented). This will be added in 1.8x branch.

Print and encode simultaneously using SpringCard CrazyWriter and Evolis Zenius

Evolis Zenius is a color or monochrome card printer. Evolis offers SpringCard CrazyWriter PC/SC (ISO 14443, ISO 15693 + 2 SAM) as the contactless encoding option for Zenius -as well as for the other printers in its portfolio. Zenius plus CrazyWriter makes it easy to issue personalized cards on-the-field.

In this article we'll show how to synchronize the card encoding part (CrazyWriter PC/SC) with the card printing job using Evolis' SDK. Our sample project (C# source code available in the PC/SC SDK, under folder /samples/dotnet/ZeniusVCard) is a real-world example: we print a business card on a Desfire EV1 smartcard, and we store a vCard object into the Desfire, following NFC Forum standard known as 'NFC Forum Type 4 tag'. Doing so, the business card goes NFC and could be read by any compliant smartphone, that will automatically add the vCard data to its contact list! All you need to try the demo by yourself is a blank and virgin Desfire EV1 card, and, of course, an Evolis Zenius printer featuring SpringCard CrazyWriter.

In a nutshell

To print and encode a vCard, the process is as follows:

  1. Ask the printer to take one card in the feeder, and to put it in position for encoding (in front of the CrazyWriter's antenna),
  2. Recognize the card, format it if needed, write the data,
  3. Launch the print job,
  4. Optionnaly repeat the process, until there is no card left in the feeder.

The process always encodes a card before printing it. Doing so, should any problem append (not the expected type of card, card locked read-only...), the card is ejected immediately. No time nor ribbon has been waisted printing a useless card.

Architecture

There are two ways to communicate with an Evolis printer:

  • using the Windows spooler (as with any other printer),
  • using iomem.dll, a communication library supplied within Evolis' SDK.

Sending print jobs to the spooler is straightforward as all the steps of the printing are handled automatically by the system. Unfortunately, once the job is launched, the software has no way to know where the card actually is in the printer nor to stop it for a few seconds in front of the antenna..

On the other end, sending low level commands through iomem.dll offers a lot of flexibility, but lots of things have to be re-implemented in the printing software. This requires a specific expertise and can be time consuming.

So we'll take the best of the two worlds: iomem.dll will be used to drive the card in the printer until the CrazyWriter has done its job, and afterwards a print job will be sent to the spooler to actually print the card. We'll also have to use iomem.dll again to detect the end of the print job, so our software will not try to insert another card in the path until the previous card has been printed and ejected.

Step by step explanation of the sample project

Selecting the target printer and contactless coupler

The .NET PrintDialog object (System.Windows.Controls.PrintDialog) if the easiest way to select a printer. The name of the selected printer is returned in PrintDialog.PrinterSettings.PrinterName.

There's no immediate way to know which CrazyWriter (or in general which PC/SC reader) belongs to the selected printer. So we display our common 'Select PC/SC Reader' dialog to let the user find the reader. Default is to select the contactless interface of the first available CrazyWriter.

Controlling the printer through iomem.dll

First step is to gain access to iomem.dll's entry points from our C# application. The function used are:

  • OpenPebble
  • ClosePebble
  • ReadPebble
  • WritePebble
  • GetTimeout
  • SetTimeout


Please refer to Evolis' SDK for a detailed documentation of the DLL.

OpenPebble(PrinterName) gives use access to the printer, we then can use the couple WritePebble/ReadPebble to send arbitrary commands to the printer -and wait for its answer.

Here are the 3 only commands we need:

  • Rlr;h to check whether the feeder is empty,
  • Sic to load a card from the feeder, and to move it into position for encoding (in front of the CrazyWriter's antenna),
  • Se to eject the card (in case the encoding has failed).

If the encoding is successful, sending a print job to the spooler is enough to make the printer take the card from its current position (in front of the antenna), print it, and eject it.

To know whether the print job is terminated or still pending, we'll use a very simple trick: as the printer is not available to answer to iomem.dll commands while it is under control of the system's spooler, we'll send repeated dummy commands, and we'll know that the job is ended when we'll get an answer at last. The dummy command is:

  • Rfv read firmware version

Please also refer to Evolis' SDK for details regarding the printer's command set.

Encoding the vCard on the contactless card

This part is shared with the vCard part of NFCTool, another of our samples. The only difference is that NFCTool can also read cards, and implements a 'wake up on card arrival' scheme that doesn't have to be implemented in this sample. The card 'arrives' only after a successful invocation of the "Sic" control command.

We start by opening a PC/SC channel to the card: scard = new SCardChannel(ReaderName) (see the documentation of our PC/SC for .NET API for details).

Then we use the methods of our NfcTag object (NfcTag.IdentifyTagType, NfcTag.BackgroundRecognize) to check whether the card is a NFC Forum tag or not. It must be either already formatted (and offering enough memory space to store the vCard) or a Desfire EV1 that we know how to format and write. Note that BackgroundRecognize, as the name says, performs the recognition in a background thread and invoke a callback function once done. This is generally speaking a good practice to implement card-related stuff in a background thread so the application's window remains 'alive' even if the card takes its time to answer. At this step, the card is now for sure compliant with NFC Forum type 4 specification (or has been ejected if not, or if the user has chosen not to overwrite existing data).

Eventually, a new NfcVCard object is created, populated with the data entered by the user, and inserted as the content of the NfcTag objet. The the NfcTag.BackgroundWrite method is called, so the vCard content goes actually into the card. Once again this is done in a background thread.

Printing the layout on the card

At the end of the writing (that takes no more than one second anyway), the callback that is invoked launches the print job.

To print our business card, we process as follow:

  1. Create a PrintDocument object (System.Drawing.Printing.PrintDocument),
  2. Add to this PrintDocument object a PrintPageEventHandler function that will be invoked to actually draw the layout,
  3. Code the PrintPageEventHandler to implement the drawing of the business card from the data entered by the user,
  4. Invoke the PrintDocument.Print() method to send it to the spooler.

In this example, the PrintPageEventHandler is implemented in the FormatBusinnessCard function. The name and the title are printed in the middle of the card, respectively in Arial 16 and Arial 14; the contact information (business phone and e-mail) are in the down-left corner in Arial 10; the picture is printed in the up-right corner; etc... Of course this is the first thing you'll have to change to design your cards according your own layout.

Waiting for the end of the job

Once PrintDocument.Print() has been called, there's nothing else to do but wait. The spooler works in background, so the application is free to do anything else, but we can't start encoding another card until the current one has been printed and ejected. Therefore we implement a waiting loop, sending the "Rfv" command through iomem.dll repeatedly. Once the printer responds, we know that the job is over. We could then loop to go on with the next card.

PC/SC driver updated

We've just published a new release of our WHQL-certified driver for SpringCard PC/SC products. This new version (code name: SDD480-BB) fixes a few bugs that have been experienced with the earlier release:
- corrected a memory leakage that used to occur as a consequence of frequent SCardControl calls
- CSB6 now reports correctly "card mute" when a card is physically inserted but unresponsive
- improved overall stability on multi-slot readers thanks to a stricter synchronization of SCardTransmit calls

To download the driver, please go to http://www.springcard.com/download/find.php?file=sdd480. The installer now contains both x86 and x64 binaries, and select automatically the one adapted to your system. It will also be available through Windows Update in a few days.

As the previous one, this release targets all SpringCard USB CCID readers :
- CSB6
- CrazyWriter
- EasyFinger
- Prox'N'Roll PC/SC

Users are welcome to deploy this new release as soon as possible.

New PC/SC SDK and sample applications

The version 2.00 of our PC/SC SDK is now available for download: pcsc-sdk_2-00.zip. This SDK works with our PC/SC readers (CSB6Prox’N’Roll PC/SCEasyFinger and CrazyWriter).

This release of the SDK includes a new PC/SC Diag application, rewritten from scratch in C# for the .NET framework (previous version written in C++ with MFC for Win32 is still available anyway). This PC/SC Diagnostic application makes it easy to exchange APDU commands/responses (SCardTransmit) with the smartcard in a given reader, and/or to send directly control commands to the reader itself (SCardControl). Giving the user full control on the various options given by the other winscard.dll's function (SCardConnect, SCardReconnect, SCardDisconnect), this new version of PC/SC Diag is the must-have utility to discover the PC/SC world and to explore virtually any smartcard "by hand".

The SDK provides both the source code and the compiled binaries. Should you want to use the software directly, you may download and install PC/SC Diag for Windows through this setup package: PC/SC Diag setup (SQ2075).

The SDK also now includes a brand new application to deal with NFC Forum tags, according to the SmartPoster and vCard specifications. NFCTool is able to both format, write and read the popular NFC Forum type 2 tags (NXP Mifare UL and UL C family, Infineon My-D NFC SLE66 series, Kovio 2KB tags, and more) and also the NFC Forum type 4 tags (formatting is implemented only for NXP Desfire EV1, but read/write is designed to operate with virtually any compliant card already formatted). A companion to NFCTool is NFCSpTray is a small utility that sits in the tray-bar and waits "silently" until a tag holding a valid SmartPoster is presented on the contactless reader. Then NFCSpTray opens the SmartPoster's URL in your default web browser. This is the first step for a NFC Forum SmartPoster-based navigation on Windows!

The SDK provides both the source code and the compiled binaries. Should you want to use the software directly, you may download and install NFCTool and NFCSpTray for Windows through this setup package: NFCTool and NFCSpTray setup (SQ2074).

New WHQL-certified PC/SC driver

Edited 24/04/2012: an updated version has been published to correct a few bugs. Please read this article.

Our new PC/SC driver is now online and ready for download! This driver (code name : SDD480-BA) has been certified my Microsoft's Windows Hardware Qualification Labs (WHQL) for both 32 and 64 bits operating systems.

It targets all SpringCard USB CCID readers :
- CSB6
- CrazyWriter
- EasyFinger
- Prox'N'Roll PC/SC

Note: as the Prox'N'Roll has only one smartcard slot (its contactless card interface), it is not required to use our driver since the default CCID driver supplied by Microsoft also does the job.

The SDD480-BA driver is also ready for the new generation of USB CCID products that will be launched in a near future.

To download the driver, please go to http://www.springcard.com/download/find.php?file=sdd480

Choose either
- sdd480_x86-ba.exe for 32 bits targets (certified and signed for Windows 2000, XP, Vista and Seven on i386 core)
- sdd480_x64-ba.exe for 64 bits targets (certified and signed for Windows XP, Vista and Seven on amd64 or intel64 core)

The setup package uncompress the driver in Program Files\SpringCard\SDD480_x86-ba (or Program Files\SpringCard\SDD480_x64-ba depending on the target) and then installs the driver into Windows' system directory. Of course you must run the setup with administrative priviledges.

The driver will also be available through Windows Update very soon.

A few more details for integrators and developers

Should you need to redistribute this driver with your own software or to recreate a setup package bundled with yours, just copy the uncompressed files and invoke DPInst.exe when you want the installation to take place.

Although we've done our best to ensure full compatibility with our previous (unsigned) driver and with Microsoft's default CCID driver, please pay attention that the naming of the slots may be a little different in some cases. In fact slot naming and numbering has been designed to show clearly which slots belongs to which reader. Let's suppose we have 2 CrazyWriter and 1 CSB6 connected to the PC. The 1st CrazyWriter instanciates 3 slots: CrazyWriter Contactless 0, CrazyWriter SAM A 0, CrazyWriter SAM B 0; the 2nd CrazyWriter instanciates 3 slots as well: CrazyWriter Contactless 1, CrazyWriter SAM A 1, CrazyWriter SAM B 1. Then the CSB6 instanciates 5 slots : CSB6 Contactless 2, CSB6 Contact 2, CSB6 SAM A 2, CSB6 SAM B 2, CSB6 SAM C 2. You see that the number is the same for all slots of one reader. This is the best approach to know which SAM (or contact interface) comes with whatever contactless interface.

Upgrade in our PC/SC SDK (release 1.20)

The release 1.20 of SpringCard PC/SC SDK is now available in the Download section of the website (direct link to latest version : http://www.springcard.com/download/find.php?file=pcsc-sdk). This SDK is meant to be used with our products in the SpringCard CSB6 Family (CSB6Prox’N’Roll PC/SCEasyFinger and CrazyWriter).

People working in the 'emerging' NFC field will be glad to discover the updated versions of NFCTool, a .NET based application (written in C#) that makes it easy to create or to read NFC Tags compliant with the SmartPoster specification (as published by NFC Forum). Command-line nfc_create utility is also very useful to encode batches of NFC Tags.

The Desfire support library (pcsc_desfire.dll on Windows) has been upgraded; it now fully supports all the new features of NXP Desfire EV1 smartcards: AES and Triple-DES with 3 keys (3KDES), ISO 7816-4 compliant directories and files, card-level configuration. NXP Mifare UltraLight C chips are supported easily thanks to a new library (pcsc_mifulc.dll). Also, we've added in the SDK the Calypso support library (pcsc_calypso.dll) and its related sample software. All those libraries come with C source code.

New command line utilities have also been written for the ones who want to master PC/SC from its very basis, or have portability in mind. Most our C examples now run on Linux without any modification.

Java + PC/SC = accessing smartcards from a web page

The Java Smartcard I/O API (javax.smartcardio, JSR 268) introduced in Java 1.6 is the bridge between PC/SC readers and the Java world. Java-based applications and applets may now communicate with smartcards in an interoperable and portable way. This makes it possible for web pages to access data stored in smartcards, or to invoke services running in a smartcard (either running a JavaCard cardlet or whatever native card application).

An interesting extension of this technique would be the ability for  JavaScript to access the smartcards as well. JavaScript is not Java: Java code is compiled into bytecode, then translated into native code and executed by the computer's Java Virtual Machine (JVM). JavaScript is interpreted 'on-the-fly' by the browser's JavaScript engine. This would open new opportunities for developers to build quickly and easily smartcard-aware web-based applications purely in HTML+JavaScript.

It is not difficult to implement such a bridge between HTML+JavaScript and smartcards, creating a GUI-less Java applet that will translate JavaScript function calls into calls to javax.smartcardio methods. There are two technical aspects that must be mastered to do so:

  • The applet has to be signed, as the smartcard is a critical computer's resource, not immediately available to the applets running in the sandbox,
  • The applet has to be scriptable, in order to expose itself to JavaScript through functions and events. But scriptable and signed applets normally mandate signed JavaScript, something we want to avoid to remain 'easy'.

We've written a small yet precise HOWTO that explains the whole process of developing such an applet. You may download it here.

Following this HOWTO, a sample applet has been developed and signed for demos and tests. You can test it online here (the applet is signed with our certificate 'www.springcard.com'. You must accept the signature, otherwhise you will be able to list the readers but not to connect to the cards).

You can develop this type of solution with our products in the SpringCard CSB6 Family (CSB6Prox’N’Roll PC/SCEasyFinger and CrazyWriter) and our NFC readers/encoders (H512NFC’Roll).

Create and read NFC tags with SpringCard NFC Tool and NFC Decoder

NFC Tags in a nutshell

An NFC Tag is a regular ISO 14443 card (either a memory card or a microprocessor-based smartcard), holding a specific content. Depending on this content, the "reader" will perform automatically a predefined action. Typical actions are :

  • open a URL (Internet address),
  • dial a number or send an SMS (if the reader is a mobile phone),
  • launch a software,
  • etc...

NFC tags are for instance embedded in Smart Posters, a new media for advertisement. Users seing the poster and touching its NFC tag with their NFC-enabled mobile phone or smartphone they may receive easily coupons or detailed information, or be prompted to buy online the advertised goods.

NFC logo : identifies NFC Compliant devices

The NFC Tag logo has been designed by the NFC Forum to identify NFC Tags.

NFC Forum, the organisation in charge of NFC standardization, has registered 4 types of NFC Tags :

  • NFC Type 1 tags :  Innovision Research & Technology TOPAZ chips (proprietary communication protocol on top of ISO 14443-A modulation)
  • NFC Type 2 tags : NXP MIFARE Ultralight and Ultralight C chips (proprietary communication protocol on top of ISO 14443-A modulation)
  • NFC Type 3 tags : Sony FELICA chips (proprietary modulation and communication)
  • NFC Type 4 tags :  standard ISO 7816-4 smartcards using ISO 14443 A or B up to layer 4

NXP and Nokia also support using NXP MIFARE Classic (1k/4k) tags. Visit NXP's website for more information on how to make NFC tags using their chips (including MIFARE DESfire as Type 4 tags).

The format on the content stored in the tags is specified by NFC Forum in NDEF standard (NFC Data Exchange Format).

Getting started with NFC Tags thanks to SpringCard readers and software

SpringCard has developed a set of software -with sources included in the new release of the SDKs- to demonstrate how NFC tags are encoded and processed by SpringCard contactless readers.

Customize your tags using NFC Tool

NFC Tool is a desktop application (Windows) to encode and read common NFC tags. NFC Tool works with PC/SC readers (Prox'N'Roll, CrazyWriter or CSB6 namely).

NFC Tool allows you to read/write NFC content on your cards

An example of use of NFC Tool with a Mifare UltraLight Card

Easily read and write NFC content in your cards using NFC Tool : Choose between SmartPoster, Text or URI ; fill in your URL or Text ; encode it to generate the NDEF and write it to your card.

At the date of writing, NFC Tool supports the following tags :

  • MIFARE Classic cards (standard 1K/4K)  as NFC Type 2 tags ;
  • MIFARE UltraLight (MF0ICU1) and UltraLight C (MF0ICU2) cards as NFC Type 2 tags ;
  • TOPAZ by Innovision cards as NFC Type 1 tags.

NFC Tool can be found in our PC/SC SDK (C# application for .NET framework).

Read NFC tags on your Pocket PC using NFC Decoder

NFC Decoder is a lighweight application for Windows Mobile (Pocket PC) that allows you to open an URL from an NFC tag card. NFC Decoder works with either SpringProx-CF, SpringProx-CF UP or SpringWAP through SpringProx API. It supports MIFARE 1K, MIFARE 4K and MIFARE UltraLight or UltraLight C as NFC Type 2 tags.

NFC Decoder

An URL found on tag with NFC Decoder

(C# application for .NET compact framework).