Archives 2011

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.

Windows 7 complains on missing driver for smartcards - a practical workaround

Smartcards and smartcard-aware applications using application level commands (APDUs) are older than Windows and worked very well in the past, until Microsoft suddently decided that a smartcard shouldn't be handheld directly by the applications anymore, and introduced the concept of smartcard driver software (ICC Service Provider withing the PC/SC framework). This issue sometimes occurs with our products in the SpringCard CSB6 Family (CSB6Prox’N’Roll PC/SCEasyFinger and CrazyWriter) and our NFC readers/encoders (H512NFC’Roll).

With Windows Seven, Microsoft goes one step further and mandates that every smartcard has its own driver (a 'minidriver' actually, i.e. a DLL running in user mode and not a SYS binary running in kernel mode). Everytime you put a smartcard on a contactless reader, or in a contact reader, the system tries to locate the appropriate driver, and this generally ends up with a red mark in the tray bar and this annoying message in the tray bar : "Device driver software was not successfully installed. Click here for details." Luckily, smartcard-aware applications keep on working as usual on top of PC/SC API, thanks to classical SCardConnect / SCardTransmit function calls.

According to Microsoft, smartcard-issuers should provide a minidriver for their cards. The point is, the ICC Service Provider architecture is meaningfull to let security-sensitive applications access security features (digital signature, secure login) in an interoperable and high-level way, but it appears useless in other cases, when only one single software has to communicate with a single smartcard. And this is the case in 99% of the systems using contactless smartcards or contactless memory cards.

A techninal article has been published in Microsoft Knowledge base (http://support.microsoft.com/kb/976832/en-us) giving different solutions to prevent the system from looking for a driver and issuing the warning message. In this article we are detailing two solution :

  • 1st solution is to disable SmartCard PnP feature through a Group Policy. The side effect is that there's not choice but to disable this feature for every cards, not only for the one that do not have a minidriver,
  • 2nd solution is to write in the system registry the list of cards that will not have a minidriver. In this article we do this through a small utility that makes it easier than entering the required lines in the registry one after the other.

Using a Group Policy to disable the smartcard PnP feature

Just follow this five steps :

  1. Run MMC.exe (Microsoft Management Console)
  2. Add Group Policy snap-in to the console
  3. Open Local Computer
  4. Browse to Policy\Computer Configuration\Windows Settings\Administrative Templates\Windows Components\Smart Card
  5. Disable Turn On Smart Card Plug And Play Services.

Command-line utility to selectively disable some smartcard minidrivers

The principle is to register in the system registry the ATRs of every smartcard we don't want to go through the PnP feature, and to associate them to a dummy minidriver.

Here's the technical part (details are to be found in MS' reference article (http://support.microsoft.com/kb/976832/en-us),

  1. Create a branch under HKLM\Software\Microsoft\Cryptography\Calais\Smartcards, name the branch with any clever name that will describe the related smartcard
  2. In this branch create a REG_BINARY entry named ATR in which you put the smartcard's ATR
  3. Create a REG_SZ entry named Crypto Provider and put the value $DisableSCPnP$ in it.

You may also add a REG_BINARY entry named ATRMask to associate this entry with more than one ATR. In the ATRMask, bits set to 1 means that the bits in ATR are relevant, and bits set to 0 act as wildcards.

 

A sample source code to do so is provided by MS' with the article. We've  implemented this source code in a small command line tool, and added a lot of modifications to ease its use and to make it possible to disable smartcard PnP for any arbitrary-entered smartcard ATR, and not only for the smartcards physically inserted in the readers at the time of execution.

There are two binaries : pcsc_no_minidriver32.exe for 32-bit systems, and pcsc_no_minidriver64.exe for 64-bit systems. Invoke either software with the -h parameter to get help. With the -m parameter, the software starts monitoring all the PC/SC readers. For every card inserted, it disables the plug and play. Alternatively, the -a parameter let you specify the ATR (hexadecimal string) ; you may optionally use the -n parameter to specify a name for your smartcard (this is convenient if you want to remove it from the registry later on !).

Note, you must run this program as an administrator.

We supplied the software with 2 command line scripts (.CMD),

  • pcsc_no_minidriver_memory.cmd disables every memory card (ATR constructed according to PC/SC v.2 specification for memory cards)
  • pcsc_no_minidriver_well_known.cmd disables  some well-known contactless cards that do not have a minidriver (NXP Desfire, NXP Mifare Plus, various Calypso cards, ...).

Of course, use this software and the related scripts with care and make sure you really do understand what it does, as it may prevent your system to work correctly with your 20$-cryptographic card that do need its minidriver to work with CryptoAPI.

Here's the link to the package : http://www.springcard.com/download/pub/pcsc_no_minidriver.zip . It comes with complete source code. Just unzip in a local folder and enjoy.

Mifare Plus in a nutshell

Following the breakdown of Mifare Classic security, NXP has released a new generation of contactless cards to fill the gap, the Mifare Plus. To ease the migration of the existing applications, this new chip keeps the memory model of the Mifare Classic : the card is structured as an array of 16-byte blocks, and the blocks are grouped into sectors of 4 or 16 blocks. The security (authentication and access control) is done on a per-sector basis. The two benefits of Mifare Plus are its new security scheme (EAL 4+ certified), based on state-of-art AES cipher with 128-bit keys, and its optional Random-ID for ISO 14443-3 anti-collision, useful to address card-holder-privacy concerns.

Type X or type S

Mifare Plus comes in two types.

Mifare Plus X is the full-featured product, allowing end-to-end AES-ciphered communication and a so-called ‘Proximity Check’ feature that makes it possible to prevent relay attacks, by measuring precisely the time elapsed between reader’s commands and card’s answers.

The command set of Mifare Plus X includes a function to select one-out-of-many Mifare Plus ‘Virtual Cards’ that could be emulated by a single NFC device.

Mifare Plus S is a lightweight version of the product, optimized to be a cost-effective drop-in replacement for Mifare Classic. It doesn’t support the ‘Proximity Check’ and has only limited support for the ‘Virtual Card’ scheme. More than that, it doesn’t support the Security Level 2 (see below).

Security Levels

The Mifare Plus has four different modes of operation, known as ‘Security Level’ 0, 1, 2 and 3. The Security Level is a static parameter of the card, the reader application can’t decide to operate the card arbitrary at one security level or at the other, it must operate the card given the card’ Security Level . Using a specific AES-secured exchange, the application may switch the card from one Security Level to a higher one, but this operation is not reversible (it is impossible to go from one Security Level to a lower one).

Security Level 0 is the out-of-factory configuration. In this mode, the card is not secured at all, and even not usable to store data.  Before all, the AES keys to be used all among the card’s life-cycle must be loaded, and the card must be switched to a higher Security Level. Pay attention that all the AES keys are transmitted in plaintext, so it is very important to do this personalization step in a trusted environment.

In Security Level 1, the Mifare Plus emulates a plain-old Mifare Classic. This gives the opportunity to replace existing Mifare Classic cards without the need to replace the readers or the handler applications. But as the card keeps on using the broken CRYPTO1 cipher, the security of the system is not better…  Yet an optional AES-based 3-pass authentication makes it possible to check whether the card is a real card and not an emulator, but per-se it doesn’t protect the data from unauthorized reading or modification.

In Security Level 2, the Mifare Plus uses the CRYPTO1 stream cipher just as Mifare Classic, but instead of using static 6-byte Mifare keys, the keys are generated dynamically by an AES-based 3-pass authentication. This is said to combine the security of AES with ‘the speed of CRYPTO1’. Anyway, in a typical architecture, the CRYPTO1 is implemented in the reader (by the NXP RC chipset actually) where AES is implemented in software on a very fast host computer. The gain in speed of ciphering remains small towards the overall bandwidth of the card-to-application channel; it may even be not significant enough to balance the added exchanges (loading of the CRYTO1 key into the reader after every AES authentication).  Also, the Mifare Plus S doesn’t support the Security Level 2.

In Security Level 3, the Mifare Plus doesn’t use CRYPTO1 anymore, but only AES. The new features (optional Random-ID, Virtual Card, Proximity Check) are available only at this Level.

Note that in Level 0 as in Level 3, communication is standard-compliant (ISO 14443-4 “T=CL”) where Security Levels  1 and 2 uses legacy Mifare frames (ISO 14443-3 type A).

Compliance between SpringCard contactless readers and Mifare Plus

Whatever the Security Level, all SpringCard contactless readers are fully able to communicate with the Mifare Plus chips (anti-collision loop and retrieval of UID, ISO 14443-3 A or ISO 14443-B communication protocols).

In Security Level 1 and 2, as the Mifare Plus’ UID is 7-byte long where the UID of a Mifare Classic is only 4-byte long, an upgrade had to be written in the CRYPTO1 authentication algorithm. This is available in firmware version 1.51 and newer. Earlier versions must be upgraded to be able to read and write data on a Mifare Plus at Level 1 or Level 2.

Using the card in Security Level 1 means only calling some functions embedded in the reader (Mifare Classic function set), but the other Security Levels  involve a new function set (AES authentication, ciphering and MACing, read and write commands on top of T=CL) that has to be implemented in the host computer. This requires a major redesign of the host applications. If the host is a microcontroller with limited resources, adding support for Mifare Plus could be difficult or even impossible without changing the hardware.

SpringCard APIs for Mifare Plus

As is has already been done for Desfire and Mifare UltraLight C, SpringCard has developed a convenient software library to ease the development of applications using Mifare Plus cards. This library is available as both as source code and as binary in the latest SDKs (PC/SC and SpringProx Legacy), together with a small sample software that shows how to personalize the card in Level 0, to change the Security Level (0 to 1, 1 to 2 or 3, 2 to 3) and to operate the card in Security Level 3, including

  • AES authentication (and generation of the session keys for ciphering and MACing)
  • Read and write functions with various options
  • Virtual Card feature

When the card is at Security Level 1, the existing samples for Mifare Classic could be used unchanged. The Security Level 2 is not implemented, as it isn’t available in Mifare Plus S that is expected to be the most frequently chosen one.

Documentation of the API is available online :

Choosing between Mifare Plus, Desfire EV1 or Mifare UltraLight C

The NXP Mifare family has now 3 contactless smartcards using ‘modern’ cryptography schemes for improved security.

Desfire EV1 is a full-featured microcontroller-based card, featuring 3DES and AES cryptography, a structured memory model (files within directories), and partially compliant with smartcard-standards (ISO 7816-4). Available capacities are 2KB, 4KB or 8KB.

Mifare UltraLight C is a low-cost wired-logic card with only 140 bytes of memory (the typical target is the market of disposable contactless tickets). A single 3DES key makes it possible to ensure that the card is genuine.

Just in-between, the Mifare Plus has a flat memory model (blocks) but with a good isolation between sectors,  2KB or 4KB of storage, and AES cryptography. The key advantage is the memory mapping that is the same as Mifare Classic, so existing applications that store data in the cards may be upgraded without major changes in their logic (yet changes in the security scheme and in the command set are not trivial...). But on the other hand, if the only need is to have a serial number or to store a small amount of data, Mifare UltraLight C does the job perfectly and is cheaper. As for Desfire EV1, its compliance to 7816-4 standard is the key in interoperable schemes (including future uses of NFC phones to emulate contactless cards), where the two other products remain totally proprietary.

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.