FedmIscTagHandler_ISO14443_4_MIFARE_DESFire_FlexSoftCrypto.h
Go to the documentation of this file.
00001 /*-----------------------------------------------------------------------
00002 |                                                                                       |
00003 |      FedmIscTagHandler_ISO14443_4_MIFARE_DESFire_FlexSoftCrypto.h             |
00004 |                                                                                       |
00005 -------------------------------------------------------------------------
00006 
00007 Copyright © 2009-2010   FEIG ELECTRONIC GmbH, All Rights Reserved.
00008                                                 Lange Strasse 4
00009                                                 D-35781 Weilburg
00010                                                 Federal Republic of Germany
00011                                                 phone    : +49 6471 31090
00012                                                 fax      : +49 6471 310999
00013                                                 e-mail   : obid-support@feig.de
00014                                                 Internet : http://www.feig.de
00015                                         
00016 Author                  :       Markus Hultsch
00017 Begin                   :       30.03.2009
00018 
00019 Version                 :       03.02.07 / 10.11.2010 / M. Hultsch
00020 
00021 Operation Systems       :       independent
00022 
00023 Function                        :       implementation class for OBID® classic-pro transponder ISO14443-4 MIFARE DESFire
00024                                                 with [0xC3] commands and flexible software cryptographic
00025 
00026 NOTE                            :       this class supports only selected mode in Host-Mode
00027 
00028 
00029 Trademarks:
00030 -----------
00031 OBID®, OBID i-scan® and OBID myAXXESS® are registered Trademarks of FEIG ELECTRONIC GmbH
00032 Other Trademarks: see FEDM.h
00033 */
00034 
00035 #if !defined(_FEDM_ISC_TAG_HANDLER_ISO14443_4_MIFARE_DESFIRE_FLEX_SOFT_CRYPTO_H_INCLUDED_)
00036 #define _FEDM_ISC_TAG_HANDLER_ISO14443_4_MIFARE_DESFIRE_FLEX_SOFT_CRYPTO_H_INCLUDED_
00037 
00038 #if !defined(_FEDM_NO_TAG_HANDLER_ISO14443)
00039 
00040 #include <string>
00041 #include "../../FEDM.h"
00042 
00043 class FedmIscTagHandler_ISO14443_4_MIFARE_DESFire;
00044 
00045 
00046 
00047 //#####################################################################################
00048 // constants
00049 //#####################################################################################
00050 
00051 
00052 
00053 
00054 
00055 //####################################################################
00056 // class FedmIscTagHandler_ISO14443_4_MIFARE_DESFire_FlexSoftCrypto
00057 // >> supports only ISO Host Commands <<
00058 //####################################################################
00059 
00070 class _FEDM_ISC_CORE_EXT_CLASS FedmIscTagHandler_ISO14443_4_MIFARE_DESFire_FlexSoftCrypto
00071 {
00072 public:
00073         friend class FedmIscTagHandler_ISO14443_4_MIFARE_DESFire;
00074         friend class FedmIscTagHandler_ISO14443_4_MIFARE_DESFire_Impl_C1;
00075         friend class FedmIscTagHandler_ISO14443_4_MIFARE_DESFire_Impl_C3;
00076 
00077         unsigned char   GetErrorSource();
00078         unsigned int    GetErrorCode();
00079 
00080         //####################################################################
00081         // 5 security related commands
00082         
00095         int Authenticate(               unsigned char ucReaderKeyIndex,
00096                                                         unsigned char ucDESFireKeyNo );
00097         
00110         int ChangeKeySettings(  unsigned char ucNewKeySettings );
00111         
00124         int GetKeySettings(             unsigned char* pucResponseData,
00125                                                         unsigned int uiResponseBufferLength,
00126                                                         unsigned int& uiResponseLength );
00127 
00140         int ChangeKey(                  unsigned char ucKeyNoToBeChanged,
00141                                                         unsigned char ucAESNewKeyVersion,
00142                                                         std::string sOldKey,
00143                                                         std::string sNewKey );
00144         
00157         int GetKeyVersion(              unsigned char ucDESFireKeyNo,
00158                                                         unsigned char* pucResponseData,
00159                                                         unsigned int uiResponseBufferLength,
00160                                                         unsigned int& uiResponseLength );
00161 
00162 
00163         //####################################################################
00164         // 10 PICC level commands
00165 
00178         int CreateApplication(  unsigned char ucPiccLevelFlags,
00179                                                         unsigned int uiApplicationID,
00180                                                         unsigned char ucKeySetting1,
00181                                                         unsigned char ucKeySetting2,
00182                                                         unsigned int uiISOFileID,
00183                                                         std::string sDFName );
00184         
00197         int DeleteApplication(  unsigned char ucPiccLevelFlags,
00198                                                         unsigned int uiApplicationID );
00199         
00212         int GetApplicationIDs(  unsigned char ucPiccLevelFlags,
00213                                                         unsigned char* pucResponseData,
00214                                                         unsigned int uiResponseBufferLength,
00215                                                         unsigned int& uiResponseLength );
00216 
00229         int FreeMemory(                 unsigned char ucPiccLevelFlags,
00230                                                         unsigned char* pucResponseData,
00231                                                         unsigned int uiResponseBufferLength,
00232                                                         unsigned int& uiResponseLength );
00233 
00246         int GetDFNames(                 unsigned char ucPiccLevelFlags,
00247                                                         unsigned char* pucResponseData,
00248                                                         unsigned int uiResponseBufferLength,
00249                                                         unsigned int& uiResponseLength );
00250         
00263         int SelectApplication(  unsigned char ucPiccLevelFlags,
00264                                                         unsigned int uiApplicationID );
00265 
00278         int FormatPICC(                 unsigned char ucPiccLevelFlags );
00279 
00292         int GetVersion(                 unsigned char ucPiccLevelFlags,
00293                                                         unsigned char* pucResponseData,
00294                                                         unsigned int uiResponseBufferLength,
00295                                                         unsigned int& uiResponseLength );
00296 
00309         int GetCardUID(                 unsigned char ucPiccLevelFlags,
00310                                                         unsigned char* pucResponseData,
00311                                                         unsigned int uiResponseBufferLength,
00312                                                         unsigned int& uiResponseLength );
00313         
00326         int SetConfiguration(   unsigned char ucPiccLevelFlags,
00327                                                         unsigned char* pucRequestData,
00328                                                         unsigned int uiRequestLength );
00329 
00330 
00331         //####################################################################
00332         // 10 application level commands
00333 
00346         int ChangeFileSettings( unsigned char ucApplicationLevelFlags,
00347                                                         unsigned char ucFileNo,
00348                                                         unsigned char ucNewFileCommSettings,
00349                                                         unsigned char ucNewFileReadWriteAccessRights,
00350                                                         unsigned char ucNewFileChangeAccessRights,
00351                                                         unsigned char ucNewFileReadAccessRights,
00352                                                         unsigned char ucNewFileWriteAccessRights );
00353 
00366         int GetFileIDs(                 unsigned char ucApplicationLevelFlags,
00367                                                         unsigned char* pucResponseData,
00368                                                         unsigned int uiResponseBufferLength,
00369                                                         unsigned int& uiResponseLength );
00370 
00383         int GetFileSettings(    unsigned char ucApplicationLevelFlags,
00384                                                         unsigned char ucFileNo,
00385                                                         unsigned char* pucResponseData,
00386                                                         unsigned int uiResponseBufferLength,
00387                                                         unsigned int& uiResponseLength );
00388 
00401         int CreateStdDataFile(  unsigned char ucApplicationLevelFlags,
00402                                                         unsigned char ucFileNo,
00403                                                         unsigned int uiISOFileID,
00404                                                         unsigned char ucFileCommSettings,
00405                                                         unsigned char ucFileReadWriteAccessRights,
00406                                                         unsigned char ucFileChangeAccessRights,
00407                                                         unsigned char ucFileReadAccessRights,
00408                                                         unsigned char ucFileWriteAccessRights,
00409                                                         unsigned int uiFileSize );
00410 
00423         int CreateBackupDataFile(       unsigned char ucApplicationLevelFlags,
00424                                                                 unsigned char ucFileNo,
00425                                                                 unsigned int uiISOFileID,
00426                                                                 unsigned char ucFileCommSettings,
00427                                                                 unsigned char ucFileReadWriteAccessRights,
00428                                                                 unsigned char ucFileChangeAccessRights,
00429                                                                 unsigned char ucFileReadAccessRights,
00430                                                                 unsigned char ucFileWriteAccessRights,
00431                                                                 unsigned int uiFileSize );
00432 
00445         int CreateValueFile(    unsigned char ucApplicationLevelFlags,
00446                                                         unsigned char ucFileNo,
00447                                                         unsigned char ucFileCommSettings,
00448                                                         unsigned char ucFileReadWriteAccessRights,
00449                                                         unsigned char ucFileChangeAccessRights,
00450                                                         unsigned char ucFileReadAccessRights,
00451                                                         unsigned char ucFileWriteAccessRights,
00452                                                         unsigned int uiLowerLimit,
00453                                                         unsigned int uiUpperLimit,
00454                                                         unsigned int uiValue,
00455                                                         unsigned char ucLimitedCreditEnabled );
00456 
00469         int CreateLinearRecordFile(     unsigned char ucApplicationLevelFlags,
00470                                                                 unsigned char ucFileNo,
00471                                                                 unsigned int uiISOFileID,
00472                                                                 unsigned char ucFileCommSettings,
00473                                                                 unsigned char ucFileReadWriteAccessRights,
00474                                                                 unsigned char ucFileChangeAccessRights,
00475                                                                 unsigned char ucFileReadAccessRights,
00476                                                                 unsigned char ucFileWriteAccessRights,
00477                                                                 unsigned int uiRecordSize,
00478                                                                 unsigned int uiMaxNoOfRecords );
00479 
00492         int CreateCyclicRecordFile(     unsigned char ucApplicationLevelFlags,
00493                                                                 unsigned char ucFileNo,
00494                                                                 unsigned int uiISOFileID,
00495                                                                 unsigned char ucFileCommSettings,
00496                                                                 unsigned char ucFileReadWriteAccessRights,
00497                                                                 unsigned char ucFileChangeAccessRights,
00498                                                                 unsigned char ucFileReadAccessRights,
00499                                                                 unsigned char ucFileWriteAccessRights,
00500                                                                 unsigned int uiRecordSize,
00501                                                                 unsigned int uiMaxNoOfRecords );
00502 
00515         int DeleteFile(                 unsigned char ucApplicationLevelFlags,
00516                                                         unsigned char ucFileNo );
00517 
00530         int GetISOFileIDs(              unsigned char ucApplicationLevelFlags,
00531                                                         unsigned char* pucResponseData,
00532                                                         unsigned int uiResponseBufferLength,
00533                                                         unsigned int& uiResponseLength );
00534 
00535 
00536         //####################################################################
00537         // 11 data manipulation commands
00538         
00551         int ReadStandardData(   unsigned char ucDataManipulationFlags,
00552                                                         unsigned char ucFileNo,
00553                                                         unsigned char ucFileCommSettings,
00554                                                         unsigned int uiFileOffset,
00555                                                         unsigned int uiFileLen,
00556                                                         unsigned char* pucFileData );
00557         
00570         int WriteStandardData(  unsigned char ucDataManipulationFlags,
00571                                                         unsigned char ucFileNo,
00572                                                         unsigned char ucFileCommSettings,
00573                                                         unsigned int uiFileOffset,
00574                                                         unsigned int uiFileLen,
00575                                                         unsigned char* pucFileData );
00576 
00589         int GetValue(                   unsigned char ucDataManipulationFlags,
00590                                                         unsigned char ucFileNo,
00591                                                         unsigned char ucFileCommSettings,
00592                                                         unsigned int& uiValue );
00593 
00606         int Credit(                             unsigned char ucDataManipulationFlags,
00607                                                         unsigned char ucFileNo,
00608                                                         unsigned char ucFileCommSettings,
00609                                                         unsigned int uiCreditValue );
00610 
00623         int Debit(                              unsigned char ucDataManipulationFlags,
00624                                                         unsigned char ucFileNo,
00625                                                         unsigned char ucFileCommSettings,
00626                                                         unsigned int uiDebitValue );
00627 
00628 
00641         int LimitedCredit(              unsigned char ucDataManipulationFlags,
00642                                                         unsigned char ucFileNo,
00643                                                         unsigned char ucFileCommSettings,
00644                                                         unsigned int uiCreditValue );
00645 
00658         int WriteRecord(                unsigned char ucDataManipulationFlags,
00659                                                         unsigned char ucFileNo,
00660                                                         unsigned char ucFileCommSettings,
00661                                                         unsigned int uiFileOffset,
00662                                                         unsigned int uiRecordLen,
00663                                                         unsigned char* pucRecordData );
00664 
00677         int ReadRecords(                unsigned char ucDataManipulationFlags,
00678                                                         unsigned char ucFileNo,
00679                                                         unsigned char ucFileCommSettings,
00680                                                         unsigned int uiRecordOffset,
00681                                                         unsigned int uiNoOfRecords,
00682                                                         unsigned int uiRecordSize,
00683                                                         unsigned char* pucRecordData );
00684 
00697         int ClearRecordFile(    unsigned char ucDataManipulationFlags,
00698                                                         unsigned char ucFileNo,
00699                                                         unsigned char ucFileCommSettings );
00700 
00713         int CommitTransaction(  unsigned char ucDataManipulationFlags );
00714 
00727         int AbortTransaction(   unsigned char ucDataManipulationFlags );
00728 
00729 protected:
00730         // constructor
00731         FedmIscTagHandler_ISO14443_4_MIFARE_DESFire_FlexSoftCrypto();
00732         // destructor
00733         virtual ~FedmIscTagHandler_ISO14443_4_MIFARE_DESFire_FlexSoftCrypto();
00734 
00735         FedmIscTagHandler_ISO14443_4_MIFARE_DESFire* m_pParent;
00736 
00737 };
00738 
00739 #endif // #if !defined(_FEDM_NO_TAG_HANDLER_ISO14443)
00740 
00741 #endif // !defined(_FEDM_ISC_TAG_HANDLER_ISO14443_4_MIFARE_DESFIRE_FLEX_SOFT_CRYPTO_H_INCLUDED_)


maggie_rfid_drivers
Author(s): Raul Perula-Martinez
autogenerated on Mon Sep 14 2015 03:05:30