|
hsw-nbt 1.2.0
OPTIGA Authenticate NBT Host Library for C
|
Collection of the NBT operational commands. More...
#include "infineon/nbt-apdu-lib.h"#include "infineon/nbt-apdu.h"#include "infineon/nbt-parse-response.h"Go to the source code of this file.
Data Structures | |
| struct | nbt_file_access_policy_t |
| Store the file access condition for both NFC and I2C (read/write operation) interface with FileID. More... | |
Macros | |
| #define | NBT_AUTHENTICATE_TAG UINT8_C(0x01) |
| Identifier for command authenticate tag. | |
| #define | NBT_APPLET_VERSION UINT8_C(0x02) |
| Identifier for command get data applet version. | |
| #define | NBT_AVAILABLE_MEMORY UINT8_C(0x03) |
| Identifier for command get data available memory. | |
| #define | NBT_CHANGE_PASSWORD UINT8_C(0x04) |
| Identifier for command change password. | |
| #define | NBT_CREATE_PASSWORD UINT8_C(0x05) |
| Identifier for command create password. | |
| #define | NBT_DELETE_PASSWORD UINT8_C(0x06) |
| Identifier for command delete password. | |
| #define | NBT_GET_DATA UINT8_C(0x07) |
| Identifier for command get data. | |
| #define | NBT_GET_FAP_BYTES UINT8_C(0x08) |
| Identifier for command get FAP bytes. | |
| #define | NBT_READ_BINARY UINT8_C(0x09) |
| Identifier for command read binary. | |
| #define | NBT_READ_FAP_WITH_PASSWORD UINT8_C(0x0A) |
| Identifier for command read FAP with password. | |
| #define | NBT_PARSE_FAP_BYTES UINT8_C(0x0B) |
| Identifier for command parse FAP bytes. | |
| #define | NBT_PASS_THROUGH_FETCH_DATA UINT8_C(0x0C) |
| Identifier for command pass-through fetch data. | |
| #define | NBT_PASS_THROUGH_PUT_RESPONSE UINT8_C(0x0D) |
| Identifier for command pass-through put response. | |
| #define | NBT_SELECT_APPLICATION UINT8_C(0x0E) |
| Identifier for command select AID. | |
| #define | NBT_SELECT_FILE_BY_ID UINT8_C(0x0F) |
| Identifier for command select file by ID. | |
| #define | NBT_UNBLOCK_PASSWORD UINT8_C(0x10) |
| Identifier for command unblock password. | |
| #define | NBT_UPDATE_BINARY UINT8_C(0x11) |
| Identifier for command update binary. | |
| #define | NBT_UPDATE_FAP_BYTES_WITH_PASSWORD UINT8_C(0x12) |
| Identifier for command update FAP bytes with password. | |
| #define | NBT_UPDATE_RECURSIVE_BINARY UINT8_C(0x13) |
| Identifier for command recursive update binary. | |
| #define | NBT_FAP_FILE_ID UINT16_C(0xE1AF) |
| FileID of FAP file. | |
| #define | NBT_NDEF_FILE_ID UINT16_C(0xE104) |
| FileID of NDEF file. | |
| #define | NBT_TOTAL_FILE UINT8_C(0x07) |
| Total number of file available in NBT. | |
| #define | NBT_FAP_ACCESS_CONDITION_LENGTH UINT8_C(0x06) |
| Length of access condition, including FileID, NFC read/write and I2C read/write access condition. | |
| #define | NBT_FILE_ID_LENGTH UINT8_C(0x02) |
| length of FileID | |
| #define | NBT_MAX_LE UINT16_C(0x00FF) |
| Constant defines maximum possible LE value. | |
| #define | NBT_MAX_LC UINT16_C(0x00FF) |
| Constant defines maximum possible LC value. | |
| #define | NBT_PASSWORD_ID_MASK UINT8_C(0x1F) |
| Masking for access condition byte with password protected. | |
| #define | NBT_SIZE_OF_FAP_FILE UINT8_C(0x2A) |
| Size of FAP file in bytes. | |
| #define | NBT_RECURSIVE_READ_INIT_OFFSET UINT16_C(0x0000) |
| Constant defines initial offset value for recursive read binary function. | |
| #define | NBT_RECURSIVE_UPDATE_INIT_OFFSET UINT16_C(0x0000) |
| Constant defines initial offset value for recursive update binary function. | |
| #define | NBT_RECURSIVE_READ_INIT_MSG_LEN UINT8_C(0xFF) |
| Constant defines initial LE value for recursive read binary function. | |
Enumerations | |
| enum | nbt_access_condition { NBT_ACCESS_ALWAYS = UINT8_C(0x40) , NBT_ACCESS_NEVER = UINT8_C(0x00) , NBT_ACCESS_PASSWORD_PROTECTED = UINT8_C(0x80) } |
| Enumeration defines the access condition of file access policy. More... | |
| enum | nbt_bit_mask_for_pass_through_status_word { NBT_BIT_MASK_STATE_L4_EXIT = UINT16_C(0x0040) , NBT_BIT_MASK_STATE_L4_ENTRY = UINT16_C(0x0020) , NBT_BIT_MASK_STATE_FIELD_EXIT = UINT16_C(0x0010) , NBT_BIT_MASK_STATE_FIELD_ENTRY , NBT_BIT_MASK_PASS_THROUGH_APDU_AVAILABLE , NBT_BIT_MASK_LAYER_4_ACTIVE , NBT_BIT_MASK_NFC_FIELD_IS_PRESENT = } |
| Enumeration provides the bit masks to verify the status of pass-though status words. More... | |
Functions | |
| ifx_status_t | nbt_select_application (nbt_cmd_t *self) |
| Selects the NBT application. | |
| ifx_status_t | nbt_select_file (nbt_cmd_t *self, uint16_t file_id) |
| Selects the elementary file (EF) with the FileID. | |
| ifx_status_t | nbt_select_file_with_password (nbt_cmd_t *self, uint16_t file_id, const ifx_blob_t *read_password, const ifx_blob_t *write_password) |
| Selects the elementary file with FileID and read or write password. Note that the status word of the command is not checked by this API. | |
| ifx_status_t | nbt_read_binary (nbt_cmd_t *self, uint16_t offset, uint8_t binary_data_length) |
| Reads the binary data from the currently selected elementary file. | |
| ifx_status_t | nbt_update_binary (nbt_cmd_t *self, uint16_t offset, uint32_t data_length, const uint8_t *data) |
| Updates the binary data into the currently selected elementary file. | |
| ifx_status_t | nbt_change_password (nbt_cmd_t *self, uint8_t pwd_id, const ifx_blob_t *master_password, const ifx_blob_t *new_password) |
| Changes an existing password with a new password. If the FAP file update operation is password protected, the master password is required to change the password. | |
| ifx_status_t | nbt_unblock_password (nbt_cmd_t *self, uint8_t pwd_id, const ifx_blob_t *master_password) |
| Unblocks the password, which is in blocked state because wrong password limit exceeds. | |
| ifx_status_t | nbt_authenticate_tag (nbt_cmd_t *self, const ifx_blob_t *challenge) |
| Issues an authenticate tag command, which generates the signature on the challenge and can be used for brand protection use case in offline mode. | |
| ifx_status_t | nbt_create_password (nbt_cmd_t *self, const ifx_blob_t *master_password, uint8_t new_password_id, const ifx_blob_t *new_password, uint16_t pwd_resp, uint16_t pwd_limit) |
| Creates a new password. If create password command is password-protected then the password to authenticate will be passed in the command data as master password. | |
| ifx_status_t | nbt_delete_password (nbt_cmd_t *self, const ifx_blob_t *master_password, uint8_t password_id) |
| Deletes an existing password, when the FAP file update operation is allowed with ALWAYS access condition, then no need to authenticate with the master password. | |
| ifx_status_t | nbt_get_data (nbt_cmd_t *self, uint16_t get_data_rcp) |
| Issues a get data command to retrieve the NBT application specific information like applet version and available memory. GET_DATA constants that can be passed with an example: get data (TAG_AVAILABLE_MEMORY, TAG_APPLET_VERSION) | |
| ifx_status_t | nbt_get_data_applet_version (nbt_cmd_t *self, nbt_applet_version_t *applet_version) |
| Issues a get data command to retrieve the applet version information. | |
| ifx_status_t | nbt_get_data_available_memory (nbt_cmd_t *self, nbt_available_memory_t *available_memory) |
| Issues a get data command to retrieve the available memory. | |
| uint8_t | nbt_access_condition_get (nbt_access_condition access_type, const uint8_t *password_id) |
| Get the access condition policy byte for NFC read/write and I2C read/write interface password ID as NULL, if nbt_access_condition is ALWAYS and NEVER, otherwise pass valid password ID (0x01 - 0x1F) with nbt_access_condition PASSWORD_PROTECTED. | |
| ifx_status_t | nbt_update_fap (nbt_cmd_t *self, const nbt_file_access_policy_t *fap_policy) |
| Updates file access conditions in FAP file, if FAP file is update always (not password protected). | |
| ifx_status_t | nbt_update_fap_with_password (nbt_cmd_t *self, const nbt_file_access_policy_t *fap_policy, const ifx_blob_t *master_password) |
| Updates file access conditions in FAP file. when FAP file is password protected(optional). If FAP file is not password protected, then no need to authenticate with the master password, pass the master password as NULL. | |
| ifx_status_t | nbt_update_fap_bytes (nbt_cmd_t *self, const ifx_blob_t *policy_bytes) |
| Updates file access conditions in FAP file from policy bytes, if FAP file is update always (not password protected). | |
| ifx_status_t | nbt_update_fap_bytes_with_password (nbt_cmd_t *self, const ifx_blob_t *policy_bytes, const ifx_blob_t *master_password) |
| Updates file access conditions in FAP file from policy bytes. When FAP file is password protected (optional). If FAP file is not password protected, then no need to authenticate with the master password, pass the master password as NULL. | |
| ifx_status_t | nbt_parse_fap_bytes (const ifx_blob_t *fap_bytes, uint8_t no_of_fap_policies, nbt_file_access_policy_t *fap_policies) |
| Parse response (APDU response type) bytes to array of nbt_file_access_policy_t type object of FAP file. | |
| ifx_status_t | nbt_read_fap (nbt_cmd_t *self, nbt_file_access_policy_t *fap_policies) |
| Reads binary data (fap bytes of elementary files) from FAP file and store the fap bytes into nbt_file_access_policy_t type object array. | |
| ifx_status_t | nbt_read_fap_with_password (nbt_cmd_t *self, const ifx_blob_t *master_password, nbt_file_access_policy_t *fap_policies) |
| Reads binary data (access condition policy bytes of elementary files) from FAP file and store the fap bytes into nbt_file_access_policy_t type object array. If FAP file is not password protected, then no need to authenticate with the master password, pass the master password as NULL. | |
| ifx_status_t | nbt_read_fap_bytes (nbt_cmd_t *self) |
| Reads binary data (fap bytes of elementary files) from FAP file. | |
| ifx_status_t | nbt_read_fap_bytes_with_password (nbt_cmd_t *self, const ifx_blob_t *master_password) |
| Reads binary data (fap bytes of elementary files) from FAP file. If FAP file is not password protected, then no need to authenticate with the master password, pass the master password as NULL. | |
| ifx_status_t | nbt_pass_through_fetch_data (nbt_cmd_t *self, ifx_apdu_response_t *response) |
| Issues a pass-through fetch data APDU command. This command can be issued from host devices through I2C interfaces. | |
| ifx_status_t | nbt_pass_through_decode_sw (const ifx_apdu_response_t *response, uint16_t *pass_through_status_word) |
| Gets the pass-through status word from the response of pass_through_fetch_data() command. | |
| ifx_status_t | nbt_pass_through_decode_apdu_bytes (const ifx_apdu_response_t *response, ifx_blob_t *nfc_apdu) |
| Gets the pass-through NFC APDU in byte array from the response of pass_through_fetch_data() command. | |
| ifx_status_t | nbt_pass_through_decode_apdu (const ifx_apdu_response_t *response, ifx_apdu_t *nfc_apdu) |
| Gets the pass-through NFC APDU in APDU format from the response of pass_through_fetch_data() command. | |
| ifx_status_t | nbt_pass_through_put_response (nbt_cmd_t *self, const ifx_apdu_response_t *pass_through_response_data, ifx_apdu_response_t *response) |
| Sends the response to pass-through fetch data command, forwarding the response over the NFC interface. | |
| ifx_status_t | nbt_ndef_read_with_id_password (nbt_cmd_t *self, uint16_t file_id, const ifx_blob_t *read_password) |
| Reads NDEF file with password and return the NDEF message byte data. Method performs the select file with password if available and then read binary until data is available in file. | |
| ifx_status_t | nbt_ndef_read_with_id (nbt_cmd_t *self, uint16_t file_id) |
| Reads NDEF file and return the NDEF message byte data. Method performs the select file and then read binary until data is available in file. | |
| ifx_status_t | nbt_ndef_read_with_password (nbt_cmd_t *self, const ifx_blob_t *read_password) |
| Reads NDEF file with password and returns the NDEF message byte data. Method performs the select file with default NDEF FileID (E104) and with optional password and then read binary until data is available in file. | |
| ifx_status_t | nbt_ndef_read (nbt_cmd_t *self) |
| Reads NDEF file with password and returns the NDEF message byte data. Method performs the select file with default NDEF FileID (E104) and then read binary until data is available in file. | |
| ifx_status_t | nbt_ndef_update_with_id_password (nbt_cmd_t *self, uint16_t file_id, const ifx_blob_t *write_password, ifx_blob_t *ndef_bytes) |
| Updates NDEF file with FileID, 4-byte password (Optional). Method performs the select file with file_id and then update binary until data is available. | |
| ifx_status_t | nbt_ndef_update_with_id (nbt_cmd_t *self, uint16_t file_id, ifx_blob_t *ndef_bytes) |
| Updates the NDEF file with FileID. Method performs the select file with file_id and then update binary until data is available. | |
| ifx_status_t | nbt_ndef_update_with_password (nbt_cmd_t *self, const ifx_blob_t *write_password, ifx_blob_t *ndef_bytes) |
| Updates NDEF file with 4-byte password (Optional) and default NDEF file Id (E104). Method performs the select file with file_id and then update binary until data is available. | |
| ifx_status_t | nbt_ndef_update (nbt_cmd_t *self, ifx_blob_t *ndef_bytes) |
| Updates NDEF file default ndef FileID (E104), Method performs the select file with file_id and then update binary until data is available. | |
Collection of the NBT operational commands.
Definition in file nbt-cmd.h.
| #define NBT_APPLET_VERSION UINT8_C(0x02) |
| #define NBT_AUTHENTICATE_TAG UINT8_C(0x01) |
| #define NBT_AVAILABLE_MEMORY UINT8_C(0x03) |
| #define NBT_CHANGE_PASSWORD UINT8_C(0x04) |
| #define NBT_CREATE_PASSWORD UINT8_C(0x05) |
| #define NBT_DELETE_PASSWORD UINT8_C(0x06) |
| #define NBT_FAP_ACCESS_CONDITION_LENGTH UINT8_C(0x06) |
| #define NBT_FAP_FILE_ID UINT16_C(0xE1AF) |
| #define NBT_GET_DATA UINT8_C(0x07) |
| #define NBT_GET_FAP_BYTES UINT8_C(0x08) |
| #define NBT_MAX_LC UINT16_C(0x00FF) |
| #define NBT_MAX_LE UINT16_C(0x00FF) |
| #define NBT_NDEF_FILE_ID UINT16_C(0xE104) |
| #define NBT_PARSE_FAP_BYTES UINT8_C(0x0B) |
| #define NBT_PASS_THROUGH_FETCH_DATA UINT8_C(0x0C) |
| #define NBT_PASS_THROUGH_PUT_RESPONSE UINT8_C(0x0D) |
| #define NBT_PASSWORD_ID_MASK UINT8_C(0x1F) |
| #define NBT_READ_BINARY UINT8_C(0x09) |
| #define NBT_READ_FAP_WITH_PASSWORD UINT8_C(0x0A) |
| #define NBT_RECURSIVE_READ_INIT_MSG_LEN UINT8_C(0xFF) |
| #define NBT_RECURSIVE_READ_INIT_OFFSET UINT16_C(0x0000) |
| #define NBT_RECURSIVE_UPDATE_INIT_OFFSET UINT16_C(0x0000) |
| #define NBT_SELECT_APPLICATION UINT8_C(0x0E) |
| #define NBT_SELECT_FILE_BY_ID UINT8_C(0x0F) |
| #define NBT_SIZE_OF_FAP_FILE UINT8_C(0x2A) |
| #define NBT_TOTAL_FILE UINT8_C(0x07) |
| #define NBT_UNBLOCK_PASSWORD UINT8_C(0x10) |
| #define NBT_UPDATE_BINARY UINT8_C(0x11) |
| #define NBT_UPDATE_FAP_BYTES_WITH_PASSWORD UINT8_C(0x12) |
| #define NBT_UPDATE_RECURSIVE_BINARY UINT8_C(0x13) |
| enum nbt_access_condition |
Enumeration defines the access condition of file access policy.
Definition at line 219 of file nbt-cmd.h.
Enumeration provides the bit masks to verify the status of pass-though status words.
Definition at line 247 of file nbt-cmd.h.
| uint8_t nbt_access_condition_get | ( | nbt_access_condition | access_type, |
| const uint8_t * | password_id ) |
Get the access condition policy byte for NFC read/write and I2C read/write interface password ID as NULL, if nbt_access_condition is ALWAYS and NEVER, otherwise pass valid password ID (0x01 - 0x1F) with nbt_access_condition PASSWORD_PROTECTED.
| access_type | Access_condition type object (ALWAYS, NEVER_ACCESS and PASSWORD_PROTECTED) |
| password_id | Pointer to store password ID |
| ifx_status_t nbt_authenticate_tag | ( | nbt_cmd_t * | self, |
| const ifx_blob_t * | challenge ) |
Issues an authenticate tag command, which generates the signature on the challenge and can be used for brand protection use case in offline mode.
| [in,out] | self | Command set with communication protocol and response. |
| [in] | challenge | Instance holds challenge data. |
| IFX_SUCCESS | : If API operation is successful |
| IFX_ILLEGAL_ARGUMENT | : If invalid/NULL parameter is passed to function |
| IFX_OUT_OF_MEMORY | : If memory allocation fails |
| ifx_status_t nbt_change_password | ( | nbt_cmd_t * | self, |
| uint8_t | pwd_id, | ||
| const ifx_blob_t * | master_password, | ||
| const ifx_blob_t * | new_password ) |
Changes an existing password with a new password. If the FAP file update operation is password protected, the master password is required to change the password.
| [in,out] | self | Command set with communication protocol and response. |
| [in] | pwd_id | 5-bit password ID (Between 01 to 1F). |
| [in] | master_password | Master password for verification. Required if this password is used with password-protected access condition (Optional). |
| [in] | new_password | New password to be changed. |
| IFX_SUCCESS | : If API operation is successful |
| IFX_ILLEGAL_ARGUMENT | : If invalid/NULL parameter is passed to function |
| IFX_OUT_OF_MEMORY | : If memory allocation fails |
| ifx_status_t nbt_create_password | ( | nbt_cmd_t * | self, |
| const ifx_blob_t * | master_password, | ||
| uint8_t | new_password_id, | ||
| const ifx_blob_t * | new_password, | ||
| uint16_t | pwd_resp, | ||
| uint16_t | pwd_limit ) |
Creates a new password. If create password command is password-protected then the password to authenticate will be passed in the command data as master password.
| [in,out] | self | Command set with communication protocol and response. |
| [in] | master_password | Master password for verification. Required if this password is already used with password-protected access condition (Optional). |
| [in] | new_password_id | 5-bits password ID (Between 01 to 1F). |
| [in] | new_password | Password value to be updated. |
| [in] | pwd_resp | 2-bytes success response, which will be sent on successful password verification. |
| [in] | pwd_limit | 2-bytes password retry limit (Between 0001 to 007F). if limit set to FFFF, applet will treat this as an infinite try limit. |
| IFX_SUCCESS | : If API operation is successful |
| IFX_ILLEGAL_ARGUMENT | : If invalid/NULL parameter is passed to function |
| IFX_OUT_OF_MEMORY | : If memory allocation fails |
| ifx_status_t nbt_delete_password | ( | nbt_cmd_t * | self, |
| const ifx_blob_t * | master_password, | ||
| uint8_t | password_id ) |
Deletes an existing password, when the FAP file update operation is allowed with ALWAYS access condition, then no need to authenticate with the master password.
| [in,out] | self | Command set with communication protocol and response. |
| [in] | master_password | Master password for verification. Required if this password is already used with password-protected access condition (Optional). |
| [in] | password_id | Offset value for p2 is 5-bit password ID (Between 01 to 1F). |
| IFX_SUCCESS | : If API operation is successful |
| IFX_ILLEGAL_ARGUMENT | : If invalid/NULL parameter is passed to function |
| IFX_OUT_OF_MEMORY | : If memory allocation fails |
| ifx_status_t nbt_get_data | ( | nbt_cmd_t * | self, |
| uint16_t | get_data_rcp ) |
Issues a get data command to retrieve the NBT application specific information like applet version and available memory. GET_DATA constants that can be passed with an example: get data (TAG_AVAILABLE_MEMORY, TAG_APPLET_VERSION)
| [in,out] | self | Command set with communication protocol and response. |
| [in] | get_data_rcp | get data reference control parameters. |
| IFX_SUCCESS | : If API operation is successful |
| IFX_ILLEGAL_ARGUMENT | : If invalid/NULL parameter is passed to function |
| IFX_OUT_OF_MEMORY | : If memory allocation fails |
| ifx_status_t nbt_get_data_applet_version | ( | nbt_cmd_t * | self, |
| nbt_applet_version_t * | applet_version ) |
Issues a get data command to retrieve the applet version information.
| [in,out] | self | Command set with communication protocol and response. |
| [out] | applet_version | Buffer to store applet version. |
| IFX_SUCCESS | : If API operation is successful |
| IFX_ILLEGAL_ARGUMENT | : If invalid/NULL parameter is passed to function |
| IFX_OUT_OF_MEMORY | : If memory allocation fails |
| ifx_status_t nbt_get_data_available_memory | ( | nbt_cmd_t * | self, |
| nbt_available_memory_t * | available_memory ) |
Issues a get data command to retrieve the available memory.
| [in,out] | self | Command set with communication protocol and response. |
| [out] | available_memory | Buffer to store available memory. |
| IFX_SUCCESS | : If API operation is successful |
| IFX_ILLEGAL_ARGUMENT | : If invalid/NULL parameter is passed to function |
| IFX_OUT_OF_MEMORY | : If memory allocation fails |
| ifx_status_t nbt_ndef_read | ( | nbt_cmd_t * | self | ) |
Reads NDEF file with password and returns the NDEF message byte data. Method performs the select file with default NDEF FileID (E104) and then read binary until data is available in file.
Note: Application must be selected already with selectApplication() API before use this API
Note: application must be selected already with selectApplication() API before use this API
| [in,out] | self | Command set with communication protocol and response. |
| IFX_SUCCESS | : If API operation is successful |
| IFX_ILLEGAL_ARGUMENT | : If invalid/NULL parameter is passed to function |
| IFX_OUT_OF_MEMORY | : If memory allocation fails |
| ifx_status_t nbt_ndef_read_with_id | ( | nbt_cmd_t * | self, |
| uint16_t | file_id ) |
Reads NDEF file and return the NDEF message byte data. Method performs the select file and then read binary until data is available in file.
Note: Application must be selected already with selectApplication() API before use this API.
| [in,out] | self | Command set with communication protocol and response. |
| [in] | file_id | FileID to select an EF file. |
| IFX_SUCCESS | : If API operation is successful |
| IFX_ILLEGAL_ARGUMENT | : If invalid/NULL parameter is passed to function |
| IFX_OUT_OF_MEMORY | : If memory allocation fails |
| ifx_status_t nbt_ndef_read_with_id_password | ( | nbt_cmd_t * | self, |
| uint16_t | file_id, | ||
| const ifx_blob_t * | read_password ) |
Reads NDEF file with password and return the NDEF message byte data. Method performs the select file with password if available and then read binary until data is available in file.
Note: Application must be selected already with selectApplication() API before use this API.
| [in,out] | self | Command set with communication protocol and response. |
| [in] | file_id | FileID to select an NDEF file. |
| [in] | read_password | 4-byte password for read operation (Optional- Null if not required). |
| IFX_SUCCESS | : If API operation is successful |
| IFX_ILLEGAL_ARGUMENT | : If invalid/NULL parameter is passed to function |
| IFX_OUT_OF_MEMORY | : If memory allocation fails |
| ifx_status_t nbt_ndef_read_with_password | ( | nbt_cmd_t * | self, |
| const ifx_blob_t * | read_password ) |
Reads NDEF file with password and returns the NDEF message byte data. Method performs the select file with default NDEF FileID (E104) and with optional password and then read binary until data is available in file.
Note: Application must be selected already with selectApplication() API before use this API.
| [in,out] | self | Command set with communication protocol and response. |
| [in] | read_password | 4-byte password for read operation (Optional- Null if not required). |
| IFX_SUCCESS | : If API operation is successful |
| IFX_ILLEGAL_ARGUMENT | : If invalid/NULL parameter is passed to function |
| IFX_OUT_OF_MEMORY | : If memory allocation fails |
| ifx_status_t nbt_ndef_update | ( | nbt_cmd_t * | self, |
| ifx_blob_t * | ndef_bytes ) |
Updates NDEF file default ndef FileID (E104), Method performs the select file with file_id and then update binary until data is available.
| [in,out] | self | Command set with communication protocol and response. |
| [in] | ndef_bytes | NDEF message to be updated |
| IFX_SUCCESS | : If API operation is successful |
| IFX_ILLEGAL_ARGUMENT | : If invalid/NULL parameter is passed to function |
| IFX_OUT_OF_MEMORY | : If memory allocation fails |
| ifx_status_t nbt_ndef_update_with_id | ( | nbt_cmd_t * | self, |
| uint16_t | file_id, | ||
| ifx_blob_t * | ndef_bytes ) |
Updates the NDEF file with FileID. Method performs the select file with file_id and then update binary until data is available.
Note: application must be selected already with selectApplication() API before use this API
| [in,out] | self | Command set with communication protocol and response. |
| [in] | file_id | FileID to select an EF file. |
| [in] | ndef_bytes | NDEF message to be updated |
| IFX_SUCCESS | : If API operation is successful |
| IFX_ILLEGAL_ARGUMENT | : If invalid/NULL parameter is passed to function |
| IFX_OUT_OF_MEMORY | : If memory allocation fails |
| ifx_status_t nbt_ndef_update_with_id_password | ( | nbt_cmd_t * | self, |
| uint16_t | file_id, | ||
| const ifx_blob_t * | write_password, | ||
| ifx_blob_t * | ndef_bytes ) |
Updates NDEF file with FileID, 4-byte password (Optional). Method performs the select file with file_id and then update binary until data is available.
Note: Application must be selected already with selectApplication() API before use this API
| [in,out] | self | Command set with communication protocol and response. |
| [in] | file_id | FileID to select an EF file. |
| [in] | write_password | 4-byte password for write operation (Optional- Null if not required) |
| [in] | ndef_bytes | Data to be write |
| IFX_SUCCESS | : If API operation is successful |
| IFX_ILLEGAL_ARGUMENT | : If invalid/NULL parameter is passed to function |
| IFX_OUT_OF_MEMORY | : If memory allocation fails |
| ifx_status_t nbt_ndef_update_with_password | ( | nbt_cmd_t * | self, |
| const ifx_blob_t * | write_password, | ||
| ifx_blob_t * | ndef_bytes ) |
Updates NDEF file with 4-byte password (Optional) and default NDEF file Id (E104). Method performs the select file with file_id and then update binary until data is available.
Note: Application must be selected already with selectApplication() API before use this API.
| [in,out] | self | Command set with communication protocol and response. |
| [in] | write_password | 4-byte password for write operation (Optional- Null if not required) |
| [in] | ndef_bytes | NDEF message to be updated |
| IFX_SUCCESS | : If API operation is successful |
| IFX_ILLEGAL_ARGUMENT | : If invalid/NULL parameter is passed to function |
| IFX_OUT_OF_MEMORY | : If memory allocation fails |
| ifx_status_t nbt_parse_fap_bytes | ( | const ifx_blob_t * | fap_bytes, |
| uint8_t | no_of_fap_policies, | ||
| nbt_file_access_policy_t * | fap_policies ) |
Parse response (APDU response type) bytes to array of nbt_file_access_policy_t type object of FAP file.
| [in] | fap_bytes | Pointer to ifx_blob_t handler to store fap bytes Format of FAP:<FileID (2B)> <Config byte for I2C read(1B)> <Config byte for I2C write(1B)> <Config byte for NFC read(1B)> <Config byte for NFC write(1B)> |
| [in] | no_of_fap_policies | Number of fap policies (nbt_file_access_policy_t object type) that's to be parsed. Make sure memory should be allocated for nbt_file_access_policy_t object (0x00 < no_of_fap_policies <= NBT_TOTAL_FILE(7)) |
| [out] | fap_policies | Pointer to nbt_file_access_policy_t handler to store store fap file access conditions for I2C and NFC interface along with FileID. |
| IFX_SUCCESS | : If successful |
| IFX_ILLEGAL_ARGUMENT | : If function parameter is NULL or no_of_fap_policies is zero |
| NBT_FAP_PARSE_ERROR | : If expected(NBT_FAP_ACCESS_CONDITION_LENGTH(6 bytes))fap bytes is not available |
| ifx_status_t nbt_pass_through_decode_apdu | ( | const ifx_apdu_response_t * | response, |
| ifx_apdu_t * | nfc_apdu ) |
Gets the pass-through NFC APDU in APDU format from the response of pass_through_fetch_data() command.
| [in] | response | APDU response of pass_through_fetch_data() command |
| [out] | nfc_apdu | NFC APDU data in APDU format |
| IFX_SUCCESS | : If pass-through NFC APDU data is retrieved successfully |
| INVALID_ARGUMENT | : If input argument is invalid that is NULL input parameter |
| NFC_APDU_IS_NOT_AVAILABLE | : If response does not contain NFC APDU data IFX_OUT_OF_MEMORY if memory allocation fails |
| ifx_status_t nbt_pass_through_decode_apdu_bytes | ( | const ifx_apdu_response_t * | response, |
| ifx_blob_t * | nfc_apdu ) |
Gets the pass-through NFC APDU in byte array from the response of pass_through_fetch_data() command.
| [in] | response | APDU response of pass_through_fetch_data() command |
| [out] | nfc_apdu | NFC APDU data in byte array |
| IFX_SUCCESS | : If API operation is successful |
| IFX_ILLEGAL_ARGUMENT | : If invalid/NULL parameter is passed to function |
| IFX_OUT_OF_MEMORY | : If memory allocation fails |
| ifx_status_t nbt_pass_through_decode_sw | ( | const ifx_apdu_response_t * | response, |
| uint16_t * | pass_through_status_word ) |
Gets the pass-through status word from the response of pass_through_fetch_data() command.
| [in] | response | APDU response of pass_through_fetch_data() command |
| [out] | pass_through_status_word | pass-through status word - this status word can be further decoded using nbt_bit_mask_for_pass_through_status_word enumeration |
| IFX_SUCCESS | : If pass-through status word is retrieved successfully |
| INVALID_ARGUMENT | : If input argument is invalid that is NULL input parameter |
| ifx_status_t nbt_pass_through_fetch_data | ( | nbt_cmd_t * | self, |
| ifx_apdu_response_t * | response ) |
Issues a pass-through fetch data APDU command. This command can be issued from host devices through I2C interfaces.
This command can be used in NFC-I2C pass-through communication mode to fetch the NFC interface-specific status information concatenated with the NFC received APDU over the I2C interface. When the NFC-I2C pass-through communication mode is not active or the NFC APDU is received only the NFC interface-specific status information is returned. This command is limited to the I2C communication interface.
| [in,out] | self | Command set with communication protocol. |
| [out] | response | Buffer to store response data |
| IFX_SUCCESS | : If API operation is successful |
| IFX_ILLEGAL_ARGUMENT | : If invalid/NULL parameter is passed to function |
| IFX_OUT_OF_MEMORY | : If memory allocation fails |
| ifx_status_t nbt_pass_through_put_response | ( | nbt_cmd_t * | self, |
| const ifx_apdu_response_t * | pass_through_response_data, | ||
| ifx_apdu_response_t * | response ) |
Sends the response to pass-through fetch data command, forwarding the response over the NFC interface.
The Pass-through put response APDU has a proprietary format. The data section of pass_through_response_data must include the response to be forwarded over the NFC communication, including the status word SW1 and SW2. The Data field must contain at least the status word (2 bytes) meant to be sent over the NFC interface.
| [in] | self | Command set with communication protocol. |
| [in] | pass_through_response_data | Response to PT fetch command,including SW |
| [out] | response | Buffer to store response data |
| IFX_SUCCESS | : If API operation is successful |
| IFX_ILLEGAL_ARGUMENT | : If invalid/NULL parameter is passed to function |
| IFX_OUT_OF_MEMORY | : If memory allocation fails |
| ifx_status_t nbt_read_binary | ( | nbt_cmd_t * | self, |
| uint16_t | offset, | ||
| uint8_t | binary_data_length ) |
Reads the binary data from the currently selected elementary file.
| [in,out] | self | Command set with communication protocol and response. |
| [in] | offset | Offset to read data from file |
| [in] | binary_data_length | Data length to be read from file. |
| IFX_SUCCESS | : If API operation is successful |
| IFX_ILLEGAL_ARGUMENT | : If invalid/NULL parameter is passed to function |
| IFX_OUT_OF_MEMORY | : If memory allocation fails |
| ifx_status_t nbt_read_fap | ( | nbt_cmd_t * | self, |
| nbt_file_access_policy_t * | fap_policies ) |
Reads binary data (fap bytes of elementary files) from FAP file and store the fap bytes into nbt_file_access_policy_t type object array.
| [in,out] | self | Command set with communication protocol and response. |
| [out] | fap_policies | Pointer to nbt_file_access_policy_t handler to store fap file access conditions for I2C and NFC interface |
| IFX_SUCCESS | : If API operation is successful |
| IFX_ILLEGAL_ARGUMENT | : If invalid/NULL parameter is passed to function |
| IFX_OUT_OF_MEMORY | : If memory allocation fails |
| ifx_status_t nbt_read_fap_bytes | ( | nbt_cmd_t * | self | ) |
Reads binary data (fap bytes of elementary files) from FAP file.
| [in,out] | self | Command set with communication protocol and response. |
| IFX_SUCCESS | : If API operation is successful |
| IFX_ILLEGAL_ARGUMENT | : If invalid/NULL parameter is passed to function |
| IFX_OUT_OF_MEMORY | : If memory allocation fails |
| ifx_status_t nbt_read_fap_bytes_with_password | ( | nbt_cmd_t * | self, |
| const ifx_blob_t * | master_password ) |
Reads binary data (fap bytes of elementary files) from FAP file. If FAP file is not password protected, then no need to authenticate with the master password, pass the master password as NULL.
| [in,out] | self | Command set with communication protocol and response. |
| [in] | master_password | Pointer to ifx_blob_t handler to store FAP file write write password(4 bytes), if FAP file write operation is password protected(optional). |
| IFX_SUCCESS | : If API operation is successful |
| IFX_ILLEGAL_ARGUMENT | : If invalid/NULL parameter is passed to function |
| IFX_OUT_OF_MEMORY | : If memory allocation fails |
| ifx_status_t nbt_read_fap_with_password | ( | nbt_cmd_t * | self, |
| const ifx_blob_t * | master_password, | ||
| nbt_file_access_policy_t * | fap_policies ) |
Reads binary data (access condition policy bytes of elementary files) from FAP file and store the fap bytes into nbt_file_access_policy_t type object array. If FAP file is not password protected, then no need to authenticate with the master password, pass the master password as NULL.
| [in,out] | self | Command set with communication protocol and response. |
| [in] | master_password | Pointer to ifx_blob_t handler to store FAP file write write password(4 bytes), if FAP file write operation is password protected(optional) |
| [out] | fap_policies | Pointer to nbt_file_access_policy_t handler to store fap file access conditions for I2C and NFC interface |
| IFX_SUCCESS | : If API operation is successful |
| IFX_OUT_OF_MEMORY | : If memory allocation fails |
| ifx_status_t nbt_select_application | ( | nbt_cmd_t * | self | ) |
Selects the NBT application.
| [in,out] | self | Command set with communication protocol and response. |
| IFX_SUCCESS | : If API operation is successful |
| IFX_ILLEGAL_ARGUMENT | : If invalid/NULL parameter is passed to function |
| IFX_OUT_OF_MEMORY | : If memory allocation fails |
| ifx_status_t nbt_select_file | ( | nbt_cmd_t * | self, |
| uint16_t | file_id ) |
Selects the elementary file (EF) with the FileID.
| [in,out] | self | Command set with communication protocol and response. |
| [in] | file_id | FileID to select an EF file. |
| IFX_SUCCESS | : If API operation is successful |
| IFX_ILLEGAL_ARGUMENT | : If invalid/NULL parameter is passed to function |
| IFX_OUT_OF_MEMORY | : If memory allocation fails |
| ifx_status_t nbt_select_file_with_password | ( | nbt_cmd_t * | self, |
| uint16_t | file_id, | ||
| const ifx_blob_t * | read_password, | ||
| const ifx_blob_t * | write_password ) |
Selects the elementary file with FileID and read or write password. Note that the status word of the command is not checked by this API.
| [in,out] | self | Command set with communication protocol and response. |
| [in] | file_id | FileID to select an EF file. |
| [in] | read_password | Blob_t 4-byte password for read operation (Optional) |
| [in] | write_password | Blob_t 4-byte password for write operation (Optional) |
| IFX_SUCCESS | : If API operation is successful |
| IFX_ILLEGAL_ARGUMENT | : If invalid/NULL parameter is passed to function |
| IFX_OUT_OF_MEMORY | : If memory allocation fails |
| ifx_status_t nbt_unblock_password | ( | nbt_cmd_t * | self, |
| uint8_t | pwd_id, | ||
| const ifx_blob_t * | master_password ) |
Unblocks the password, which is in blocked state because wrong password limit exceeds.
| [in,out] | self | Command set with communication protocol and response. |
| [in] | pwd_id | 5-bit password ID (Between 01 to 1F). |
| [in] | master_password | Master password for verification. Required if this password is used with password-protected access condition (Optional). |
| IFX_SUCCESS | : If API operation is successful |
| IFX_ILLEGAL_ARGUMENT | : If invalid/NULL parameter is passed to function |
| IFX_OUT_OF_MEMORY | : If memory allocation fails |
| ifx_status_t nbt_update_binary | ( | nbt_cmd_t * | self, |
| uint16_t | offset, | ||
| uint32_t | data_length, | ||
| const uint8_t * | data ) |
Updates the binary data into the currently selected elementary file.
| [in,out] | self | Command set with communication protocol and response. |
| [in] | offset | Offset from where data to be updated in file. |
| [in] | data_length | Length of the data to be updated in the file. |
| [in] | data | Pointer to the data to be updated in the file. |
| IFX_SUCCESS | : If API operation is successful |
| IFX_ILLEGAL_ARGUMENT | : If invalid/NULL parameter is passed to function |
| IFX_OUT_OF_MEMORY | : If memory allocation fails |
| ifx_status_t nbt_update_fap | ( | nbt_cmd_t * | self, |
| const nbt_file_access_policy_t * | fap_policy ) |
Updates file access conditions in FAP file, if FAP file is update always (not password protected).
| [in,out] | self | Command set with communication protocol and response. |
| [in] | fap_policy | Pointer to nbt_file_access_policy_t handler to store FAP file access conditions for I2C and NGC interface. |
| IFX_SUCCESS | : If API operation is successful |
| IFX_ILLEGAL_ARGUMENT | : If invalid/NULL parameter is passed to function |
| IFX_OUT_OF_MEMORY | : If memory allocation fails |
| ifx_status_t nbt_update_fap_bytes | ( | nbt_cmd_t * | self, |
| const ifx_blob_t * | policy_bytes ) |
Updates file access conditions in FAP file from policy bytes, if FAP file is update always (not password protected).
| [in,out] | self | Command set with communication protocol and response. |
| [in] | policy_bytes | Pointer to ifx_blob_t handler to store access condition for I2C and NFC read/write operation along with FileID. |
| IFX_SUCCESS | : If API operation is successful |
| IFX_ILLEGAL_ARGUMENT | : If invalid/NULL parameter is passed to function |
| IFX_OUT_OF_MEMORY | : If memory allocation fails |
| ifx_status_t nbt_update_fap_bytes_with_password | ( | nbt_cmd_t * | self, |
| const ifx_blob_t * | policy_bytes, | ||
| const ifx_blob_t * | master_password ) |
Updates file access conditions in FAP file from policy bytes. When FAP file is password protected (optional). If FAP file is not password protected, then no need to authenticate with the master password, pass the master password as NULL.
| [in,out] | self | Command set with communication protocol and response. |
| [in] | policy_bytes | Pointer to ifx_blob_t handler to store access condition for I2C and NFC read/write operation along with FileID. |
| [in] | master_password | Pointer to ifx_blob_t handler to store FAP file write write password(4 bytes), if FAP file write operation is password protected(optional). |
| IFX_SUCCESS | : If API operation is successful |
| IFX_ILLEGAL_ARGUMENT | : If invalid/NULL parameter is passed to function |
| IFX_OUT_OF_MEMORY | : If memory allocation fails |
| ifx_status_t nbt_update_fap_with_password | ( | nbt_cmd_t * | self, |
| const nbt_file_access_policy_t * | fap_policy, | ||
| const ifx_blob_t * | master_password ) |
Updates file access conditions in FAP file. when FAP file is password protected(optional). If FAP file is not password protected, then no need to authenticate with the master password, pass the master password as NULL.
| [in,out] | self | Command set with communication protocol and response. |
| [in] | fap_policy | Pointer to nbt_file_access_policy_t handler to store fap file access conditions for I2C and NFC interface |
| [in] | master_password | Pointer to ifx_blob_t handler to store FAP file master master password(4 bytes), if FAP file is password protected(optional) |
| IFX_SUCCESS | : If API operation is successful |
| IFX_ILLEGAL_ARGUMENT | : If invalid/NULL parameter is passed to function |
| IFX_OUT_OF_MEMORY | : If memory allocation fails |