card.h File Reference

#include <gwenhywfar/inherit.h>
#include <chipcard/chipcard.h>
#include <gwenhywfar/db.h>
#include <gwenhywfar/xml.h>
#include <inttypes.h>
#include <chipcard/chipcard.h>
#include <chipcard/client/client.h>
#include <gwenhywfar/list2.h>
#include <gwenhywfar/types.h>
#include <gwenhywfar/cryptdefs.h>
#include <gwenhywfar/misc.h>
#include <gwenhywfar/buffer.h>
#include <time.h>
#include <chipcard/sharedstuff/pininfo.h>
Include dependency graph for client/base/card.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

Flags for ISO Commands

#define LC_CARD_ISO_FLAGS_EFID_MASK   0x00000001f
#define LC_CARD_ISO_FLAGS_RECSEL_MASK   0x0000000e0
#define LC_CARD_ISO_FLAGS_RECSEL_FIRST   (0 << 5)
#define LC_CARD_ISO_FLAGS_RECSEL_LAST   (1 << 5)
#define LC_CARD_ISO_FLAGS_RECSEL_NEXT   (2 << 5)
#define LC_CARD_ISO_FLAGS_RECSEL_PREV   (3 << 5)
#define LC_CARD_ISO_FLAGS_RECSEL_GIVEN   (4 << 5)

Typedefs

typedef struct LC_CARD LC_CARD

Functions

Opening, Closing, Destroying

CHIPCARD_API void LC_Card_free (LC_CARD *cd)
CHIPCARD_API void LC_Card_List2_freeAll (LC_CARD_LIST2 *l)
CHIPCARD_API LC_CLIENT_RESULT LC_Card_Open (LC_CARD *card)
CHIPCARD_API LC_CLIENT_RESULT LC_Card_Close (LC_CARD *card)
Executing Card Commands

There are two ways of letting Libchipcard execute card commands:

  • directly sending a prebuilt APDU
  • referencing a command by name so that Libchipcard can built the APDU for the particular reader and card combination.

When working with Libchipcard the latter method is preferred since only in this case Libchipcard can adapt APDUs in order to make them work with a given combination of card and reader. Otherwise the application has to take care of the specialties of a given reader or card by itself.

CHIPCARD_API LC_CLIENT_RESULT LC_Card_ExecApdu (LC_CARD *card, const char *apdu, unsigned int len, GWEN_BUFFER *rbuf, LC_CLIENT_CMDTARGET t, int timeout)
CHIPCARD_API LC_CLIENT_RESULT LC_Card_ExecCommand (LC_CARD *card, const char *commandName, GWEN_DB_NODE *cmdData, GWEN_DB_NODE *rspData, int timeout)
CHIPCARD_API LC_CLIENT_RESULT LC_Card_BuildApdu (LC_CARD *card, const char *command, GWEN_DB_NODE *cmdData, GWEN_BUFFER *gbuf)
Select Card/Application Type

Functions in this group tell Libchipcard which instruction set is to be used for LC_Card_ExecApdu(). It also selects the XML descriptions appropriate for the card application to be used by the functions LC_Card_SelectDf() and LC_Card_SelectEf().

A card can contain multiple applications, e.g. some HBCI cards additionally contain the GeldKarte application. Different card applications contain different files/folders (EF/DF), so Libchipcard needs to be told which card application is to be used.

CHIPCARD_API LC_CLIENT_RESULT LC_Card_SelectCard (LC_CARD *card, const char *s)
CHIPCARD_API LC_CLIENT_RESULT LC_Card_SelectApp (LC_CARD *card, const char *appName)
Select MF/DF/EF

CHIPCARD_API LC_CLIENT_RESULT LC_Card_SelectMf (LC_CARD *card)
CHIPCARD_API LC_CLIENT_RESULT LC_Card_SelectDf (LC_CARD *card, const char *fname)
CHIPCARD_API LC_CLIENT_RESULT LC_Card_SelectEf (LC_CARD *card, const char *fname)
XML Descriptions

CHIPCARD_API GWEN_XMLNODE * LC_Card_GetCardNode (const LC_CARD *card)
CHIPCARD_API GWEN_XMLNODE * LC_Card_GetAppNode (const LC_CARD *card)
CHIPCARD_API GWEN_XMLNODE * LC_Card_GetDfNode (const LC_CARD *card)
CHIPCARD_API GWEN_XMLNODE * LC_Card_GetEfNode (const LC_CARD *card)
Informational Functions

CHIPCARD_API uint32_t LC_Card_GetCardId (const LC_CARD *cd)
CHIPCARD_API const char * LC_Card_GetReaderType (const LC_CARD *cd)
CHIPCARD_API const char * LC_Card_GetDriverType (const LC_CARD *cd)
CHIPCARD_API uint32_t LC_Card_GetReaderFlags (const LC_CARD *cd)
CHIPCARD_API const char * LC_Card_GetCardType (const LC_CARD *cd)
CHIPCARD_API const
GWEN_STRINGLIST * 
LC_Card_GetCardTypes (const LC_CARD *cd)
CHIPCARD_API unsigned int LC_Card_GetAtr (const LC_CARD *cd, const unsigned char **pbuf)
CHIPCARD_API LC_CLIENTLC_Card_GetClient (const LC_CARD *cd)
Last Result

These functions return the result of the last command executed via LC_Card_ExecCommand (nearly all functions internally call that one)

CHIPCARD_API int LC_Card_GetLastSW1 (const LC_CARD *card)
CHIPCARD_API int LC_Card_GetLastSW2 (const LC_CARD *card)
CHIPCARD_API const char * LC_Card_GetLastResult (const LC_CARD *card)
CHIPCARD_API const char * LC_Card_GetLastText (const LC_CARD *card)
CHIPCARD_API void LC_Card_CreateResultString (const LC_CARD *card, const char *lastCommand, LC_CLIENT_RESULT res, GWEN_BUFFER *buf)
Debugging Functions

CHIPCARD_API void LC_Card_Dump (const LC_CARD *cd, FILE *f, int indent)
Pin Functions

CHIPCARD_API LC_PININFOLC_Card_GetPinInfoById (LC_CARD *card, uint32_t pid)
CHIPCARD_API LC_PININFOLC_Card_GetPinInfoByName (LC_CARD *card, const char *name)
CHIPCARD_API LC_CLIENT_RESULT LC_Card_GetPinStatus (LC_CARD *card, unsigned int pid, int *maxErrors, int *currentErrors)
CHIPCARD_API LC_CLIENT_RESULT LC_Card_GetInitialPin (LC_CARD *card, int id, unsigned char *buffer, unsigned int maxLen, unsigned int *pinLength)
CHIPCARD_API LC_CLIENT_RESULT LC_Card_IsoVerifyPin (LC_CARD *card, uint32_t flags, const LC_PININFO *pi, const unsigned char *ptr, unsigned int size, int *triesLeft)
CHIPCARD_API LC_CLIENT_RESULT LC_Card_IsoModifyPin (LC_CARD *card, uint32_t flags, const LC_PININFO *pi, const unsigned char *oldptr, unsigned int oldsize, const unsigned char *newptr, unsigned int newsize, int *triesLeft)
CHIPCARD_API LC_CLIENT_RESULT LC_Card_IsoPerformVerification (LC_CARD *card, uint32_t flags, const LC_PININFO *pi, int *triesLeft)
CHIPCARD_API LC_CLIENT_RESULT LC_Card_IsoPerformModification (LC_CARD *card, uint32_t flags, const LC_PININFO *pi, int *triesLeft)
Reading and Writing Data

CHIPCARD_API LC_CLIENT_RESULT LC_Card_IsoReadBinary (LC_CARD *card, uint32_t flags, int offset, int size, GWEN_BUFFER *buf)
CHIPCARD_API LC_CLIENT_RESULT LC_Card_IsoWriteBinary (LC_CARD *card, uint32_t flags, int offset, const char *ptr, unsigned int size)
CHIPCARD_API LC_CLIENT_RESULT LC_Card_IsoUpdateBinary (LC_CARD *card, uint32_t flags, int offset, const char *ptr, unsigned int size)
CHIPCARD_API LC_CLIENT_RESULT LC_Card_IsoEraseBinary (LC_CARD *card, uint32_t flags, int offset, unsigned int size)
CHIPCARD_API LC_CLIENT_RESULT LC_Card_ReadBinary (LC_CARD *card, int offset, int size, GWEN_BUFFER *buf)
Reading and Writing Records

CHIPCARD_API LC_CLIENT_RESULT LC_Card_IsoReadRecord (LC_CARD *card, uint32_t flags, int recNum, GWEN_BUFFER *buf)
CHIPCARD_API LC_CLIENT_RESULT LC_Card_IsoWriteRecord (LC_CARD *card, uint32_t flags, int recNum, const char *ptr, unsigned int size)
CHIPCARD_API LC_CLIENT_RESULT LC_Card_IsoAppendRecord (LC_CARD *card, uint32_t flags, const char *ptr, unsigned int size)
CHIPCARD_API LC_CLIENT_RESULT LC_Card_IsoUpdateRecord (LC_CARD *card, uint32_t flags, int recNum, const char *ptr, unsigned int size)
Crypto Functions

CHIPCARD_API LC_CLIENT_RESULT LC_Card_IsoManageSe (LC_CARD *card, int tmpl, int kids, int kidp, int ar)
CHIPCARD_API LC_CLIENT_RESULT LC_Card_IsoEncipher (LC_CARD *card, const char *ptr, unsigned int size, GWEN_BUFFER *codeBuf)
CHIPCARD_API LC_CLIENT_RESULT LC_Card_IsoDecipher (LC_CARD *card, const char *ptr, unsigned int size, GWEN_BUFFER *plainBuf)
CHIPCARD_API LC_CLIENT_RESULT LC_Card_IsoSign (LC_CARD *card, const char *ptr, unsigned int size, GWEN_BUFFER *sigBuf)
CHIPCARD_API LC_CLIENT_RESULT LC_Card_IsoVerify (LC_CARD *card, const char *dptr, unsigned int dsize, const char *sigptr, unsigned int sigsize)
Data Formats (Parsing and Generating)

CHIPCARD_API LC_CLIENT_RESULT LC_Card_ParseData (LC_CARD *card, const char *format, GWEN_BUFFER *buf, GWEN_DB_NODE *dbData)
CHIPCARD_API LC_CLIENT_RESULT LC_Card_CreateData (LC_CARD *card, const char *format, GWEN_BUFFER *buf, GWEN_DB_NODE *dbData)
CHIPCARD_API LC_CLIENT_RESULT LC_Card_ParseRecord (LC_CARD *card, int recNum, GWEN_BUFFER *buf, GWEN_DB_NODE *dbRecord)
CHIPCARD_API LC_CLIENT_RESULT LC_Card_CreateRecord (LC_CARD *card, int recNum, GWEN_BUFFER *buf, GWEN_DB_NODE *dbRecord)
Generated on Mon Jul 5 23:11:56 2010 for libchipcard by  doxygen 1.6.3