TABLE OF CONTENTS

 

[Modules] Management

NAME

   DesfireAPI :: Card management functions

COPYRIGHT

DESCRIPTION

   Implementation of management functions to personalize or format the card
   For Mifare DesFire MF3ICD40 cards

[Functions] AbortTransaction

NAME

   AbortTransaction

SYNOPSIS

   [[sprox_desfire.dll]]
   SWORD SPROX_Desfire_AbortTransaction(void);

   [[sprox_desfire_ex.dll]]
   SWORD SPROXx_Desfire_AbortTransaction(SPROX_INSTANCE rInst);

   [[pcsc_desfire.dll]]
   LONG  SSCardDesfire_AbortTransaction(SCARDHANDLE hCard);

DESCRIPTION

   Invalidates all previous write access' on Backup Data Files, Value Files and Record Files
   within one application

RETURNS

   DF_OPERATION_OK    : operation succeeded
   Other code if internal or communication error has occured. 

NOTES

   Invalidates all write access to files with integrated backup mechanisms without changing the authentication status   

SEE ALSO

   CommitTransaction

[Functions] Authenticate

NAME

   Authenticate

DESCRIPTION

   Authenticates with the Acces Key on the DesFire card

SYNOPSIS

   [[sprox_desfire.dll]]
   SWORD SPROX_Desfire_Authenticate (BYTE bKeyNumber,
                                     const BYTE pbAccessKey[16]);

   [[sprox_desfire_ex.dll]]
   SWORD SPROXx_Desfire_Authenticate(SPROX_INSTANCE rInst,
                                     BYTE bKeyNumber,
                                     const BYTE pbAccessKey[16]);

   [[pcsc_desfire.dll]]
   LONG  SCardDesfire_Authenticate  (SCARDHANDLE hCard,
                                     BYTE bKeyNumber,
                                     const BYTE pbAccessKey[16]);

INPUTS

   BYTE bKeyNumber             : number of the key (KeyNo)
   const BYTE pbAccessKey[16]  : 16-byte Access Key (DES/3DES keys)

RETURNS

   DF_OPERATION_OK    : authentication succeed
   Other code if internal or communication error has occured. 

NOTES

   Both DES and 3DES keys are stored in strings consisting of 16 bytes :
   * If the 2nd half of the key string is equal to the 1st half, the key is
   handled as a single DES key by the DesFire card.
   * If the 2nd half of the key string is NOT equal to the 1st half, the key
   is handled as a 3DES key.

SEE ALSO

   ChangeKeySettings
   GetKeySettings
   ChangeKey
   GetKeyVersion

[Functions] ChangeFileSettings

NAME

   ChangeFileSettings

DESCRIPTION

   Changes the access parameters of an existing file

SYNOPSIS

   [[sprox_desfire.dll]]
   SWORD SPROX_Desfire_ChangeFileSettings(BYTE file_id,
                                     BYTE comm_mode,
                                     WORD access_rights);

   [[sprox_desfire_ex.dll]]
   SWORD SPROXx_Desfire_ChangeFileSettings(SPROX_INSTANCE rInst,
                                     BYTE file_id,
                                     BYTE comm_mode,
                                     WORD access_rights);

   [[pcsc_desfire.dll]]
   LONG  SCardDesfire_ChangeFileSettings(SCARDHANDLE hCard,
                                     BYTE file_id,
                                     BYTE comm_mode,
                                     WORD access_rights);

INPUTS

   BYTE file_id                : File IDentifier
   BYTE comm_mode              : file's communication settings (DF_COMM_MODE_PLAIN, DF_COMM_MODE_MACED, 
                                 DF_COMM_MODE_PLAIN2 or DF_COMM_MODE_ENCIPHERED)(see chapter 3.2 of 
                                 datasheet of mifare DesFire MF3ICD40 for more information)
   WORD access_rights          : file Access Rights (see chapter 3.3 of datasheet of mifare DesFire
                                 MF3ICD40 for more information)

RETURNS

   DF_OPERATION_OK    : change succeeded
   Other code if internal or communication error has occured. 

SEE ALSO

   GetFileIDs
   GetFileSettings

[Functions] ChangeKey

NAME

   ChangeKey

DESCRIPTION

   Changes any key stored on the DesFire card

SYNOPSIS

   [[sprox_desfire.dll]]
   SWORD SPROX_Desfire_ChangeKey(BYTE key_number,
                                     const BYTE new_key[16],
                                    const BYTE old_key[16]);

   [[sprox_desfire_ex.dll]]
   SWORD SPROXx_Desfire_ChangeKey(SPROX_INSTANCE rInst,
                                     BYTE key_number,
                                     const BYTE new_key[16],
                                     const BYTE old_key[16]);

   [[pcsc_desfire.dll]]
   LONG  SCardDesfire_ChangeKey(SCARDHANDLE hCard,
                                     BYTE key_number,
                                     const BYTE new_key[16],
                                     const BYTE old_key[16]);

INPUTS

   BYTE key_number             : number of the key (KeyNo)
   const BYTE new_key[16]      : 16-byte New Key (DES/3DES keys)
   const BYTE old_key[16]      : 16-byte Old Key (DES/3DES keys)                              

RETURNS

   DF_OPERATION_OK    : change succeeded
   Other code if internal or communication error has occured. 

NOTES

   Both DES and 3DES keys are stored in strings consisting of 16 bytes :
   * If the 2nd half of the key string is equal to the 1st half, the key is
   handled as a single DES key by the DesFire card.
   * If the 2nd half of the key string is NOT equal to the 1st half, the key
   is handled as a 3DES key.

   After a successful change of the key used to reach the current authentication status, this
   authentication is invalidated, an authentication with the new key is necessary for subsequent
   operations.

SEE ALSO

   Authenticate
   ChangeKeySettings
   GetKeySettings
   GetKeyVersion

[Functions] ChangeKeySettings

NAME

   ChangeKeySettings

DESCRIPTION

   Changes the key settings of the currently selected application
   (or of card's master key if root application is selected)

SYNOPSIS

   [[sprox_desfire.dll]]
   SWORD SPROX_Desfire_ChangeKeySettings (BYTE key_settings);

   [[sprox_desfire_ex.dll]]
   SWORD SPROXx_Desfire_ChangeKeySettings(SPROX_INSTANCE rInst,
                                          BYTE key_settings);

   [[pcsc_desfire.dll]]
   LONG  SCardDesfire_ChangeKeySettings  (SCARDHANDLE hCard,
                                          BYTE key_settings);

INPUTS

   BYTE key_settings  : new key settings (see chapter 4.3.2 of datasheet of mifare
                        DesFire MF3ICD40 for more information)               

RETURNS

   DF_OPERATION_OK    : change succeeded
   Other code if internal or communication error has occured. 

SEE ALSO

   Authenticate
   GetKeySettings
   ChangeKey
   GetKeyVersion

[Functions] CommitTransaction

NAME

   CommitTransaction

DESCRIPTION

   Validates all previous write access' on Backup Data Files, Value Files and Record Files within
   one application

SYNOPSIS

   [[sprox_desfire.dll]]
   SWORD SPROX_Desfire_CommitTransaction(void);

   [[sprox_desfire_ex.dll]]
   SWORD SPROXx_Desfire_CommitTransaction(SPROX_INSTANCE rInst);

   [[pcsc_desfire.dll]]
   LONG  SCardDesfire_CommitTransaction(SCARDHANDLE hCard);

RETURNS

   DF_OPERATION_OK    : operation succeeded
   Other code if internal or communication error has occured. 

NOTES

   Validates all write access to files with integrated backup mechanisms

SEE ALSO

   AbortTransaction

[Functions] CreateApplication

NAME

   CreateApplication

DESCRIPTION

   Create new applications on the DesFire card

SYNOPSIS

   [[sprox_desfire.dll]]
   SWORD SPROX_Desfire_CreateApplication(DWORD aid,
                                     BYTE key_settings,
                                     BYTE keys_count);

   [[sprox_desfire_ex.dll]]
   SWORD SPROXx_Desfire_CreateApplication(SPROX_INSTANCE rInst,
                                     DWORD aid,
                                     BYTE key_settings,
                                     BYTE keys_count);

   [[pcsc_desfire.dll]]
   LONG  SCardDesfire_CreateApplication(SCARDHANDLE hCard,
                                     DWORD aid,
                                     BYTE key_settings,
                                     BYTE keys_count);

INPUTS

   DWORD aid                   : Application IDentifier
   BYTE key_settings           : Application master key settings (see chapter 4.3.2 of datasheet
                                 of mifare DesFire MF3ICD40 for more information)
   BYTE keys_count             : Number of key that can be stored within the application for 
                                 cryptographic purposes

RETURNS

   DF_OPERATION_OK    : application created successfully
   Other code if internal or communication error has occured. 

SEE ALSO

   DeleteApplication
   GetApplicationIDs
   SelectApplication

[Functions] CreateBackupDataFile

NAME

   CreateBackupDataFile

DESCRIPTION

   Creates files for the storage of plain unformatted user data within an existing application
   on the DesFire card, additionally supporting the feature of integrated backup mechanism

SYNOPSIS

   [[sprox_desfire.dll]]
   SWORD SPROX_Desfire_CreateBackupDataFile(BYTE file_id,
                                     BYTE comm_mode,
                                     WORD access_rights,
                                     DWORD file_size);

   [[sprox_desfire_ex.dll]]
   SWORD SPROXx_Desfire_CreateBackupDataFile(SPROX_INSTANCE rInst,
                                     BYTE file_id,
                                     BYTE comm_mode,
                                     WORD access_rights,
                                     DWORD file_size);

   [[pcsc_desfire.dll]]
   LONG  SCardDesfire_CreateBackupDataFile(SCARDHANDLE hCard,
                                     BYTE file_id,
                                     BYTE comm_mode,
                                     WORD access_rights,
                                     DWORD file_size);

INPUTS

   BYTE file_id                : File IDentifier
   BYTE comm_mode              : file's communication settings (DF_COMM_MODE_PLAIN, DF_COMM_MODE_MACED, 
                                 DF_COMM_MODE_PLAIN2 or DF_COMM_MODE_ENCIPHERED)(see chapter 3.2 of 
                                 datasheet of mifare DesFire MF3ICD40 for more information)
   WORD access_rights          : file Access Rights (see chapter 3.3 of datasheet of mifare DesFire
                                 MF3ICD40 for more information)
   DWORD file_size             : size of the file in bytes

RETURNS

   DF_OPERATION_OK    : Backup Data File  succeeded
   Other code if internal or communication error has occured. 

NOTES

   Due to the mirror image a BackupDataFile always consumes DOUBLE the NV-memory on the DesFire card
   compared to a StdDataFile with the same specified FileSize.

SEE ALSO

   CreateStdDataFile
   CreateValueFile
   CreateLinearRecordFile
   CreateCyclicRecordFile
   DeleteFile

[Functions] CreateCyclicRecordFile

NAME

   CreateCyclicRecordFile

DESCRIPTION

   Creates a cyclic record file

SYNOPSIS

   [[sprox_desfire.dll]]
   SWORD SPROX_Desfire_CreateCyclicRecordFile(BYTE file_id,
                                     BYTE comm_mode,
                                     WORD access_rights,
                                     DWORD record_size,
                                     DWORD max_records);

   [[sprox_desfire_ex.dll]]
   SWORD SPROXx_Desfire_CreateCyclicRecordFile(SPROX_INSTANCE rInst,
                                     BYTE file_id,
                                     BYTE comm_mode,
                                     WORD access_rights,
                                     DWORD record_size,
                                     DWORD max_records);

   [[pcsc_desfire.dll]]
   LONG  SCardDesfire_CreateCyclicRecordFile(SCARDHANDLE hCard,
                                     BYTE file_id,
                                     BYTE comm_mode,
                                     WORD access_rights,
                                     DWORD record_size,
                                     DWORD max_records);

INPUTS

   BYTE file_id                : File IDentifier
   BYTE comm_mode              : file's communication settings (DF_COMM_MODE_PLAIN, DF_COMM_MODE_MACED, 
                                 DF_COMM_MODE_PLAIN2 or DF_COMM_MODE_ENCIPHERED)(see chapter 3.2 of 
                                 datasheet of mifare DesFire MF3ICD40 for more information)
   WORD access_rights          : file Access Rights (see chapter 3.3 of datasheet of mifare DesFire
                                 MF3ICD40 for more information)
   DWORD file_size             : size of the file in bytes
   DWORD record_size           : size of one single record in bytes
   DWORD max_records           : maximum number of records

RETURNS

   DF_OPERATION_OK    : file created successfully
   Other code if internal or communication error has occured. 

NOTES

   Once the file is filled completely with data records, the DesFire card automatically overwrites
   the oldest record with the latest written one.
   Cyclic Record Files feature always the integrated backup mechanism. Therefore every access appending
   a record needs to be valitaded using the CommitTransaction.
   As the backup feature consumes one record, the max_records needs to be one larger than the 
   application requires.

SEE ALSO

   CreateStdDataFile
   CreateBackupDataFile
   CreateValueFile
   CreateLinearRecordFile
   DeleteFile

[Functions] CreateLinearRecordFile

NAME

   CreateLinearRecordFile

DESCRIPTION

   Creates a linear record file

SYNOPSIS

   [[sprox_desfire.dll]]
   SWORD SPROX_Desfire_CreateLinearRecordFile(BYTE file_id,
                                     BYTE comm_mode,
                                     WORD access_rights,
                                     DWORD record_size,
                                     DWORD max_records);

   [[sprox_desfire_ex.dll]]
   SWORD SPROXx_Desfire_CreateLinearRecordFile(SPROX_INSTANCE rInst,
                                     BYTE file_id,
                                     BYTE comm_mode,
                                     WORD access_rights,
                                     DWORD record_size,
                                     DWORD max_records);

   [[pcsc_desfire.dll]]
   LONG  SCardDesfire_CreateLinearRecordFile(SCARDHANDLE hCard,
                                     BYTE file_id,
                                     BYTE comm_mode,
                                     WORD access_rights,
                                     DWORD record_size,
                                     DWORD max_records);

INPUTS

   BYTE file_id                : File IDentifier
   BYTE comm_mode              : file's communication settings (DF_COMM_MODE_PLAIN, DF_COMM_MODE_MACED, 
                                 DF_COMM_MODE_PLAIN2 or DF_COMM_MODE_ENCIPHERED)(see chapter 3.2 of 
                                 datasheet of mifare DesFire MF3ICD40 for more information)
   WORD access_rights          : file Access Rights (see chapter 3.3 of datasheet of mifare DesFire
                                 MF3ICD40 for more information)
   DWORD record_size           : size of one single record in bytes
   DWORD max_records           : maximum number of records

RETURNS

   DF_OPERATION_OK    : file created successfully
   Other code if internal or communication error has occured. 

NOTES

   Once the file is filled completely with data records, further writing to the file is not 
   possible unless it is cleared.
   Linear Record Files feature always the integrated backup mechanism. Therefore every access appending
   a record needs to be valitaded using the CommitTransaction.

SEE ALSO

   CreateStdDataFile
   CreateBackupDataFile
   CreateValueFile
   CreateCyclicRecordFile
   DeleteFile

[Functions] CreateStdDataFile

NAME

   CreateStdDataFile

DESCRIPTION

   Creates files for the storage of plain unformatted user data within an existing application
   on the DesFire card

SYNOPSIS

   [[sprox_desfire.dll]]
   SWORD SPROX_Desfire_CreateStdDataFile(BYTE file_id,
                                     BYTE comm_mode,
                                     WORD access_rights,
                                     DWORD file_size);

   [[sprox_desfire_ex.dll]]
   SWORD SPROXx_Desfire_CreateStdDataFile(SPROX_INSTANCE rInst,
                                     BYTE file_id,
                                     BYTE comm_mode,
                                     WORD access_rights,
                                     DWORD file_size);

   [[pcsc_desfire.dll]]
   LONG  SCardDesfire_CreateStdDataFile(SCARDHANDLE hCard,
                                     BYTE file_id,
                                     BYTE comm_mode,
                                     WORD access_rights,
                                     DWORD file_size);

INPUTS

   BYTE file_id                : File IDentifier
   BYTE comm_mode              : file's communication settings (DF_COMM_MODE_PLAIN, DF_COMM_MODE_MACED, 
                                 DF_COMM_MODE_PLAIN2 or DF_COMM_MODE_ENCIPHERED)(see chapter 3.2 of 
                                 datasheet of mifare DesFire MF3ICD40 for more information)
   WORD access_rights          : file Access Rights (see chapter 3.3 of datasheet of mifare DesFire
                                 MF3ICD40 for more information)
   DWORD file_size             : size of the file in bytes

RETURNS

   DF_OPERATION_OK    : creation succeeded
   Other code if internal or communication error has occured. 

NOTES

   The mifare DesFire MF3ICD40 internally allocates NV-memory in mutltiples of 32 bytes. Therefore
   a file creation command with file_size parameter equal to 1 byte will internally consume the 
   same amount of NV-memory as a 32 byte.

SEE ALSO

   CreateBackupDataFile
   CreateValueFile
   CreateLinearRecordFile
   CreateCyclicRecordFile
   DeleteFile

[Functions] CreateValueFile

NAME

   CreateValueFile

DESCRIPTION

   Creates files for storage and manipulation of 32bit signed integer values within an existing
   application on the DesFire card

SYNOPSIS

   [[sprox_desfire.dll]]
   SWORD SPROX_Desfire_CreateValueFile(BYTE file_id,
                                     BYTE comm_mode,
                                     WORD access_rights,
                                     SDWORD lower_limit,
                                     SDWORD upper_limit,
                                     SDWORD initial_value,
                                     BYTE limited_credit_enabled);

   [[sprox_desfire_ex.dll]]
   SWORD SPROXx_Desfire_CreateValueFile(SPROX_INSTANCE rInst,
                                     BYTE file_id,
                                     BYTE comm_mode,
                                     WORD access_rights,
                                     SDWORD lower_limit,
                                     SDWORD upper_limit,
                                     SDWORD initial_value,
                                     BYTE limited_credit_enabled);

   [[pcsc_desfire.dll]]
   LONG  SCardDesfire_CreateValueFile(SCARDHANDLE hCard,
                                     BYTE file_id,
                                     BYTE comm_mode,
                                     WORD access_rights,
                                    SDWORD lower_limit,
                                    SDWORD upper_limit,
                                    SDWORD initial_value,
                                    BYTE limited_credit_enabled);

INPUTS

   BYTE file_id                : File IDentifier
   BYTE comm_mode              : file's communication settings (DF_COMM_MODE_PLAIN, DF_COMM_MODE_MACED, 
                                 DF_COMM_MODE_PLAIN2 or DF_COMM_MODE_ENCIPHERED)(see chapter 3.2 of 
                                 datasheet of mifare DesFire MF3ICD40 for more information)
   WORD access_rights          : file Access Rights (see chapter 3.3 of datasheet of mifare DesFire
                                 MF3ICD40 for more information)
   SDWORD lower_limit          : lower limit which is valid for this file. The lower limit marks 
                                 the boundary which must not be passed by a Debit calculation on 
                                 the current value
   SDWORD upper_limit          : the upper limit which sets the boundary in the same manner but for
                                 the Credit operation
   SDWORD initial_value        : specifies the initial value of the value file
   BYTE limited_credit_enabled : activation of the LimitedCredit feature (0 disabled, 1 enabled)

RETURNS

   DF_OPERATION_OK    : file created
   Other code if internal or communication error has occured. 

NOTES

   The upper limit has to be >= lower limit.
   ValuesFiles feature always the integrated backup mechanism. Therefore every access changing the 
   value needs to be valitaded using the CommitTransaction.

SEE ALSO

   CreateStdDataFile
   CreateBackupDataFile
   CreateLinearRecordFile
   CreateCyclicRecordFile
   DeleteFile

[Functions] DeleteApplication

NAME

   DeleteApplication

DESCRIPTION

   Permanently deactivates an application on the DesFire card

SYNOPSIS

   [[sprox_desfire.dll]]
   SWORD SPROX_Desfire_DeleteApplication(DWORD aid);

   [[sprox_desfire_ex.dll]]
   SWORD SPROXx_Desfire_DeleteApplication(SPROX_INSTANCE rInst,
                                     DWORD aid);

   [[pcsc_desfire.dll]]
   LONG  SCardDesfire_DeleteApplication(SCARDHANDLE hCard,
                                     DWORD aid);

INPUTS

   DWORD aid                   : Application IDentifier

RETURNS

   DF_OPERATION_OK    : application deleted successfully
   Other code if internal or communication error has occured. 

SEE ALSO

   CreateApplication
   GetApplicationIDs
   SelectApplication

[Functions] DeleteFile

NAME

   DeleteFile

DESCRIPTION

   Permanently deactivates a file within the file directory of the currently selected application

SYNOPSIS

   [[sprox_desfire.dll]]
   SWORD SPROX_Desfire_DeleteFile(BYTE file_id);

   [[sprox_desfire_ex.dll]]
   SWORD SPROXx_Desfire_DeleteFile(SPROX_INSTANCE rInst,
                                          BYTE file_id);

   [[pcsc_desfire.dll]]
   LONG  SCardDesfire_DeleteFile(SCARDHANDLE hCard,
                                          BYTE file_id);

INPUTS

   BYTE file_id                : File IDentifier

RETURNS

   DF_OPERATION_OK    : File deleted successfully
   Other code if internal or communication error has occured. 

NOTES

   Depending on the application master key settings, a preceding authentication with the master 
   key is required.

SEE ALSO

   CreateStdDataFile
   CreateBackupDataFile
   CreateValueFile
   CreateLinearRecordFile
   CreateCyclicRecordFile

[Types] DF_ADDITIONAL_FILE_SETTINGS

NAME

   DF_ADDITIONAL_FILE_SETTINGS

DESCRIPTION

   Union for returning the information supplied by the GetFileSettings command.
   Use stDataFileSettings for Standard Data Files and Backup Data Files.
   Use stValueFileSettings for Value Files.
   Use stRecordFileSettings for Linear Record Files and Cyclic Record Files.

SOURCE

   {
     struct
     {
       DWORD   eFileSize;             //user file size
     } stDataFileSettings;
       
     struct
     {
       SDWORD  lLowerLimit;           // lower limit of the file
       SDWORD  lUpperLimit;           // upper limit of the file
       DWORD   eLimitedCredit;        // limited credit value
       BYTE    bLimitedCreditEnabled; // limited credit enabled
     } stValueFileSettings;
     
     struct
     {
       DWORD   eRecordSize;           // record size
       DWORD   eMaxNRecords;          // maximum number of records
       DWORD   eCurrNRecords;         // current number of records
     } stRecordFileSettings;
   } DF_ADDITIONAL_FILE_SETTINGS;

[Types] DF_VERSION_INFO

NAME

   DF_VERSION_INFO

DESCRIPTION

   Structure for returning the information supplied by the GetVersion command.

SOURCE

   {
     // hardware related information
     BYTE    bHwVendorID;     // vendor ID (0x04 for NXP)
     BYTE    bHwType;         // type (0x01)
     BYTE    bHwSubType;      // subtype (0x01)
     BYTE    bHwMajorVersion; // major version number
     BYTE    bHwMinorVersion; // minor version number
     BYTE    bHwStorageSize;  // storage size (0x18 = 4096 bytes)
     BYTE    bHwProtocol;     // communication protocol type (0x05 meaning ISO 14443-2 and -3)
 
     // software related information
     BYTE    bSwVendorID;     // vendor ID (0x04 for NXP)
     BYTE    bSwType;         // type (0x01)
     BYTE    bSwSubType;      // subtype (0x01)
     BYTE    bSwMajorVersion; // major version number
     BYTE    bSwMinorVersion; // minor version number
     BYTE    bSwStorageSize;  // storage size (0x18 = 4096 bytes)
     BYTE    bSwProtocol;     // communication protocol type (0x05 meaning ISO 14443-3 and -4)

     BYTE    abUid[7];        // unique serial number
     BYTE    abBatchNo[5];    // production batch number
     BYTE    bProductionCW;   // calendar week of production
     BYTE    bProductionYear; // year of production
   } DF_VERSION_INFO;

[Functions] FormatPICC

NAME

   FormatPICC

DESCRIPTION

   Releases the DesFire card user memory

SYNOPSIS

   [[sprox_desfire.dll]]
   SWORD SPROX_Desfire_FormatPICC(void);

   [[sprox_desfire_ex.dll]]
   SWORD SPROXx_Desfire_FormatPICC(SPROX_INSTANCE rInst);

   [[pcsc_desfire.dll]]
   LONG  SCardDesfire_FormatPICC(SCARDHANDLE hCard);

RETURNS

   DF_OPERATION_OK    : format succeeded
   Other code if internal or communication error has occured. 

NOTES

   All applications are deleted and all files within those applications  are deleted.
   This command always requires a preceding authentication with the DesFire card master key.

[Functions] GetApplicationIDs

NAME

   GetApplicationIDs

DESCRIPTION

   Returns the Application IDentifiers of all active applications on a DesFire card

SYNOPSIS

   [[sprox_desfire.dll]]
   SWORD SPROX_Desfire_GetApplicationIDs(BYTE aid_max_count,
                                     DWORD aid_list[],
                                     BYTE *aid_count);

   [[sprox_desfire_ex.dll]]
   SWORD SPROXx_Desfire_GetApplicationIDs(SPROX_INSTANCE rInst,
                                     BYTE aid_max_count,
                                     DWORD aid_list[],
                                     BYTE *aid_count);

   [[pcsc_desfire.dll]]
   LONG  SCardDesfire_GetApplicationIDs(SCARDHANDLE hCard,
                                     BYTE aid_max_count,
                                     DWORD aid_list[],
                                     BYTE *aid_count);

INPUTS

   BYTE aid_max_count          : maximum number of Application IDentifiers
   DWORD aid_list[]            : Application IDentifier list 
   BYTE *aid_count             : number of Application IDentifiers on DesFire card

RETURNS

   DF_OPERATION_OK    : operation succeeded
   Other code if internal or communication error has occured. 

SEE ALSO

   CreateApplication
   DeleteApplication
   SelectApplication

[Functions] GetFileIDs

NAME

   GetFileIDs

DESCRIPTION

   Returns the File IDentifiers of all active files within the currently selected application

SYNOPSIS

   [[sprox_desfire.dll]]
   SWORD SPROX_Desfire_GetFileIDs(BYTE fid_max_count,
                                     BYTE fid_list[],
                                     BYTE *fid_count);

   [[sprox_desfire_ex.dll]]
   SWORD SPROXx_Desfire_GetFileIDs(SPROX_INSTANCE rInst,
                                     BYTE fid_max_count,
                                     BYTE fid_list[],
                                     BYTE *fid_count);

   [[pcsc_desfire.dll]]
   LONG  SCardDesfire_GetFileIDs(SCARDHANDLE hCard,
                                     BYTE fid_max_count,
                                     BYTE fid_list[],
                                     BYTE *fid_count);

INPUTS

   BYTE fid_max_count          : maximum number of File IDentifiers
   DWORD fid_list[]            : File IDentifiers list 
   BYTE *fid_count             : number of File IDentifiers on DesFire card

RETURNS

   DF_OPERATION_OK    : operation succeeded
   Other code if internal or communication error has occured. 

SEE ALSO

   GetFileSettings
   ChangeFileSettings

[Functions] GetFileSettings

NAME

   GetFileSettings

DESCRIPTION

   Get information on the properties of a specific file

SYNOPSIS

   [[sprox_desfire.dll]]
   SWORD SPROX_Desfire_GetFileSettings(BYTE file_id,
                                     BYTE *file_type,
                                     BYTE *comm_mode,
                                     WORD *access_rights,
                                     DF_ADDITIONAL_FILE_SETTINGS *additionnal_settings);

   [[sprox_desfire_ex.dll]]
   SWORD SPROXx_Desfire_GetFileSettings(SPROX_INSTANCE rInst,
                                     BYTE file_id,
                                     BYTE *file_type,
                                     BYTE *comm_mode,
                                     WORD *access_rights,
                                     DF_ADDITIONAL_FILE_SETTINGS *additionnal_settings);

   [[pcsc_desfire.dll]]
   LONG  SCardDesfire_GetFileSettings(SCARDHANDLE hCard,
                                     BYTE file_id,
                                     BYTE *file_type,
                                     BYTE *comm_mode,
                                     WORD *access_rights,
                                     DF_ADDITIONAL_FILE_SETTINGS *additionnal_settings);

INPUTS

   BYTE file_id                : File IDentifier
   BYTE *file_type             : type of file (DF_STANDARD_DATA_FILE, DF_BACKUP_DATA_FILE, 
                                 DF_VALUE_FILE, DF_LINEAR_RECORD_FILE or DF_CYCLIC_RECORD_FILE)
   BYTE *comm_mode             : file's communication settings (DF_COMM_MODE_PLAIN, DF_COMM_MODE_MACED, 
                                 DF_COMM_MODE_PLAIN2 or DF_COMM_MODE_ENCIPHERED)(see chapter 3.2 of 
                                 datasheet of mifare DesFire MF3ICD40 for more information)
   WORD *access_rights         : file Access Rights (see chapter 3.3 of datasheet of mifare DesFire
                                 MF3ICD40 for more information)
   DF_ADDITIONAL_FILE_SETTINGS *additionnal_settings : information file

RETURNS

   DF_OPERATION_OK    : operation succeeded
   Other code if internal or communication error has occured. 

SEE ALSO

   GetFileIDs
   ChangeFileSettings

[Functions] GetKeySettings

NAME

   GetKeySettings

DESCRIPTION

   Gets information on the DesFire card and application master key settings. In addition it returns
   the maximum number of keys which can be stored within the selected application.

SYNOPSIS

   [[sprox_desfire.dll]]
   SWORD SPROX_Desfire_GetKeySettings (BYTE *key_settings,
                                       BYTE *key_count);

   [[sprox_desfire_ex.dll]]
   SWORD SPROXx_Desfire_GetKeySettings(SPROX_INSTANCE rInst,
                                       BYTE *key_settings,
                                       BYTE *key_count);

   [[pcsc_desfire.dll]]
   LONG  SCardDesfire_GetKeySettings  (SCARDHANDLE hCard,
                                       BYTE *key_settings,
                                       BYTE *key_count);

INPUTS

   BYTE *key_settings          : master key settings (see chapter 4.3.2 of datasheet of mifare
                                 DesFire MF3ICD40 for more information)
   BYTE *key_count             : maximum number of keys           

RETURNS

   DF_OPERATION_OK    : operation succeeded
   Other code if internal or communication error has occured. 

SEE ALSO

   Authenticate
   ChangeKeySettings
   ChangeKey
   GetKeyVersion

[Functions] GetKeyVersion

NAME

   GetKeyVersion

DESCRIPTION

   Reads out the current key version of any key stored on the PICC

SYNOPSIS

   [[sprox_desfire.dll]]
   SWORD SPROX_Desfire_GetKeyVersion(BYTE bKeyNumber,
                                       BYTE *pbKeyVersion);

   [[sprox_desfire_ex.dll]]
   SWORD SPROXx_Desfire_GetKeyVersion(SPROX_INSTANCE rInst,
                                       BYTE bKeyNumber,
                                       BYTE *pbKeyVersion);

   [[pcsc_desfire.dll]]
   LONG  SCardDesfire_GetKeyVersion(SCARDHANDLE hCard,
                                       BYTE bKeyNumber,
                                       BYTE *pbKeyVersion);

INPUTS

   BYTE bKeyNumber             : number of the key (KeyNo)
   BYTE *pbKeyVersion          : current version of the specified key

RETURNS

   DF_OPERATION_OK    : operation succeeded
   Other code if internal or communication error has occured. 

NOTES

   This command can be issued without valid authentication.

SEE ALSO

   Authenticate
   GetKeySettings
   ChangeKeySettings
   ChangeKey

[Functions] GetVersion

NAME

   GetVersion

DESCRIPTION

   Returns manufacturing related data of the DesFire card

SYNOPSIS

   [[sprox_desfire.dll]]
   SWORD SPROX_Desfire_GetVersion(DF_VERSION_INFO *pVersionInfo);

   [[sprox_desfire_ex.dll]]
   SWORD SPROXx_Desfire_GetVersion(SPROX_INSTANCE rInst,
                                     DF_VERSION_INFO *pVersionInfo);

   [[pcsc_desfire.dll]]
   LONG  SCardDesfire_GetVersion(SCARDHANDLE hCard,
                                     DF_VERSION_INFO *pVersionInfo);

INPUTS

   DF_VERSION_INFO *pVersionInfo : card's version information

RETURNS

   DF_OPERATION_OK    : operation succeeded
   Other code if internal or communication error has occured. 

[Functions] SelectApplication

NAME

   SelectApplication

DESCRIPTION

   Selects one specific application for further access

SYNOPSIS

   [[sprox_desfire.dll]]
   SWORD SPROX_Desfire_SelectApplication(DWORD aid);

   [[sprox_desfire_ex.dll]]
   SWORD SPROXx_Desfire_SelectApplication(SPROX_INSTANCE rInst,
                                     DWORD aid);

   [[pcsc_desfire.dll]]
   LONG  SCardDesfire_SelectApplication(SCARDHANDLE hCard,
                                     DWORD aid);

INPUTS

   DWORD aid                   : Application IDentifier

RETURNS

   DF_OPERATION_OK    : application selected
   Other code if internal or communication error has occured. 

SEE ALSO

   CreateApplication
   DeleteApplication
   GetApplicationIDs

Generated from sprox_desfire_mgmt.c on Mon Mar 30 17:54:39 2009