Gemalto Prox–DU Manual

Gemalto Prox–DU Manual

Dual interface usb smart card reader pc/sc guide
Hide thumbs Also See for Prox–DU:
Table of Contents

Advertisement

PC/SC Guide
Prox–DU & Prox–SU
Prox–DU & Prox–SU
Dual interface USB smart card reader
PC/SC Guide
www.gemalto.com
DOC119811A
Public Use
Page 1/129

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the Prox–DU and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Summary of Contents for Gemalto Prox–DU

  • Page 1 PC/SC Guide Prox–DU & Prox–SU Prox–DU & Prox–SU Dual interface USB smart card reader PC/SC Guide www.gemalto.com DOC119811A Public Use Page 1/129...
  • Page 2 All information herein is either public information or is the property of and owned solely by Gemalto NV. and/or its subsidiaries who shall have and keep the sole right to file patent applications or any other kind of intellectual property protection in connection with such information.
  • Page 3 PC/SC Guide Prox–DU & Prox–SU REVISION HISTORY Date Release Comments November 2010 Creation - Draft February 2011 First release www.gemalto.com DOC119811A Public Use Page 3/129...
  • Page 5: Table Of Contents

    INUX AND OPERATING SYSTEMS GEM_PC/SC SOFTWARE TOOL ..................84 PC/SC ......................85 LAYING WITH KNOWN ISSUES AND LIMITATIONS WITH ALL THE OPERATING SYSTEMS ....89 KNOWN ISSUES AND LIMITATIONS WITH WINDOWS OPERATING SYSTEMS .... 89 www.gemalto.com DOC119811A Public Use Page 5/129...
  • Page 6 UL Read/Write Operation ................123 ® MIFARE ................... 124 EMORY RGANIZATION Sector Trailer ......................124 Authentication Keys ....................124 Access Bits ......................125 Data Block Access Conditions ................125 Sector Trailer Access Conditions ................127 www.gemalto.com DOC119811A Public Use Page 6/129...
  • Page 7 Figure 12 – Gem_PCSC window after “SCardEstablishContext” ......... 85 Figure 13 – Gem_PCSC window after “SCardConnect” ............86 Figure 14 – Gem_PCSC window after “SCardTransmit” the Authentication command ..86 Figure 15 – Gem_PCSC window after “SCardTransmit” the Read command ...... 87 www.gemalto.com DOC119811A Public Use Page 7/129...
  • Page 8 Figure 16 – Gem_PCSC window after “SCardDisconnect” ..........88 Figure 17 – Gem_PCSC window after “SCardReleaseContext” ........... 88 Figure 18 – Information provided by T0 ................114 Figure 19 – Information provided by TDi ................114 www.gemalto.com DOC119811A Public Use Page 8/129...
  • Page 9: Introduction

    Bn is the most significant byte and B0 is the least significant byte: A string of Bn-1 n bytes Contact Our Hotline If you do not find the information you need in this document, or if you find errors, contact the Gemalto hotline at http://support.gemalto.com/. www.gemalto.com DOC119811A Public Use Page 9/129...
  • Page 10 PC/SC Guide Prox–DU & Prox–SU Please note the document reference number, your job function, and the name of your company. (You will find the document reference number at the bottom of the document.) www.gemalto.com DOC119811A Public Use Page 10/129...
  • Page 11: Overview

    This document will provide detailed information about the PC/SC Winscard API functions and will give some implementation examples. The Prox–DU and the Prox–SU devices were designed to be fully compliant with the latest PC/SC V2.0 specification. www.gemalto.com DOC119811A Public Use Page 11/129...
  • Page 12: Using Pc/Sc Application

    Part 8: Recommendation for implementation of security and privacy smart card devices • Part 9: Interface devices with extended capabilities The PC/SC Winscard API functions detailed hereafter are related to the Part 5 : Smart card resource manager definition. www.gemalto.com DOC119811A Public Use Page 12/129...
  • Page 13: Resource Manager

    Tracking known smart card types, along with their associated service providers and supported Interfaces, and making this information accessible to other applications. • Tracking smart card insertion and removal events to maintain accurate information on available smart cards within the readers. www.gemalto.com DOC119811A Public Use Page 13/129...
  • Page 14: Service Provider

    • One or more parties interested in a specific domain, who wish to enable the development of both applications and smart cards to support those applications within a domain of interest. www.gemalto.com DOC119811A Public Use Page 14/129...
  • Page 15: The Smart Card Service Provider

    Interfaces are defined in this specification for the following general-purpose cryptographic services: • Key generation • Key management • Digital signatures • Hashing (or message digests) • Bulk encryption services • Key import and export www.gemalto.com DOC119811A Public Use Page 15/129...
  • Page 16 Release memory returned through the use of SCARD_AUTOALLOCATE Table 5 – Resource Manager Support Function Smart Card Tracking Functions: Track smart cards within readers SCardLocateCards Search for a card whose ATR string matches a supplied card name www.gemalto.com DOC119811A Public Use Page 16/129...
  • Page 17 The next paragraphs give more information about these commands (extracts from the MSDN website: http://msdn.microsoft.com) Most of the functions are defined in the “Part 5: Smart card resource manager definition” of the PC/SC specification. www.gemalto.com DOC119811A Public Use Page 17/129...
  • Page 18: Winscard Api

    SCardEstablishContext function and that "MyCardName" was introduced by a previous call to the SCardIntroduceCardType function. GUID guidProv; LONG lReturn; lReturn = SCardGetProviderId(hContext, www.gemalto.com DOC119811A Public Use Page 18/129...
  • Page 19 PC/SC Guide Prox–DU & Prox–SU L"MyCardName", &guidProv); if ( SCARD_S_SUCCESS != lReturn ) printf("Failed SCardGetProviderId - %x\n", lReturn); else // Use the provider GUID as needed. // ... www.gemalto.com DOC119811A Public Use Page 19/129...
  • Page 20: Scardlistcards Function

    This block of memory must be deallocated with SCardFreeMemory. Return Value: This function returns different values depending on whether it succeeds or fails: www.gemalto.com DOC119811A Public Use Page 20/129...
  • Page 21 ( '\0' != *pCard ) // Display the value. printf("%S\n", pCard ); // Advance to the next value. pCard = pCard + wcslen(pCard) + 1; // Remember to free pmszCards (by calling SCardFreeMemory). // ... www.gemalto.com DOC119811A Public Use Page 21/129...
  • Page 22: Scardlistinterfaces Function

    The SCardListInterfaces function is a database query function. For more information on other database query functions, see Smart Card Database Query Functions. Examples: The following example shows listing the interfaces for a smart card. LPGUID pGuids = NULL; LONG lReturn; www.gemalto.com DOC119811A Public Use Page 22/129...
  • Page 23 ( SCARD_S_SUCCESS != lReturn ) printf("Failed SCardListInterfaces\n"); exit(1); // Or other appropriate action if ( 0 != cGuid ) // Do something with the array of Guids. // Remember to free pGuids when done (by SCardFreeMemory). // ... www.gemalto.com DOC119811A Public Use Page 23/129...
  • Page 24: Scardlistreadergroups Function

    The SCardListReaderGroups function is a database query function. For more information on other database query functions, see Smart Card Database Query Functions. Examples: The following example shows listing the reader groups. LPTSTR pmszReaderGroups = NULL; LPTSTR pReaderGroup; LONG lReturn; www.gemalto.com DOC119811A Public Use Page 24/129...
  • Page 25 // Display the value. printf("%S\n", pReaderGroup ); // Advance to the next value. pReaderGroup = pReaderGroup + wcslen((wchar_t *) pReaderGroup) + 1; // Remember to free pmszReaderGroups by a call to SCardFreeMemory. // ... www.gemalto.com DOC119811A Public Use Page 25/129...
  • Page 26: Scardlistreaders Function

    Other: An error code. For more information, see Smart Card Return Values. Remarks: The SCardListReaders function is a database query function. For more information on other database query functions, see Smart Card Database Query Functions. Examples: The following example shows listing the readers. www.gemalto.com DOC119811A Public Use Page 26/129...
  • Page 27 = pReader + wcslen((wchar_t *)pReader) + 1; // Free the memory. lReturn2 = SCardFreeMemory( hSC, pmszReaders ); if ( SCARD_S_SUCCESS != lReturn2 ) printf("Failed SCardFreeMemory\n"); break; default: printf("Failed SCardListReaders\n"); // Take appropriate action. www.gemalto.com DOC119811A Public Use Page 27/129...
  • Page 28 PC/SC Guide Prox–DU & Prox–SU // ... break; www.gemalto.com DOC119811A Public Use Page 28/129...
  • Page 29: Scardaddreadertogroup Function

    SCardEstablishContext function, and that "MyReader" and "MyReaderGroup" are known by the system through previous calls to the SCardIntroduceReader and SCardIntroduceReaderGroup functions, respectively. lReturn = SCardAddReaderToGroup( hContext, L"MyReader", L"MyReaderGroup"); if ( SCARD_S_SUCCESS != lReturn ) printf("Failed SCardAddReaderToGroup\n"); www.gemalto.com DOC119811A Public Use Page 29/129...
  • Page 30: Scardforgetcardtype Function

    SCardEstablishContext function, and that "MyCardName" was previously introduced by a call to the SCardIntroduceCardType function. lReturn = SCardForgetCardType(hContext, L"MyCardName"); if ( SCARD_S_SUCCESS != lReturn ) printf("Failed SCardForgetCardType\n"); www.gemalto.com DOC119811A Public Use Page 30/129...
  • Page 31: Scardforgetreader Function

    The example assumes that lReturn is a valid variable of type LONG and that hContext is a valid handle received from a previous call to the SCardEstablishContext function. lReturn = SCardForgetReader(hContext, TEXT("MyReader")); if ( SCARD_S_SUCCESS != lReturn ) printf("Failed SCardForgetReader\n"); www.gemalto.com DOC119811A Public Use Page 31/129...
  • Page 32: Scardforgetreadergroup Function

    LONG, and that hContext is a valid handle to a resource manager context previously obtained from a call to the SCardEstablishContext function. lReturn = SCardForgetReaderGroup(hContext, L"MyReaderGroup"); if ( SCARD_S_SUCCESS != lReturn ) printf("Failed SCardForgetReaderGroup\n"); www.gemalto.com DOC119811A Public Use Page 32/129...
  • Page 33: Scardintroducecardtype Function

    Length of the ATR and optional ATR mask. If this value is zero, then the length of the ATR is determined by normal ATR parsing. This value cannot be zero if a pbAtr value is supplied. Return Value: www.gemalto.com DOC119811A Public Use Page 33/129...
  • Page 34 BYTE MyATRMask[] = { 0xff, 0xff, 0xff, 0x00, 0xff}; LONG lReturn; lReturn = SCardIntroduceCardType(hContext, L"MyCardName", &MyGuid, NULL, // No interface array // Interface count = 0 MyATR, MyATRMask, sizeof(MyATR)); if ( SCARD_S_SUCCESS != lReturn ) printf("Failed SCardIntroduceCardType\n"); www.gemalto.com DOC119811A Public Use Page 34/129...
  • Page 35: Scardintroducereader Function

    // name, then forget the old name). LPBYTE pbAttr = NULL; DWORD cByte = SCARD_AUTOALLOCATE; LONG lReturn; // Step 1: Add the new reader name. // The device name attribute is a necessary value. www.gemalto.com DOC119811A Public Use Page 35/129...
  • Page 36 // Step 2: Forget the old reader name. lReturn = SCardForgetReader(hContext, (LPCTSTR)pbAttr ); if ( SCARD_S_SUCCESS != lReturn ) printf("Failed SCardForgetReader\n"); exit(1); // Or other error action // Free the memory when done. lReturn = SCardFreeMemory( hContext, pbAttr ); www.gemalto.com DOC119811A Public Use Page 36/129...
  • Page 37: Scardintroducereadergroup Function

    The following example shows introducing a smart card reader group. // Introduce the reader group. // lReturn is of type LONG. // hContext was set by a previous call to SCardEstablishContext. lReturn = SCardIntroduceReaderGroup(hContext, L"MyReaderGroup"); if ( SCARD_S_SUCCESS != lReturn ) printf("Failed SCardIntroduceReaderGroup\n"); www.gemalto.com DOC119811A Public Use Page 37/129...
  • Page 38: Scardremovereaderfromgroup Function

    // hContext was set by a previous call to SCardEstablishContext. // The group is automatically forgotten if no readers remain in it. lReturn = SCardRemoveReaderFromGroup(hContext, L"MyReader", L"MyReaderGroup"); if ( SCARD_S_SUCCESS != lReturn ) printf("Failed SCardRemoveReaderFromGroup\n"); www.gemalto.com DOC119811A Public Use Page 38/129...
  • Page 39: Scardestablishcontext Function

    If the client attempts a smart card operation in a remote session, such as a client session running on a terminal server, and the operating system in use does not support smart card redirection, this function returns ERROR_BROKEN_PIPE. Examples: The following example establishes a resource manager context. www.gemalto.com DOC119811A Public Use Page 39/129...
  • Page 40 // Establish the context. lReturn = SCardEstablishContext(SCARD_SCOPE_USER, NULL, NULL, &hSC); if ( SCARD_S_SUCCESS != lReturn ) printf("Failed SCardEstablishContext\n"); else // Use the context as needed. When done, // free the context by calling SCardReleaseContext. // ... www.gemalto.com DOC119811A Public Use Page 40/129...
  • Page 41: Scardreleasecontext Function

    The following example shows releasing a context. // Free the context. // lReturn is of type LONG. // hSC was set by an earlier call to SCardEstablishContext. lReturn = SCardReleaseContext(hSC); if ( SCARD_S_SUCCESS != lReturn ) printf("Failed SCardReleaseContext\n") www.gemalto.com DOC119811A Public Use Page 41/129...
  • Page 42: Scardfreememory Function

    SCardEstablishContext function, and that pmszReaders is a string initialized in a previous call to the SCardListReaders function. lReturn = SCardFreeMemory(hSC, pmszReaders ); if ( SCARD_S_SUCCESS != lReturn ) printf("Failed SCardFreeMemory\n"); www.gemalto.com DOC119811A Public Use Page 42/129...
  • Page 43: Scardlocatecards Function

    Smart Card Tracking Functions. Examples: The following example shows locating smart cards. // Copyright (c) Microsoft Corporation. All rights reserved. #include <stdio.h> #include <winscard.h> #include <tchar.h> #pragma comment(lib, "winscard.lib") HRESULT __cdecl main() www.gemalto.com DOC119811A Public Use Page 43/129...
  • Page 44 ( SCARD_S_SUCCESS != lReturn ) printf("Failed SCardListReaders\n"); exit(1); // Place the readers into the state array. szRdr = szReaders; for ( dwI = 0; dwI < MAXIMUM_SMARTCARD_READERS; dwI++ ) if ( 0 == *szRdr ) www.gemalto.com DOC119811A Public Use Page 44/129...
  • Page 45 ); SCardFreeMemory( hSC, szReaders ); return 0; // Context will be release automatically. // Update the state. rgscState[dwI].dwCurrentState = rgscState[dwI].dwEventState; // Card not found yet; wait until there is a change. lReturn = SCardGetStatusChange(hSC, www.gemalto.com DOC119811A Public Use Page 45/129...
  • Page 46 ( SCARD_S_SUCCESS != lReturn ) printf("Failed SCardGetStatusChange\n"); exit(1); } // for (;;) else printf("No readers available\n"); // Release the context. lReturn = SCardReleaseContext(hSC); if ( SCARD_S_SUCCESS != lReturn ) printf("Failed SCardReleaseContext\n"); exit(1); SCardFreeMemory( hSC, szReaders ); return hr; www.gemalto.com DOC119811A Public Use Page 46/129...
  • Page 47: Scardgetstatuschange Function

    Failure: An error code. For more information, see Smart Card Return Values. Remarks: The SCardGetStatusChange function is a smart card tracking function. For more information about other tracking functions, see Smart Card Tracking Functions. www.gemalto.com DOC119811A Public Use Page 47/129...
  • Page 48 PC/SC Guide Prox–DU & Prox–SU Examples: For information about how to call this function, see the example in SCardLocateCards. www.gemalto.com DOC119811A Public Use Page 48/129...
  • Page 49: Scardcancel Function

    LONG and that hContext is a valid handle received from a previous call to SCardEstablishContext. lReturn = SCardCancel( hContext ); if ( SCARD_S_SUCCESS != lReturn ) printf("Failed SCardCancel\n"); www.gemalto.com DOC119811A Public Use Page 49/129...
  • Page 50: Scardconnect Function

    SCardControl. phCard [out] A handle that identifies the connection to the smart card in the designated reader. pdwActiveProtocol [out] A flag that indicates the established active protocol. SCARD_PROTOCOL_T0: T=0 is the active protocol. www.gemalto.com DOC119811A Public Use Page 50/129...
  • Page 51 ( SCARD_S_SUCCESS != lReturn ) printf("Failed SCardConnect\n"); exit(1); // Or other appropriate action. // Use the connection. // Display the active protocol. switch ( dwAP ) case SCARD_PROTOCOL_T0: printf("Active protocol T0\n"); break; case SCARD_PROTOCOL_T1: printf("Active protocol T1\n"); break; www.gemalto.com DOC119811A Public Use Page 51/129...
  • Page 52 PC/SC Guide Prox–DU & Prox–SU case SCARD_PROTOCOL_UNDEFINED: default: printf("Active protocol unnegotiated or unknown\n"); break; // Remember to disconnect (by calling SCardDisconnect). // ... www.gemalto.com DOC119811A Public Use Page 52/129...
  • Page 53: Scardreconnect Function

    [out, optional] Flag that indicates the established active protocol: SCARD_PROTOCOL_T0: T=0 is the active protocol. SCARD_PROTOCOL_T1: T=1 is the active protocol. Return Value: This function returns different values depending on whether it succeeds or fails. www.gemalto.com DOC119811A Public Use Page 53/129...
  • Page 54 DWORD dwAP; LONG lReturn; // Reconnect. // hCardHandle was set by a previous call to SCardConnect. lReturn = SCardReconnect(hCardHandle, SCARD_SHARE_SHARED, SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1, SCARD_LEAVE_CARD, &dwAP ); if ( SCARD_S_SUCCESS != lReturn ) printf("Failed SCardReconnect\n") www.gemalto.com DOC119811A Public Use Page 54/129...
  • Page 55: Scarddisconnect Function

    LONG, and that hCardHandle is a valid handle received from a previous call to SCardConnect. lReturn = SCardDisconnect(hCardHandle, SCARD_LEAVE_CARD); if ( SCARD_S_SUCCESS != lReturn ) printf("Failed SCardDisconnect\n"); exit(1); // Or other appropriate action. www.gemalto.com DOC119811A Public Use Page 55/129...
  • Page 56: Scardbegintransaction Function

    LONG and that hCard is a valid handle received from a previous call to SCardConnect. lReturn = SCardBeginTransaction( hCard ); if ( SCARD_S_SUCCESS != lReturn ) printf("Failed SCardBeginTransaction\n"); www.gemalto.com DOC119811A Public Use Page 56/129...
  • Page 57: Scardendtransaction Function

    LONG, that hCard is a valid handle received from a previous call to the SCardConnect function, and that hCard was passed to a previous call to the SCardBeginTransaction function. lReturn = SCardEndTransaction(hCard, SCARD_LEAVE_CARD); if ( SCARD_S_SUCCESS != lReturn ) www.gemalto.com DOC119811A Public Use Page 57/129...
  • Page 58 PC/SC Guide Prox–DU & Prox–SU printf("Failed SCardEndTransaction\n"); www.gemalto.com DOC119811A Public Use Page 58/129...
  • Page 59: Scardstatus Function

    SCARD_NEGOTIABLE: The card has been reset and is awaiting PTS negotiation. SCARD_SPECIFIC: The card has been reset and specific communication protocols have been established. pdwProtocol [out, optional] Current protocol, if any. The returned value is meaningful only if the returned value www.gemalto.com DOC119811A Public Use Page 59/129...
  • Page 60 LONG lReturn; // Determine the status. // hCardHandle was set by an earlier call to SCardConnect. lReturn = SCardStatus(hCardHandle, szReader, &cch, &dwState, &dwProtocol, (LPBYTE)&bAttr, &cByte); if ( SCARD_S_SUCCESS != lReturn ) printf("Failed SCardStatus\n"); www.gemalto.com DOC119811A Public Use Page 60/129...
  • Page 61 SCARD_POWERED: printf("Card has power.\n"); break; case SCARD_NEGOTIABLE: printf("Card reset and waiting PTS negotiation.\n"); break; case SCARD_SPECIFIC: printf("Card has specific communication protocols set.\n"); break; default: printf("Unknown or unexpected card state.\n"); break; www.gemalto.com DOC119811A Public Use Page 61/129...
  • Page 62: Scardtransmit Function

    The data sent to the card should immediately follow the send buffer. In the special case where no data is sent to the card and no data is expected in return, bP3 is not sent. Member Meaning: bCla The T=0 instruction class. www.gemalto.com DOC119811A Public Use Page 62/129...
  • Page 63 The cbSendLength parameter must be set to the size of the T=0 header information (CLA, INS, P1, and P2) plus a byte that contains the length of the data to be www.gemalto.com DOC119811A Public Use Page 63/129...
  • Page 64 // pbRecv points to the buffer for returned bytes. // dwRecv is the DWORD value for the number of returned bytes. lReturn = SCardTransmit(hCardHandle, SCARD_PCI_T0, pbSend, dwSend, NULL, pbRecv, &dwRecv ); if ( SCARD_S_SUCCESS != lReturn ) www.gemalto.com DOC119811A Public Use Page 64/129...
  • Page 65 PC/SC Guide Prox–DU & Prox–SU printf("Failed SCardTransmit\n"); exit(1); // or other appropriate error action www.gemalto.com DOC119811A Public Use Page 65/129...
  • Page 66: Scardcontrol Function

    Return Value: This function returns different values depending on whether it succeeds or fails: Success: SCARD_S_SUCCESS. Failure: An error code. For more information, see Smart Card Return Values. Remarks: www.gemalto.com DOC119811A Public Use Page 66/129...
  • Page 67 DWORD previously initialized to a valid control code. This particular control code requires no input data and expects no output data. lReturn = SCardControl( hCardHandle, dwControlCode, NULL, NULL, 0 ); if ( SCARD_S_SUCCESS != lReturn ) printf("Failed SCardControl\n"); www.gemalto.com DOC119811A Public Use Page 67/129...
  • Page 68: Scardgetattrib Function

    0x00000004 Card capture mechanism All other values are reserved for future use (RFU). SCARD_ATTR_CURRENT_BWT: Current block waiting time. SCARD_ATTR_CURRENT_CLK: Current clock rate, in kHz. SCARD_ATTR_CURRENT_CWT: Current character waiting time. SCARD_ATTR_CURRENT_D: Bit rate conversion factor. www.gemalto.com DOC119811A Public Use Page 68/129...
  • Page 69 SCARD_ATTR_MAX_CLK: Maximum clock rate, in kHz. SCARD_ATTR_MAX_DATA_RATE: Maximum data rate, in bps. SCARD_ATTR_MAX_IFSD: Maximum bytes for information file size device. SCARD_ATTR_POWER_MGMT_SUPPORT: Zero if device does not support power down while smart card is inserted. Nonzero otherwise. www.gemalto.com DOC119811A Public Use Page 69/129...
  • Page 70 SCardConnect function. LPBYTE pbAttr = NULL; DWORD cByte = SCARD_AUTOALLOCATE; DWORD LONG lReturn; lReturn = SCardGetAttrib(hCardHandle, SCARD_ATTR_VENDOR_NAME, (LPBYTE)&pbAttr, &cByte); if ( SCARD_S_SUCCESS != lReturn ) www.gemalto.com DOC119811A Public Use Page 70/129...
  • Page 71 // Output the bytes. for (i = 0; i < cByte; i++) printf("%c", *(pbAttr+i)); printf("\n"); // Free the memory when done. // hContext was set earlier by SCardEstablishContext lReturn = SCardFreeMemory( hContext, pbAttr ); www.gemalto.com DOC119811A Public Use Page 71/129...
  • Page 72: Scardsetattrib Function

    // hCardHandle was set by a previous call to SCardConnect. // dwAttrID is a DWORD value, specifying the attribute ID. // pbAttr points to the buffer of the new value. // cByte is the count of bytes in the buffer. lReturn = SCardSetAttrib(hCardHandle, www.gemalto.com DOC119811A Public Use Page 72/129...
  • Page 73 PC/SC Guide Prox–DU & Prox–SU dwAttrID, (LPBYTE)pbAttr, cByte); if ( SCARD_S_SUCCESS != lReturn ) printf("Failed SCardSetAttrib\n"); www.gemalto.com DOC119811A Public Use Page 73/129...
  • Page 74: Scard Return Values

    The smart card cannot be accessed because of other connections outstanding SCARD_E_NO_SMARTCARD 0x8010000C The operation requires a smart card, but no smart card is currently in the device SCARD_E_UNKNOWN_CARD 0x8010000D The specified smart card name is not recognized www.gemalto.com DOC119811A Public Use Page 74/129...
  • Page 75 The PCI Receive buffer was too small SCARD_E_READER_UNSUPPORTED 0x8010001A The reader driver does not meet minimal requirements for support SCARD_E_DUPLICATE_READER 0x8010001B The reader driver did not produce a unique reader name SCARD_E_CARD_UNSUPPORTED 0x8010001C The smart card does not meet www.gemalto.com DOC119811A Public Use Page 75/129...
  • Page 76 SCARD_E_INVALID_CHV 0x8010002A The supplied PIN is incorrect SCARD_E_UNKNOWN_RES_MNG 0x8010002B An unrecognized error code was returned from a layered component SCARD_E_NO_SUCH_CERTIFICATE 0x8010002C The requested certificate does not exist SCARD_E_CERTIFICATE_UNAVAILABLE 0x8010002D The requested certificate could www.gemalto.com DOC119811A Public Use Page 76/129...
  • Page 77 The card cannot be accessed because the maximum number of PIN entry attempts has been reached SCARD_W_EOF 0x8010006D The end of the smart card file has been reached SCARD_W_CANCELLED_BY_USER 0x8010006E The action was cancelled by the user www.gemalto.com DOC119811A Public Use Page 77/129...
  • Page 78 PC/SC Guide Prox–DU & Prox–SU SCARD_W_CARD_NOT_AUTHENTICATED 0x8010006F No PIN was presented to the smart card Table 9 – SCard return values www.gemalto.com DOC119811A Public Use Page 78/129...
  • Page 79: Linux Winscard Api

    Destroys a communication context to the PC/SC Resource Manager. SCardIsValidContext Check if a SCARDCONTEXT is valid. SCardConnect Establishes a connection to the reader specified in * szReader. SCardReconnect Reestablishes a connection to a reader that was previously www.gemalto.com DOC119811A Public Use Page 79/129...
  • Page 80 SCardGetAttrib Get an attribute from the IFD Handler (reader driver). SCardSetAttrib Set an attribute of the IFD Handler. Table 10 – Linux WinSCard Functions For more information, please refer to the pcsc-lite website: http://pcsclite.alioth.debian.org. www.gemalto.com DOC119811A Public Use Page 80/129...
  • Page 81: Prox-Du And Prox-Su Reader Name

    The string name depends on the operating system. Windows operating systems The name will comply with the following string format: • “Gemalto Prox-DU Contactless_xxxxxxxx N1” for the Prox–DU contactless interface • “Gemalto Prox-DU Contact_xxxxxxxx N2” for the Prox–DU contact interface •...
  • Page 82: Linux And Mac Os Xoperating Systems

    Linux and Mac OS X operating systems The name will comply with the following string format: • “Gemalto Prox-DU (xxxxxxxx) N1 00” for the Prox–DU contactless interface • “Gemalto Prox-DU (xxxxxxxx) N1 01” for the Prox–DU contact interface •...
  • Page 83 PC/SC Guide Prox–DU & Prox–SU second Prox–DU device. Note: The application should use the name of the device for connecting the appropriate smart card interface. www.gemalto.com DOC119811A Public Use Page 83/129...
  • Page 84: Gem_Pc/Sc Software Tool

    The Gemalto Gem_PCSC tool may help to become familiar with the PC/SC environment: Figure 10 – Gem_PCSC window The Gemalto Gem_PCSC tool can be used to easily evaluate the Prox–DU and the Prox– SU in the PC/SC environment with a Windows based operating system.
  • Page 85: Playing With Pc/Sc

    1K contactless smart card in front of the landing zone of the reader • In the “Reader Name” box select the contactless interface of the Prox-DU named “Gemalto Prox-DU Contactless_xxxxxxxx 0” (xxxxxxxx is the reader serial number printed on the label located in the rear of the casing) •...
  • Page 86 Meaning “Authenticate block number 0 using the Key A number 0” • Click the “SCardTransmit” button The next window will be displayed: Figure 14 – Gem_PCSC window after “SCardTransmit” the Authentication command The smart card response is displayed: www.gemalto.com DOC119811A Public Use Page 86/129...
  • Page 87 4- Perform the following operations to close the communication with the smart card: • Remove the contactless smart card from the landing zone • Click the “SCardDisconnect” button The next window will be displayed: www.gemalto.com DOC119811A Public Use Page 87/129...
  • Page 88 5- Click the “SCardReleaseContext” button to close the connection with all the available PC/SC devices. The next window will be displayed: Figure 17 – Gem_PCSC window after “SCardReleaseContext” You can now close the Gem_PCSC tool. www.gemalto.com DOC119811A Public Use Page 88/129...
  • Page 89: Known Issues And Limitations With All The Operating Systems

    USB cable to recover a proper operation Windows XP Prox–SU: Unplug and replug the USB cable to recover a proper operation When the computer is restarting it may happen the internal SIM/SAM card is not detected by the device www.gemalto.com DOC119811A Public Use Page 89/129...
  • Page 90 The Microsoft CCID driver does not support high speed contact smart cards (with High speed contact TA1=97h parameter). smart cards (supporting TA1=97h Please contact the Gemalto support ISO7816 parameter) website http://support.gemalto.com/. are not recognized Table 11 – Known issues and limitations (Windows OS) www.gemalto.com...
  • Page 91: Known Issues And Limitations With Linux Operating Systems

    "Secure Pin arguments at least. Entry sample code" available in the website http://support.gemalto.com/?id=63 Mac OS X If the application needs to use the Dual protocol card issue: contactless interface the connection Tiger (10.4)
  • Page 92 Tiger (10.4) The pdwProtocol parameter is not correct Leopard (10.5) with the contact reader. Snow Leopard (10.6) Returned value is 0 (SCARD_PROTOCOL_U NDEFINED) Table 13 – PCSC-Lite known issues and limitations (Mac OS X) www.gemalto.com DOC119811A Public Use Page 92/129...
  • Page 93: Interfacing With Contactless Cards

    I-block to be repeated (according to the ISO14443-4 standards). When a smart card removal is detected, a CCID removal notification message will be generated and the blue LED of the contactless reader/writer will blink slowly. www.gemalto.com DOC119811A Public Use...
  • Page 94: Atr For Contactless Smart Cards

    3Bh 8Fh 80h 01h 80h 80h 65h B0h 07h 02h 02h 89h 83h 00h 90h 00h 00h 00h 00h With: n = Fh (15 historical bytes) Historical bytes from the ATS response = 80h 80h 65h B0h 07h 02h 02h 89h 83h 00h 90h 00h 00h 00h 00h www.gemalto.com DOC119811A Public Use Page 94/129...
  • Page 95 83h 00h UU = E3h (TCK) • The ATR returned by a GemCombi CDLite smart card will be: 3Bh 80h 80h 01h 01h With: n = 0h (no historical byte) UU = 01h (TCK) www.gemalto.com DOC119811A Public Use Page 95/129...
  • Page 96: Interfacing With Mifare ® Desfire Cards

    As an example, to get the version of the DESFire smart card, the following native command should be send: 60h The proprietary command to consider is the following: FFh DEh 00h 00h 01h 60h www.gemalto.com DOC119811A Public Use Page 96/129...
  • Page 97: Requesting Contactless Smart Card Information

    FFh FCh 01h 00h 00h The response will be: 44h 03h 04h 26h 47h 09h 48h E8h 10h 20h 90h 00h (example) ATQA = 44h 03h 04h SN = 26h 47h 09h 48h E8h 10h (7 bytes) www.gemalto.com DOC119811A Public Use Page 97/129...
  • Page 98 PC/SC Guide Prox–DU & Prox–SU SAK = 20h Refer to the DESFire datasheet for more information about the response. www.gemalto.com DOC119811A Public Use Page 98/129...
  • Page 99: Interfacing With Mifare Cards

    ® When the smart card is in the MIFARE mode, the only way to retrieve the MIFARE type ® (1K-4K-UL-Mini) is to reconnect the smart card. The appropriate MIFARE ATR will then be returned. www.gemalto.com DOC119811A Public Use Page 99/129...
  • Page 100: Atr For Mifare ® Cards

    2 bytes for Card Name RFU: Shall be set to zero. Assigned by PC/SC for future extensions. 3 + n Exclusive-OR of bytes T0 to Tk ® Table 15 – ATR for MIFARE cards www.gemalto.com DOC119811A Public Use Page 100/129...
  • Page 101 LL = 0Ch (12 bytes) SS = 03h (ISO14443-A, part 3) ® NN NN = 00h 02h (MIFARE Standard 4K) UU = 69h (TCK) ® • The ATR returned by a MIFARE Ultralight will be: www.gemalto.com DOC119811A Public Use Page 101/129...
  • Page 102: Get Data Command

    INF = 00h means: Card serial Info type number (UID or PUPI) is returned INF = 01h means: All historical bytes from the ATS of a ISO14443 A card without CRC are returned Expected length of the data www.gemalto.com DOC119811A Public Use Page 102/129...
  • Page 103: Load Keys Command

    ® If the Load MIFARE key security bit is set to one in the configuration EEPROM, a Transport ® secret key should be added to the MIFARE key: The command is formatted as follows: www.gemalto.com DOC119811A Public Use Page 103/129...
  • Page 104 ® MIFARE Secret Key The MIFARE key value Should be followed by the Gemalto ® Transport key if the Load MIFARE security bit is set on. The byte order must be the same as the byte order in the card sector trailer...
  • Page 105: General Authenticate Command

    Mini it is mandatory to perform the General Authenticate command before each read or write memory block operation. Otherwise, an authentication error will occur. ® For MIFARE Ultralight the General Authenticate operation is not required. www.gemalto.com DOC119811A Public Use Page 105/129...
  • Page 106 Others Refer to the error codes table below The authentication is performed for a memory sector. As each memory sector is composed of four memory blocks, the authentication will be done for all the four memory blocks. www.gemalto.com DOC119811A Public Use...
  • Page 107: Read Binary Command

    1K, 4K, Mini 16-byte of data ® MIFARE Ultralight 4-byte of data The first byte of the block is byte 0 Present only when there is no error in the status report. SW1-SW2 Command execution status www.gemalto.com DOC119811A Public Use Page 107/129...
  • Page 108: Update Binary Command

    04h (size of the memory page) Data ® MIFARE 1K, 4K, Mini 16-byte of data ® MIFARE Ultralight 4-byte of data The first byte of the block is byte 0 Present only when there is no error www.gemalto.com DOC119811A Public Use Page 108/129...
  • Page 109: Error Code List Summary

    Key type not known Key number not valid Function not supported Wrong parameter P1-P2 Instruction code not supported Read Binary error codes End of data reach before Le bytes (Le is greater than data length) www.gemalto.com DOC119811A Public Use Page 109/129...
  • Page 110 Wrong length (wrong number Le; XX is the exact number) if Le is less than the available data length Update Binary error codes Wrong length Security not satisfied Address out of range Function not supported Table 18 – Memory card error codes www.gemalto.com DOC119811A Public Use Page 110/129...
  • Page 111: Interfacing With Contact Cards

    The Prox–DU and the Prox–SU will return the smart card ATR after a smart card power up. The ATR is as follows: Byte Value Designation Description Number Initial header (Mandatory) 3Bh or Direct or inverse convention www.gemalto.com DOC119811A Public Use Page 111/129...
  • Page 112 Specific to T after T from 0 to 14 in TDi–1 Global after T=15 in TDi–1 Interface characters (Optional) Yi+1-T Interface characters (Optional) Structural, encodes Yi+1 and T Historical characters (Optional): max 15 bytes www.gemalto.com DOC119811A Public Use Page 112/129...
  • Page 113: Structures And Content

    ONE the presence of subsequent characters TA1, TB1, TC1, TD1 respectively. • The least significant half byte (b3 to b0) is named K and indicates the number (0 to 15) of historical characters. www.gemalto.com DOC119811A Public Use Page 113/129...
  • Page 114: Interface Characters Tai, Tbi, Tci, Tdi

    If present, T=0 shall be first, T=15 shall be last. T=15 is invalid in TD1. Historical characters T1, T2, ... ,TK When K is not null, the answer to reset is continued by transmitting K historical characters T1, T2, ... , TK. www.gemalto.com DOC119811A Public Use Page 114/129...
  • Page 115: Check Character Tck

    0000 0001 0010 0011 0100 0101 0110 0111 1116 1488 1860 Fs (max) 1000 1001 1010 1011 1100 1101 1110 1111 1024 1536 2048 Fs (max) Table 20 – Clock rate conversion factor F www.gemalto.com DOC119811A Public Use Page 115/129...
  • Page 116: Tb1 And Tb2

    If bit 4 is set to 0, then the integers Fi and Di defined above by TA1 shall apply. • If bit 4 is set to 1, then implicit values (not defined by the interface bytes) shall apply. Bits 3 to 0 encode a type T. www.gemalto.com DOC119811A Public Use Page 116/129...
  • Page 117: The First Ta1 For T=15

    1). The value '00' indicates that the smart card does not use SPU. Any other value where bit 7 is set to 0 are reserved for future use. For additional information about the ATR contents please refer to the ISO7816-3 standard. www.gemalto.com DOC119811A Public Use...
  • Page 118: Mifare ® Cards Mapping

    Each contactless smart card consists of a 16-byte memory block assembled in sectors. The first block of the first sector contains manufacturing information. The last block of each sector is the sector trailer containing the keys and the access conditions of the blocks. www.gemalto.com DOC119811A Public Use Page 118/129...
  • Page 119: Mifare

    Each contactless smart card consists of a 16-byte memory block assembled in sectors. The first block of the first sector contains manufacturing information. The last block of each sector is the sector trailer containing the keys and the access conditions of the blocks. www.gemalto.com DOC119811A Public Use Page 119/129...
  • Page 120: Apping

    – – – – – – – – – – – – – – – Data Data Data Key A Access Bits Key B Sector Trailer 31 Data Data Data Data Data Data Data www.gemalto.com DOC119811A Public Use Page 120/129...
  • Page 121 Each contactless smart card consists of a 16-byte memory block assembled in sectors. The first block of the first sector contains manufacturing information. The last block of each sector is the sector trailer containing the keys and the access www.gemalto.com DOC119811A Public Use...
  • Page 122: Mifare ® Ul Memory Mapping

    SN0-SN7 is the 7 bytes serial number according to ISO14443-3. BCC0 and BCC1 are the check bytes according to ISO14443-3. Internal byte is reserved for internal data. These 10 bytes are write-protected after having been programmed by the chip manufacturer after production. www.gemalto.com DOC119811A Public Use Page 122/129...
  • Page 123: Lock Bytes Area

    Pages 4 to 15 constitute the user read/write area. After production the data pages are initialized to all “0” (zeroes). ® MIFARE UL Read/Write Operation ® ® The MIFARE Ultralight chip does not embed the MIFARE Classic security. So no authentication operation is required before any read/write operation. www.gemalto.com DOC119811A Public Use Page 123/129...
  • Page 124: Sector Trailer

    Key A, user can set the access bits where the memory space of the optional authentication Key B can be used for data storage. In this case when the authentication key, Key B can no longer be used for authentication, www.gemalto.com DOC119811A Public Use...
  • Page 125: Access Bits

    The access condition for every block is dependant on the sector number as explained in the following table: Sector Block Description - C2 - C1 - C2 - C1 (0 – 31) - C2 - C1 www.gemalto.com DOC119811A Public Use Page 125/129...
  • Page 126 Never Never Key A | B /Subtract Value block A or B Read only Key A | B Never Never Never memory block B Read /Write Key B Key B Never Never memory block www.gemalto.com DOC119811A Public Use Page 126/129...
  • Page 127: Sector Trailer Access Conditions

    Key A | B indicates the access for this sector is only possible after an authentication using either Key A or Key B. Access Bits Access Condition Comments Authentication Authentication Access Bits Key A Key B www.gemalto.com DOC119811A Public Use Page 127/129...
  • Page 128 The access bits can also be blocked by the user to prohibit any further changes to the access conditions. As the access bits can be altered by the user, special care should be taken during personalization phase. www.gemalto.com DOC119811A Public Use Page 128/129...
  • Page 129: For More Information

    PC/SC Guide Prox–DU & Prox–SU For More Information Standards and Specifications • PC/SC V2 specifications: Part 3. Requirements for PC-Connected Interface Devices - Revision 2.01.09 End of Document www.gemalto.com DOC119811A Public Use Page 129/129...

This manual is also suitable for:

Prox-su

Table of Contents