Implementation of SAM commands used for MIFARE DUOX communication in S-Mode. More...

Modules | |
| Defines | |
| Definitions for SAM commands used for MIFARE DUOX communication in S-Mode. | |
Functions | |
| phStatus_t | phhalHw_Sam_Cmd_SAM_MutualAuthEcc_Part1 (phhalHw_Sam_DataParams_t *pDataParams, uint8_t bOption, uint8_t bECCKeyNo_Priv, uint8_t bCertA_FileNo, uint8_t bCertB_Options, uint8_t bECCKeyNo_CA, uint8_t **ppSamResponse, uint16_t *pSamRespLen) |
| The SAM_MutualAuthEcc supports in S-mode the ECC-based Mutual and Reader-Unilateral Authentication as implemented by MIFARE DUOX with the ISOGeneralAuthenticate command. More... | |
| phStatus_t | phhalHw_Sam_Cmd_SAM_MutualAuthEcc_Part2 (phhalHw_Sam_DataParams_t *pDataParams, uint8_t bOption, uint8_t *pPiccErrorCode, uint8_t *pCardResponse, uint8_t bCardRespLen, uint8_t **ppSamResponse, uint16_t *pSamRespLen, uint8_t *pPiccRetCode) |
| Performs second part, SAM receives the ephemeral public key of the MIFARE DUOX, executes the ephemeral key agreement and returns an encrypted message containing its certificate chain and signature. More... | |
| phStatus_t | phhalHw_Sam_Cmd_SAM_MutualAuthEcc_Part3 (phhalHw_Sam_DataParams_t *pDataParams, uint8_t bOption, uint8_t *pPiccErrorCode, uint8_t *pCardResponse, uint16_t wCardRespLen, uint8_t **ppSamResponse, uint16_t *pSamRespLen, uint8_t *pPiccRetCode) |
| Performs second part, the SAM receives the encrypted message from the MIFARE DUOX and, depending on the protocol choice, returns the decrypted OptsB (Reader-Unilateral Authentication) or additionally validates and/or returns the decrypted certificate chain and signature of the MIFARE DUOX. More... | |
| phStatus_t | phhalHw_Sam_Cmd_SAM_UnilatAuthEcc_Part1 (phhalHw_Sam_DataParams_t *pDataParams, uint8_t bOption, uint8_t bECCKeyNo_Priv, uint8_t bECC_CurveNo, uint8_t **ppSamResponse, uint16_t *pSamRespLen) |
| The SAM_UnilatAuthEcc supports in S-mode the ECC-based Card-Unilateral Authentication as implemented by MIFARE DUOX with the ISOInternalAuthenticate or VDE_ECDSASign command. More... | |
| phStatus_t | phhalHw_Sam_Cmd_SAM_UnilatAuthEcc_Part2 (phhalHw_Sam_DataParams_t *pDataParams, uint8_t *pPiccErrorCode, uint8_t *pCardResponse, uint8_t bCardRespLen, uint8_t *pPiccRetCode) |
| Performs second part, the SAM receives the signature of the MIFARE DUOX, and executes the signature validation. More... | |
| phStatus_t | phhalHw_Sam_Cmd_SAM_BindCertificate_Part1 (phhalHw_Sam_DataParams_t *pDataParams, uint8_t bOption, uint8_t *pMKPParams, uint8_t bMKPParamsLen, uint8_t bECCKeyNo_Priv, uint8_t **ppSamResponse, uint16_t *pSamRespLen) |
| The SAM_BindCertificate supports in S-mode a key pair generation on MIFARE DUOX with ManageKeyPair command, followed by a certificate signing by the SAM. More... | |
| phStatus_t | phhalHw_Sam_Cmd_SAM_BindCertificate_Part2 (phhalHw_Sam_DataParams_t *pDataParams, uint8_t bOption, uint8_t *pData, uint16_t wDataLen, uint8_t **ppResponse, uint16_t *pRespLen) |
| The SAM processed the ManageKeyPair response coming from MIFARE DUOX, extracts the public key, injects in the to-be-signed certificate. More... | |
| phStatus_t | phhalHw_Sam_Cmd_SAM_ImportEccKeyDUOX (phhalHw_Sam_DataParams_t *pDataParams, uint8_t bECCKeyNo_Priv, uint8_t *pMKPParams, uint8_t bMKPParamsLen, uint8_t **ppMKPCrypto, uint16_t *pMKPCryptoLen) |
| The SAM_ImportEccKeyDUOX command supports the procedure to import a private ECC key stored on the SAM into the PICC in S-mode. More... | |
Implementation of SAM commands used for MIFARE DUOX communication in S-Mode.
| phStatus_t phhalHw_Sam_Cmd_SAM_MutualAuthEcc_Part1 | ( | phhalHw_Sam_DataParams_t * | pDataParams, |
| uint8_t | bOption, | ||
| uint8_t | bECCKeyNo_Priv, | ||
| uint8_t | bCertA_FileNo, | ||
| uint8_t | bCertB_Options, | ||
| uint8_t | bECCKeyNo_CA, | ||
| uint8_t ** | ppSamResponse, | ||
| uint16_t * | pSamRespLen | ||
| ) |
The SAM_MutualAuthEcc supports in S-mode the ECC-based Mutual and Reader-Unilateral Authentication as implemented by MIFARE DUOX with the ISOGeneralAuthenticate command.
Generates its ephemeral key pair for the ECDH-based key agreement and returns the public key
| PH_ERR_SUCCESS_CHAINING | Operation successful with Chaining response. |
| PH_ERR_INVALID_DATA_PARAMS | pDataParams is NULL. |
| PH_ERR_INVALID_PARAMETER | pSamRespLen is NULL. |
| Other | Depending on implementation and underlaying component. |
| [in] | pDataParams | [In] Pointer to this layer's parameter structure. |
| [in] | bOption | [In] Option to update the P1 information.
|
| [in] | bECCKeyNo_Priv | [In] ECC key entry holding the private key to be used for signing. Will be 0x00 - 0x0F |
| [in] | bCertA_FileNo | [In] The file number of the file holding the Cert.A certificate (chain). Present in command frame only if bOption has one of the following,
|
| [in] | bCertB_Options | [In] Cert.B processing options. One of the following
|
| [in] | bECCKeyNo_CA | [In] ECC key entry holding the public key of the targeted CA Root Key for Cert.B validation. Will be 0x00 - 0x0F. Present in command frame only if bOption has one of the following,
|
| [out] | ppSamResponse | [Out] Ephemeral public key in uncompressed point representation ( 0x04 || E.Pub.A.x || E.Pub.A.y ) |
| [out] | pSamRespLen | [Out] Length of bytes available in ppSamResponse buffer. |
| phStatus_t phhalHw_Sam_Cmd_SAM_MutualAuthEcc_Part2 | ( | phhalHw_Sam_DataParams_t * | pDataParams, |
| uint8_t | bOption, | ||
| uint8_t * | pPiccErrorCode, | ||
| uint8_t * | pCardResponse, | ||
| uint8_t | bCardRespLen, | ||
| uint8_t ** | ppSamResponse, | ||
| uint16_t * | pSamRespLen, | ||
| uint8_t * | pPiccRetCode | ||
| ) |
Performs second part, SAM receives the ephemeral public key of the MIFARE DUOX, executes the ephemeral key agreement and returns an encrypted message containing its certificate chain and signature.
Also the status code of PICC will be returned to the caller in case of error.
| PH_ERR_SUCCESS_CHAINING | Operation successful with Chaining response. |
| PHHAL_HW_SAM_ERR_OK_CHAINING_ACTIVE_DUOX | Correct Execution with Cert.A - final frame. |
| PH_ERR_AUTH_ERROR | Authentication failed: public key validation for E.Pub.B failed. |
| PH_ERR_INVALID_DATA_PARAMS | pDataParams is NULL. |
| PH_ERR_INVALID_PARAMETER | pCardResponse and pSamRespLen are NULL. |
| Other | Depending on implementation and underlaying component. |
| [in] | pDataParams | [In] Pointer to this layer's parameter structure. |
| [in] | bOption | [In] Buffering options.
|
| [in] | pPiccErrorCode | [In] Status code returned by the PICC in case of failure. Should be 2 byte in length with LSB first. |
| [in] | pCardResponse | [In] Ephemeral public key in uncompressed point representation ( 0x04 || E.Pub.B.x || E.Pub. B.y ) |
| [in] | bCardRespLen | [In] Length of bytes available in pCardResponse buffer. |
| [out] | ppSamResponse | [Out] Enciphered Signature and Certificate (Chain, Options)
|
| [out] | pSamRespLen | [Out] Length of bytes available in ppSamResponse buffer. |
| [out] | pPiccRetCode | [Out] Status code from MIFARE DUOX PICC if available else zero. |
| phStatus_t phhalHw_Sam_Cmd_SAM_MutualAuthEcc_Part3 | ( | phhalHw_Sam_DataParams_t * | pDataParams, |
| uint8_t | bOption, | ||
| uint8_t * | pPiccErrorCode, | ||
| uint8_t * | pCardResponse, | ||
| uint16_t | wCardRespLen, | ||
| uint8_t ** | ppSamResponse, | ||
| uint16_t * | pSamRespLen, | ||
| uint8_t * | pPiccRetCode | ||
| ) |
Performs second part, the SAM receives the encrypted message from the MIFARE DUOX and, depending on the protocol choice, returns the decrypted OptsB (Reader-Unilateral Authentication) or additionally validates and/or returns the decrypted certificate chain and signature of the MIFARE DUOX.
Also the status code of PICC will be returned to the caller in case of error.
| PH_ERR_SUCCESS | Operation successful. |
| PH_ERR_SUCCESS_CHAINING | Operation successful with Chaining response. |
| PH_ERR_AUTH_ERROR | Authentication failed |
| PH_ERR_INVALID_DATA_PARAMS | pDataParams is NULL. |
| PH_ERR_INVALID_PARAMETER | pPiccErrorCode, pCardResponse pSamRespLen and pPiccRetCode are NULL. |
| Other | Depending on implementation and underlaying component. |
| [in] | pDataParams | [In] Pointer to this layer's parameter structure. |
| [in] | bOption | [In] Buffering options.
|
| [in] | pPiccErrorCode | [In] Status code returned by the PICC in case of failure. Should be 2 byte in length with LSB first. |
| [in] | pCardResponse | [In] Response from PICC. One of the following
|
| [in] | wCardRespLen | [In] Length of bytes available in pCardResponse buffer. |
| [out] | ppSamResponse | [Out] One of the following,
|
| [out] | pSamRespLen | [Out] Length of bytes available in ppSamResponse buffer. |
| [out] | pPiccRetCode | [Out] Status code from MIFARE DUOX PICC if available else zero. |
| phStatus_t phhalHw_Sam_Cmd_SAM_UnilatAuthEcc_Part1 | ( | phhalHw_Sam_DataParams_t * | pDataParams, |
| uint8_t | bOption, | ||
| uint8_t | bECCKeyNo_Priv, | ||
| uint8_t | bECC_CurveNo, | ||
| uint8_t ** | ppSamResponse, | ||
| uint16_t * | pSamRespLen | ||
| ) |
The SAM_UnilatAuthEcc supports in S-mode the ECC-based Card-Unilateral Authentication as implemented by MIFARE DUOX with the ISOInternalAuthenticate or VDE_ECDSASign command.
In the first part the SAM generates and returns a random challenge. The actual protocol choice is provided to the SAM via the P1 (bOpton) parameter
| PH_ERR_SUCCESS_CHAINING | Operation successful with Chaining response. |
| PH_ERR_INVALID_DATA_PARAMS | pDataParams is NULL. |
| PH_ERR_INVALID_PARAMETER | pSamRespLen is NULL. |
| Other | Depending on implementation and underlaying component. |
| [in] | pDataParams | [In] Pointer to this layer's parameter structure. |
| [in] | bOption | [In] Protocol Option to update the P1 information. |
| [in] | bECCKeyNo_Priv | [In] The key reference number of the ECC key entry to be used for signature verification.
|
| [in] | bECC_CurveNo | [In] The curve reference number of the ECC curve entry to be used for signature verification. Will be 0x00 - 0x03 |
| [out] | ppSamResponse | [Out] Random challenge from SAM |
| [out] | pSamRespLen | [Out] Length of bytes available in ppSamResponse buffer. |
| phStatus_t phhalHw_Sam_Cmd_SAM_UnilatAuthEcc_Part2 | ( | phhalHw_Sam_DataParams_t * | pDataParams, |
| uint8_t * | pPiccErrorCode, | ||
| uint8_t * | pCardResponse, | ||
| uint8_t | bCardRespLen, | ||
| uint8_t * | pPiccRetCode | ||
| ) |
Performs second part, the SAM receives the signature of the MIFARE DUOX, and executes the signature validation.
Also the status code of PICC will be returned to the caller in case of error.
| PH_ERR_SUCCESS | Operation successful. |
| PH_ERR_AUTH_ERROR | Authentication failed: Sig.B verification failed |
| PH_ERR_INVALID_DATA_PARAMS | pDataParams is NULL. |
| PH_ERR_INVALID_PARAMETER | pPiccErrorCode, pCardResponse pSamRespLen and pPiccRetCode are NULL. |
| Other | Depending on implementation and underlaying component. |
| [in] | pDataParams | [In] Pointer to this layer's parameter structure. |
| [in] | pPiccErrorCode | [In] Status code returned by the PICC in case of failure. Should be 2 byte in length with LSB first. |
| [in] | pCardResponse | [In] Response from PICC. One of the following
|
| [in] | bCardRespLen | [In] Length of bytes available in pCardResponse buffer. |
| [out] | pPiccRetCode | [Out] Status code from MIFARE DUOX PICC if available else zero. |
| phStatus_t phhalHw_Sam_Cmd_SAM_BindCertificate_Part1 | ( | phhalHw_Sam_DataParams_t * | pDataParams, |
| uint8_t | bOption, | ||
| uint8_t * | pMKPParams, | ||
| uint8_t | bMKPParamsLen, | ||
| uint8_t | bECCKeyNo_Priv, | ||
| uint8_t ** | ppSamResponse, | ||
| uint16_t * | pSamRespLen | ||
| ) |
The SAM_BindCertificate supports in S-mode a key pair generation on MIFARE DUOX with ManageKeyPair command, followed by a certificate signing by the SAM.
SAM enables the key pair generation by computing the ManageKeyPair secure messaging. This is equivalent to a SAM_Apply_SM execution. MIFARE DUOX may return an error code during the execution of the protocol, the SAM will accept this also in Part2 and Part3. In that case, the certificate binding is interrupted and the PICC error will be echoed with Resp.ISO90DF
| PH_ERR_SUCCESS_CHAINING | Operation successful with Chaining response. |
| PH_ERR_INVALID_DATA_PARAMS | pDataParams is NULL. |
| PH_ERR_INVALID_PARAMETER | pMKPParams and pSamRespLen are NULL. |
| Other | Depending on implementation and underlaying component. |
| [in] | pDataParams | [In] Pointer to this layer's parameter structure. |
| [in] | bOption | [In] Protection mode for ManageKeyPair command towards MIFARE DUOX. |
| [in] | pMKPParams | [In] MIFARE DUOX ManageKeyPair Parameters. One of the following
|
| [in] | bMKPParamsLen | [In] Length of bytes available in pMKPParams buffer. |
| [in] | bECCKeyNo_Priv | [In] ECC key entry holding the private key to be used for certificate signing in Part 2. Will be 0x00 - 0x0F |
| [out] | ppSamResponse | [Out] MKPMAC: 8 bytes as MACt(KsesAuthMAC, Cmd || MKPParams) |
| [out] | pSamRespLen | [Out] Length of bytes available in ppSamResponse buffer. |
| phStatus_t phhalHw_Sam_Cmd_SAM_BindCertificate_Part2 | ( | phhalHw_Sam_DataParams_t * | pDataParams, |
| uint8_t | bOption, | ||
| uint8_t * | pData, | ||
| uint16_t | wDataLen, | ||
| uint8_t ** | ppResponse, | ||
| uint16_t * | pRespLen | ||
| ) |
The SAM processed the ManageKeyPair response coming from MIFARE DUOX, extracts the public key, injects in the to-be-signed certificate.
Then it signs the certificate and returns the signed certificate.
| PH_ERR_SUCCESS | Operation successful. |
| PH_ERR_SUCCESS_CHAINING | Operation successful, chaining ongoing. |
| PH_ERR_INVALID_DATA_PARAMS | pDataParams is NULL. |
| PH_ERR_INVALID_PARAMETER | pMessage and pHashLen are NULL |
| Other | Depending on implementation and underlaying component. |
| [in] | pDataParams | [In] Pointer to this layer's parameter structure. |
| [in] | bOption | [In] Buffering Options:
|
| [in] | pData | [In] Information to be exchanged to SAM.
|
| [in] | wDataLen | [In] Length of bytes available in pData buffer. |
| [out] | ppResponse | [Out] Buffer containing the information received from SAM.
|
| [out] | pRespLen | [Out] Length of bytes available in pResponse buffer. |
| phStatus_t phhalHw_Sam_Cmd_SAM_ImportEccKeyDUOX | ( | phhalHw_Sam_DataParams_t * | pDataParams, |
| uint8_t | bECCKeyNo_Priv, | ||
| uint8_t * | pMKPParams, | ||
| uint8_t | bMKPParamsLen, | ||
| uint8_t ** | ppMKPCrypto, | ||
| uint16_t * | pMKPCryptoLen | ||
| ) |
The SAM_ImportEccKeyDUOX command supports the procedure to import a private ECC key stored on the SAM into the PICC in S-mode.
The command generates and returns the cryptogram to be sent to the PICC. For the ManageKeyPair response received from the PICC, regular secure messaging processing with SAM_Remove_SM can be applied
| PH_ERR_SUCCESS | Operation successful. |
| PH_ERR_INVALID_DATA_PARAMS | pDataParams is NULL. |
| PH_ERR_INVALID_PARAMETER | pMKPParams and pSamRespLen are NULL. |
| Other | Depending on implementation and underlaying component. |
| [in] | pDataParams | [In] Pointer to this layer's parameter structure. |
| [in] | bECCKeyNo_Priv | [In] ECC key entry holding the private key to be imported in MIFARE DUOX. Will be 0x00 - 0x0F |
| [in] | pMKPParams | [In] MIFARE DUOX ManageKeyPair Parameters. One of the following
|
| [in] | bMKPParamsLen | [In] Length of bytes available in pMKPParams buffer. |
| [out] | ppMKPCrypto | [Out] Cryptogram holding key data: E (KSesAuthENC, Private Key) || MACt (Cmd || CmdCtr || TI || MKPParams || E (KSesAuthENC, PrivateKey)) |
| [out] | pMKPCryptoLen | [Out] Length of bytes available in ppMKPCrypto buffer. |