NXP Reader Library  v17.1.0.2535

These Components implement the MIFARE DESFire ISO/IEC 7816-4 Basic inter-industry commands. More...

Collaboration diagram for Commands_ISO7816:

Modules

 Defines
 These are definitions for phalMfdf_IsoSelectFile.
 

Functions

phStatus_t phalMfdf_IsoSelectFile (void *pDataParams, uint8_t bOption, uint8_t bSelector, uint8_t *pFid, uint8_t *pDFname, uint8_t bDFnameLen, uint8_t **ppFCI, uint16_t *pwFCILen)
 ISO Select. More...
 
phStatus_t phalMfdf_IsoReadBinary (void *pDataParams, uint16_t wOption, uint8_t bOffset, uint8_t bSfid, uint8_t bBytesToRead, uint8_t **ppRxBuffer, uint16_t *pBytesRead)
 ISO Read Binary. More...
 
phStatus_t phalMfdf_IsoUpdateBinary (void *pDataParams, uint8_t bOffset, uint8_t bSfid, uint8_t *pData, uint8_t bDataLen)
 Iso Update Binary. More...
 
phStatus_t phalMfdf_IsoReadRecords (void *pDataParams, uint16_t wOption, uint8_t bRecNo, uint8_t bReadAllFromP1, uint8_t bSfid, uint8_t bBytesToRead, uint8_t **ppRxBuffer, uint16_t *pBytesRead)
 Iso Read Records. More...
 
phStatus_t phalMfdf_IsoAppendRecord (void *pDataParams, uint8_t bSfid, uint8_t *pData, uint8_t bDataLen)
 Iso Append record. More...
 
phStatus_t phalMfdf_IsoGetChallenge (void *pDataParams, uint16_t wKeyNo, uint16_t wKeyVer, uint8_t bLe, uint8_t *pRPICC1)
 ISOGetChallenge. More...
 
phStatus_t phalMfdf_IsoExternalAuthenticate (void *pDataParams, uint8_t *pInput, uint8_t bInputLen, uint8_t *pDataOut, uint8_t *pOutLen)
 Iso External Authenticate. More...
 
phStatus_t phalMfdf_IsoInternalAuthenticate (void *pDataParams, uint8_t *pInput, uint8_t bInputLen, uint8_t *pDataOut, uint8_t *pOutLen)
 Iso Internal Authenticate. More...
 
phStatus_t phalMfdf_IsoAuthenticate (void *pDataParams, uint16_t wKeyNo, uint16_t wKeyVer, uint8_t bKeyNoCard, uint8_t bIsPICCkey)
 Perform Iso authentication GetChallenge, External Authenticate & Internal Authenticate of a DESFire PICC. More...
 

Detailed Description

These Components implement the MIFARE DESFire ISO/IEC 7816-4 Basic inter-industry commands.

Function Documentation

◆ phalMfdf_IsoSelectFile()

phStatus_t phalMfdf_IsoSelectFile ( void *  pDataParams,
uint8_t  bOption,
uint8_t  bSelector,
uint8_t pFid,
uint8_t pDFname,
uint8_t  bDFnameLen,
uint8_t **  ppFCI,
uint16_t pwFCILen 
)

ISO Select.

This command is implemented in compliance with ISO/IEC 7816-4.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bOption[In] Option for return / no return of FCI.
[in]bSelector[In] The selector to be used.
[in]pFid[In] The ISO File number to be selected.
[in]pDFname[In] The ISO DFName to be selected. Valid only when bOption = 0x04.
[in]bDFnameLen[In] Length of bytes available in DFname buffer.
[out]ppFCI[Out] The FCI information returned by the PICC.
[out]pwFCILen[Out] Length of bytes available in FCI buffer.

◆ phalMfdf_IsoReadBinary()

phStatus_t phalMfdf_IsoReadBinary ( void *  pDataParams,
uint16_t  wOption,
uint8_t  bOffset,
uint8_t  bSfid,
uint8_t  bBytesToRead,
uint8_t **  ppRxBuffer,
uint16_t pBytesRead 
)

ISO Read Binary.

This command is implemented in compliance with ISO/IEC 7816-4.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_SUCCESS_CHAININGoperation success with chaining.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]wOption[In] One of the below options.
[in]bOffset[In] The offset from where the data should be read.
[in]bSfid[In] Short ISO File Id. Bit 7 should be 1 to indicate Sfid is supplied. Else it is treated as MSB of 2Byte offset.
[in]bBytesToRead[In] Number of bytes to read. If 0, then entire file to be read.
[out]ppRxBuffer[Out] The data retuned by the PICC.
[out]pBytesRead[Out] Length of bytes available in RxData buffer.

◆ phalMfdf_IsoUpdateBinary()

phStatus_t phalMfdf_IsoUpdateBinary ( void *  pDataParams,
uint8_t  bOffset,
uint8_t  bSfid,
uint8_t pData,
uint8_t  bDataLen 
)

Iso Update Binary.

This command is implemented in compliance with ISO/IEC 7816-4.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bOffset[In] The offset from where the data should be updated.
[in]bSfid[In] Short ISO File Id. Bit 7 should be 1 to indicate Sfid is supplied. Else it is treated as MSB of 2Byte offset.
[in]pData[In] Data to be updated.
[in]bDataLen[In] Length of bytes available in Data buffer.

◆ phalMfdf_IsoReadRecords()

phStatus_t phalMfdf_IsoReadRecords ( void *  pDataParams,
uint16_t  wOption,
uint8_t  bRecNo,
uint8_t  bReadAllFromP1,
uint8_t  bSfid,
uint8_t  bBytesToRead,
uint8_t **  ppRxBuffer,
uint16_t pBytesRead 
)

Iso Read Records.

This command is implemented in compliance with ISO/IEC 7816-4.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]wOption[In] One of the below options.
[in]bRecNo[In] Record to read / from where to read.
[in]bReadAllFromP1[In] Whether to read all records from P1 or just one.
[in]bSfid[In] Short ISO File Id.
[in]bBytesToRead[In] Number of bytes to read.
[out]ppRxBuffer[Out] The data retuned by the PICC.
[out]pBytesRead[Out] Length of bytes available in RxData buffer.

◆ phalMfdf_IsoAppendRecord()

phStatus_t phalMfdf_IsoAppendRecord ( void *  pDataParams,
uint8_t  bSfid,
uint8_t pData,
uint8_t  bDataLen 
)

Iso Append record.

This command is implemented in compliance with ISO/IEC 7816-4.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bSfid[In] Short ISO File Id.
[in]pData[In] Data to be appended.
[in]bDataLen[In] Length of bytes available in Data buffer.

◆ phalMfdf_IsoGetChallenge()

phStatus_t phalMfdf_IsoGetChallenge ( void *  pDataParams,
uint16_t  wKeyNo,
uint16_t  wKeyVer,
uint8_t  bLe,
uint8_t pRPICC1 
)

ISOGetChallenge.

This command is implemented in compliance with ISO/IEC 7816-4.

Remarks
THIS COMMAND IS NOT SUPPORTED IN SAM-X Configuration.

Returns the random number from the PICC. Size depends on the key type referred by wKeyNo and wKeyVer.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]wKeyNo[In] Key number to be used form keystore.
[in]wKeyVer[In] Key version to be used from key store.
[in]bLe[In] Length of expected challenge RPICC1.
[out]pRPICC1[Out] RPICC1 returned from PICC.

◆ phalMfdf_IsoExternalAuthenticate()

phStatus_t phalMfdf_IsoExternalAuthenticate ( void *  pDataParams,
uint8_t pInput,
uint8_t  bInputLen,
uint8_t pDataOut,
uint8_t pOutLen 
)

Iso External Authenticate.

This command is implemented in compliance with ISO/IEC 7816-4.

Remarks
THIS COMMAND IS NOT SUPPORTED IN SAM-X Configuration.
Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]pInput[In] Input data should be as mentioned below. Reference to crypto algorigthm - 1 Byte: 00 => context defined, 02 => 2K3DES, 04 => 3k3DES, 09 => AES128
Card master key flag - 1 Byte: 0x00 if card master key, 0x01 otherwise.
Key number on card - 1 Byte: 0x0 to 0xD
Length of random number: 1 Byte
Random number generated by PCD : 8 or 16 bytes. Not required for Sam non X mode.
Random number returned by GetChallenge command : 8 Bytes or 16 Bytes
Key number : 2 bytes
key Version: 2 bytes
[in]bInputLen[In] Length of bytes available in Input buffer.
[out]pDataOut[Out] Returns Rnd number PCD2 in sam non x mode. Nothing in S/W mode.
[out]pOutLen[Out] Length of data returned in pDataOut.

◆ phalMfdf_IsoInternalAuthenticate()

phStatus_t phalMfdf_IsoInternalAuthenticate ( void *  pDataParams,
uint8_t pInput,
uint8_t  bInputLen,
uint8_t pDataOut,
uint8_t pOutLen 
)

Iso Internal Authenticate.

This command is implemented in compliance with ISO/IEC 7816-4.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]pInput[In] Input data should be as mentioned below. Reference to crypto algorigthm - 1 Byte: 00 => context defined, 02 => 2K3DES, 04 => 3k3DES, 09 => AES128
Card master key flag - 1 Byte: 0x00 if card master key, 0x01 otherwise.
Key number on card - 1 Byte: 0x0 to 0xD
Length of random number: 1 Byte
Random number Rpcd2 : 8 Bytes or 16 Bytes.
Key number : 2 bytes
key Version: 2 bytes
[in]bInputLen[In] Length of bytes available in Input buffer.
[out]pDataOut[Out] RRPICC2 || RPCD2 after decryption in S/W mode. Nothing in Sam non x mode.
[out]pOutLen[Out] Length of data available in DataOut buffer.

◆ phalMfdf_IsoAuthenticate()

phStatus_t phalMfdf_IsoAuthenticate ( void *  pDataParams,
uint16_t  wKeyNo,
uint16_t  wKeyVer,
uint8_t  bKeyNoCard,
uint8_t  bIsPICCkey 
)

Perform Iso authentication GetChallenge, External Authenticate & Internal Authenticate of a DESFire PICC.

Internally performs the three pass Iso authentication by calling GetChallenge
External Authenticate
Internal Authenticate
Generates and stores the session key

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]wKeyNo[In] DESFire key number or SAM Key entry number.
[in]wKeyVer[In] Key version.
[in]bKeyNoCard[In] Key number on card. 0x0 to 0xD.
[in]bIsPICCkey[In] Is it PICC Master key ? 1 = YES.